cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - New to the community? Learn how to post a question and get help from PTC and industry experts! X

Yet Another Floating Point Error

yeet
1-Newbie

Yet Another Floating Point Error

Hi all,

There occured a problem in my work and I traced back the error, because of the dependencies it was hard to spot but once done, it seems like a really simple problem but can not explain why. Hopefully experienced users can help me get over this.

Have a nice day

1 ACCEPTED SOLUTION

Accepted Solutions
RichardJ
19-Tanzanite
(To:yeet)

It's not a bug at all. Im(exp(i*x)) is only equal to sin(x) for real x.

You have numbers with large imaginary parts. The sin of such numbers have both real and imaginary parts that are outside the range of the floating point processor. So you get a floating point error.

View solution in original post

4 REPLIES 4
AlanStevens
17-Peridot
(To:yeet)

You can get a result by taking the imaginary part of e^ix, where x is the argument you pass to the sin function. It is zero to within the numerical precision of Mathcad. Don't know why the sin function itself doesn't like it - some peculiarity of its algorithm I guess. See attached.

Alan

Is this a confirmed bug or am I missing something ? There seems to be no reason to get floating point error in this case.

RichardJ
19-Tanzanite
(To:yeet)

It's not a bug at all. Im(exp(i*x)) is only equal to sin(x) for real x.

You have numbers with large imaginary parts. The sin of such numbers have both real and imaginary parts that are outside the range of the floating point processor. So you get a floating point error.

yeet
1-Newbie
(To:RichardJ)

Is it possible for Mathcad to use as many floated decimal as processor can ? Precision will be sacrificed for sure but is it doable ? If it had parallel processing capabilities, this wouldn't be a problem IMHO.

Top Tags