[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bug fix for $((x**y)) algorithm on 64+ bits machines.
From: |
Stephane CHAZELAS |
Subject: |
Re: Bug fix for $((x**y)) algorithm on 64+ bits machines. |
Date: |
Wed, 28 Mar 2012 18:26:27 -0000 |
User-agent: |
slrn/pre1.0.0-18 (Linux) |
2011-09-16, 17:17(-07), William Park:
> 145557834293068928043467566190278008218249525830565939618481
> is awfully big number! :-)
3**2**62 is 3**(2**62), 3**4611686018427387904, not a number you
can represent with 64bits, nor any reasonable number of bits,
not (3**2)**62.
Certainly not a number that bash arithmetic expansion can handle
not even in floating mode.
Wih zsh:
$ echo $((exp((2**62)*log(3))))
inf.
$ echo 'e((2^62)*l(3))' | bc -l
Runtime warning (func=e, adr=123): scale too large, set to 2147483647
Fatal error: Out of memory for malloc.
--
Stephane