×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

why?? it should be another thing!!

why?? it should be another thing!!

why?? it should be another thing!!

(OP)
Hi

as you now exp(i*pi)=-1
and as well exp(i*pi)+1 should be 0
but you find it is 1.2246e-016i!!!! in matlab..
does somebody know why???
tnx

RE: why?? it should be another thing!!

Why would you think that a numerical processor has infinite precision?

TTFN



RE: why?? it should be another thing!!

The exponential is an infinite series. If you have an infinite amount of time you can get a better answer.

corus

RE: why?? it should be another thing!!

"If you have an infinite amount of time you can get a better answer"
Not quite, you would also need a computer with an infinite number of bits. That is to say this is a quantisation problem not a time one.

RE: why?? it should be another thing!!

Actually FrancisL since its a converging infinite series any computer will do - you just need a bigger stack of paper in your printer smile

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

Steam Engine enthusiasts: www.essexsteam.co.uk

RE: why?? it should be another thing!!

So long as you don't use floating point... the source of the rounding errors.

bcd maths would be better...

RE: why?? it should be another thing!!

bcd math would have to be floating point as well, to represent cos().  These are irrational numbers and cannot be represented in any format exactly.

TTFN



RE: why?? it should be another thing!!

That is hat I was trying to say earlier!
Francis

RE: why?? it should be another thing!!

Indeed.

But bcd math doesn't have the binary/decimal conversion error.

clown

RE: why?? it should be another thing!!

The conversion error is at the limit of the machine's precision, so it really doesn't matter whether you were able to express 0.1 exactly in BCD, when there is an infinite number of cases that BCD doesn't help anyway.

TTFN



RE: why?? it should be another thing!!


You can calculate using scaled integers to any arbitrary precision, as long as the function can be reduced to a converging series. About 20 years ago I was teaching a BASIC programming class in which we calculated pi and e to 100000 places using integer arithmetic.

Took some time to calculate though smile

Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting

Steam Engine enthusiasts: www.essexsteam.co.uk

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources