Menu

#4959 rectform of a complex float raised to a power is off by thirteen orders of magnitude

None
open
nobody
rectform (19)
5
16 hours ago
16 hours ago
No

cabs(rectform((1.0+1.0*%i)^200)) returns 2.48e43 where the modulus is 1.27e30

Maxima 5.49post, SBCL 2.6.7.

|(1+%i)^200| is 2^100 exactly. cabs of the unexpanded power is right; only passing through rectform destroys it.

(%i1) display2d:false$
(%i2) z: 1.0+1.0*%i$
(%i3) float(cabs(z)^200);
(%o3) 1.2676506002282469e30
(%i4) float(cabs(z^200));
(%o4) 1.2676506002282469e30
(%i5) float(cabs(rectform(z^200)));
(%o5) 2.4848313154328344e43
(%i6) block([fpprec:40], float(cabs(rectform(bfloat((1+%i)^200)))));
(%o6) 1.2676506002303272e30

Expected: (%o5) = 1.2676506002282294e30, which is 2^100.

realpart and imagpart of the same expression are wrong in the same way. The bigfloat route (%o6) is correct.

Discussion


Log in to post a comment.