In arbitrary-precision arithmetics, the sign of the result of trigonometric and exponential functions is sometimes wrong.

Here's an excerpt of a formula printing some debug results:

complex m1 = exp(flip(#pi))
print("exp(i * #pi)=",m1)
float sin1=sin(#pi)
float cos1=cos(#pi)
print("cos(#pi)=",cos1, ", sin(#pi)=", sin1)

When I run this without additional precision, I get the following results:

exp(i * #pi)=(-1, 1.22460635382238E-016)
cos(#pi)=-1, sin(#pi)=1.22460635382238E-016

This (aside from some floating-point imprecision) is the result I and Leonhard Euler would expect.

If however I request enough additional precision to trigger arbitrary-precision math, I get:

exp(i * #pi)=(1, 0)
cos(#pi)=1, sin(#pi)=0

The exp and cos results don't have the correct sign.

The power function also doesn't work correctly with arbitrary precision. Example formula:

complex st=(-0.698827118771579245233, 0)
complex st_power2 = sqr(st)
complex st_power4 = sqr(st_power2)
complex st_power5 = st_power4*st
complex st_power5a = st^5
print("st=", st, ", st^2=", st_power2, ", st^4=", st_power4)
print(" st^5 should be ", st_power5, ", st^5 is ", st_power5a)

Result with double precision:

st=(-0.698827118771579, 0), st^2=(0.488359341930587, 0), st^4=(0.238494846850876, 0)
 st^5 should be (-0.166666666666666, 0), st^5 is (-0.166666666666666, -9.03501810404586E-021)
---

Correct, except for floating-point imprecision.

With arbitrary precision:

st=(-0.698827118771579245233, 0), st^2=(0.4883593419305869251049, 0), st^4=(0.2384948468508759168409, 0)
 st^5 should be (-0.1666666666666666666667, 0), st^5 is (0.1666666666666666666667, 0)
---

Again, the sign is wrong.

In arbitrary-precision arithmetics, the sign of the result of trigonometric and exponential functions is sometimes wrong. Here's an excerpt of a formula printing some debug results: complex m1 = exp(flip(#pi)) print("exp(i * #pi)=",m1) float sin1=sin(#pi) float cos1=cos(#pi) print("cos(#pi)=",cos1, ", sin(#pi)=", sin1) When I run this without additional precision, I get the following results: exp(i * #pi)=(-1, 1.22460635382238E-016) cos(#pi)=-1, sin(#pi)=1.22460635382238E-016 This (aside from some floating-point imprecision) is the result I and Leonhard Euler would expect. If however I request enough additional precision to trigger arbitrary-precision math, I get: exp(i * #pi)=(1, 0) cos(#pi)=1, sin(#pi)=0 The exp and cos results don't have the correct sign. The power function also doesn't work correctly with arbitrary precision. Example formula: complex st=(-0.698827118771579245233, 0) complex st_power2 = sqr(st) complex st_power4 = sqr(st_power2) complex st_power5 = st_power4*st complex st_power5a = st^5 print("st=", st, ", st^2=", st_power2, ", st^4=", st_power4) print(" st^5 should be ", st_power5, ", st^5 is ", st_power5a) Result with double precision: st=(-0.698827118771579, 0), st^2=(0.488359341930587, 0), st^4=(0.238494846850876, 0) st^5 should be (-0.166666666666666, 0), st^5 is (-0.166666666666666, -9.03501810404586E-021) --- Correct, except for floating-point imprecision. With arbitrary precision: st=(-0.698827118771579245233, 0), st^2=(0.4883593419305869251049, 0), st^4=(0.2384948468508759168409, 0) st^5 should be (-0.1666666666666666666667, 0), st^5 is (0.1666666666666666666667, 0) --- Again, the sign is wrong.
 
0
reply

I found the error and it will be fixed in the next UF6 update.

I found the error and it will be fixed in the next UF6 update.

Ultra Fractal author

 
0
reply
49
views
3
replies
2
followers
live preview
Enter at least 10 characters.
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft