Menu

#5197 expand of complex float to high power loses precision

None
open
nobody
5
2 hours ago
2 hours ago
No

Expanding a power with complex float base loses a lot of precision.
Compare #4959

expand((1.0+%i)^200);
  => 2.8517e+41 %i - 2.4847e+43

This can be mitigated with more precision:

for fpprec:5 thru 100 step 10 do print( fpprec,expand((1.0b0+%i)^200));

5 3.4721b52 %i + 1.3389b53 
15 7.2764b42 %i - 3.9616b42 
25 4.304b32 %i + 9.9844b31 
35 2.6341b22 %i + 1.2677b30 
45 1.2677b30 - 1.05b12 %i 
55 5.76b2 %i + 1.2677b30 
65 1.2677b30 
75 1.2677b30 
85 1.2677b30 
95 1.2677b30 

but a better exponentiation algorithm would be preferable.

Discussion

  • Stavros Macrakis

    Stavros Macrakis - 2 hours ago
    • labels: --> simpexpt
     
  • Stavros Macrakis

    Stavros Macrakis - 2 hours ago
    • labels: simpexpt --> simpexpt, float
    • summary: expand of float to high power loses precision --> expand of complex float to high power loses precision
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,4 +1,4 @@
    -Expanding a power with float base loses a lot of precision.
    +Expanding a power with complex float base loses a lot of precision.
     Compare #4959
     ~~~
     expand((1.0+%i)^200);
    
     

Log in to post a comment.