Saturday, March 17, 2012

What sorcery is this!? Computers can divide by zero!

I can't believe it! Including the directive <cmath> to my source code actually allows the computer to calculate infinite values. I had a small error with the Leibniz's Pi approximation series where I ended up basically dividing 1 by zero and multiplying that by 4, but this is what I got:

 Please enter the number of terms you would  
 like to sum from the Leibniz's Pi approximation series: 0  
   
 The sum of the 0 term(s) results in  
 the Pi approximation equal to: inf.  

There's no floating point exception!

No comments:

Post a Comment