This is the mail archive of the kawa@sourceware.org mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Float syntax


On 01/10/2011 09:06 AM, Helmut Eller wrote:
* Jamison Hope [2011-01-10 16:26] writes:

On Jan 9, 2011, at 3:40 AM, Helmut Eller wrote:

Is there a syntax for Float.POSITIVE_INFINITY or
Double.POSITIVE_INFINITY?  Or is that somehow the same as +inf.0?
...
I'm reading the float value as s-expr from a file, so this doesn't work
in my case.  I ended up using a the symbol 'positive-infinity and handle
that in the parsing code.

We could come up with a syntax. For example +inf.0s or +inf.0s0


Some fun facts about floats:

(= 0.0s0 0.0s0) =>  #t
(eqv? 0.0s0 0.0s0) =>  #f

Oops. That's an (optimization) bug. I checked in a fix.


(equal? 0.0s0 0.0s0) =>  #t
(= 0.0s0 0.0d0) =>  #t
(eqv? 0.0s0 0.0d0) =>  #f
(equal? 0.0s0 0.0d0) =>  #f
(= java.lang.Double:POSITIVE_INFINITY
    java.lang.Float:POSITIVE_INFINITY) =>  #t
(equal? java.lang.Double:POSITIVE_INFINITY
         java.lang.Float:POSITIVE_INFINITY) =>  #f

I think the other ones are correct. I added them all to num-test.scm. -- --Per Bothner per@bothner.com http://per.bothner.com/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]