From: Joel VanderWerf Date: 2009-01-10T06:25:06+09:00 Subject: Re: Behavior of 0 and 0.0... Gary Wright wrote: > > On Jan 9, 2009, at 3:51 PM, Raphael Clancy wrote: > >> I was playing around with the basic math functions, and I had some >> questions about the way Ruby handles operations with 0 and 0.0. > > I'm guessing that you are seeing IEEE floating point behavior with > the floating point operations and that there isn't a perfect analog > to that behavior with integer operations. IEEE floating > point defines binary representations of negative and positive zero, > negative and positive infinity, and two types of NaN (not a number). > These 'numbers' aren't available when working with integers at the > machine level nor at the Ruby Fixnum or Bignum level. > > Gary Wright And just to underline the point... these behaviors are not ruby spec, but rather IEEE fp spec. -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407