[floats][infinity][C99]
Daniel Kochmański
daniel at turtleware.eu
Fri Sep 4 18:14:21 UTC 2015
Raymond Toy writes:
>>>>>> "Daniel" == Daniel Kochma <Daniel> writes:
>
> Daniel> Also, we'll have to define such infinity for each architecture
> Daniel> separately, depending on the endianess?
> >>
> >> Yes, probably. But you only need to set up MSB/LSB to get the right
> >> thing. I think. At least that's how fdlibm works and how cmucl
> >> produces it's infinities (in C code). Of course in Lisp, cmucl has
> >> special builtins to create floats from bits appropriately. Perhaps
> >> ecl can do something similar. (But there are separate implementations
> >> for each architecture.)
>
> Daniel> I'd rather avoid that. ECL runs now on number of architectures I have no
> Daniel> access too.
>
> I suspect every arch you care about has 32 (or 64) bit words, and all
> floats are IEEE.
>
> So, perhaps it would be easier to create them as you mentioned
> earlier via 1/0 and 0/0 or related expressions.
>
> This requires that you be able to turn off exceptions in C, but ecl
> can probably already do that.
I'll fallback to it, if C99 extension isn't present, that is:
#ifndef INFINITY
#define INFINITY (1.0 / 0.0)
#endif
#ifndef NAN
#define NAN (0.0 / 0.0)
#endif
Thanks for help.
Best regards,
Daniel
--
Daniel Kochmański | Poznań, Poland
;; aka jackdaniel
"Be the change that you wish to see in the world." - Mahatma Gandhi
More information about the ecl-devel
mailing list