strange results.. ?

P

psy

[Note: parts of this message were removed to make it a legal post.]


Hello people,

Here I get some strange (for me) results :


irb(main):012:0> 0.4 - 0.3 - 0.1
=> 2.77555756156289e-17

irb(main):013:0> 0.5 - 0.4 - 0.1
=> -2.77555756156289e-17

irb(main):017:0> 0.2 + 0.7 - 0.9
=> -1.11022302462516e-16

Can somebody explain what happens here or point me some place where i
can get information for this topic?
Thanks in advance!
 
Y

yermej

[Note: parts of this message were removed to make it a legal post.]

Hello people,

Here I get some strange (for me) results :

irb(main):012:0> 0.4 - 0.3 - 0.1
=> 2.77555756156289e-17

irb(main):013:0> 0.5 - 0.4 - 0.1
=> -2.77555756156289e-17

irb(main):017:0> 0.2 + 0.7 - 0.9
=> -1.11022302462516e-16

Can somebody explain what happens here or point me some place where i
can get information for this topic?
Thanks in advance!

http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top