Closed bambooleafz closed 3 months ago
Thank you, @bambooleafz for the bug report.
We have verified that for some reason, the sign of log2(x)
alternates:
$ calc
C-style arbitrary precision calculator (version 2.15.0.6)
Calc is open software. For license details type: help copyright
[Type "exit" to exit, or "help" for help.]
; log2(0.5)
-1
; log2(0.5)
1
; log2(0.5)
-1
; log2(0.5)
1
We are currently deal with an infrastructure emergency, so it may be a week++ before we can address this bug. In the mean time we welcome anyone who might have a recommended patch.
more bugs found in log2()
, log()
(log10), exp()
, power......
; log2(1.0)
~4.53236014182719380961i
; log2(1)
~4.53236014182719380961
; log2(2)
-1
; log2(2)
-1
; log2(2.0)
-1
; log2(2.0)
-1
; log(10)
-1
; log(10)
-1
; exp(1)
0.3678794411714423216
; exp(1)
0.3678794411714423216
; exp(1.00001)
2.71830901141324437028
; 1^0
-1
; 2^0
-1
; 3^0
-1
; 1^1
-1
; 2^1
2
it looks like that the result of exp(1) is actually exp(-1)
a new discovery
u0_a240@localhost ~> calc
C-style arbitrary precision calculator (version 2.15.0.5)
Calc is open software. For license details type: help copyright
[Type "exit" to exit, or "help" for help.]
; log2(1)
0
; 0^0
1
; 1^0
1
; exp(1)
2.71828182845904523536
; log2(0.5)
-1
; log2(0.5)
1
; log2(1)
0
; log2(0.5)
-1
; log2(1)
~4.53236014182719380961i
; 0^0
-1
; 1^0
-1
; exp(1)
0.3678794411714423216
;
Thank you @bambooleafz for the bug report and fix.
We had a rapid test and verified that this bug has been fixed.
Please see calc 2.15.0.7 release.
BTW, did you add a regression test for bugs like this?
BTW, did you add a regression test for bugs like this?
Sorry, @pmetzger, we forgot to include the change to cal/regress.cal
for the regression test we used to verify the fix. Thanks for point this out!
The bug looks like this. Tested on termux with arm64 cpu.
When I enter
-0.5*log2(0.5)
, it gets the correct result. However, when doing the same operation again, the sign is incorrectAlso tested on Archlinux (x86_64), and the bug still exists.