Real.maxFinite and friends

Stephen Weeks MLton@sourcelight.com
Sat, 6 Oct 2001 19:22:25 -0700


> The only thing that isn't
> clear to me is how to handle floating point constants; are they overloaded
> by context the way ints are; 
> 
> open Real64
> val r1 = 0.123
> open Real80
> val r2 = 0.123

Yes, reals are overloaded just like ints.  No, the open's above don't establish
context (just like open doesn't for int).  I.E. both r1 and r2 above would have
the same type, Real.real.

As to the other Real stuff, here is the way I think we should go.

1. Have all three structures, Real32, Real64, and Real80.
2. Real = Real80.
3. Real64 behaves according to the -ieee-fp flag.
4. Real32 and Real80 do not depend on -ieee-fp.
5. Real32.real (float) and Real64.real (double) are allowed to be used in FFI's,
   and Real80 is not.  I.E. No implicit coercion.
6. The following Real.x are all _prims
	x = maxFinite minNormalPos minPos negInf posInf Math.pi Math.e
7. The values of the Real constants in (6) are all hardwired into the compiler.
   I.E. there is no use of lookup-constants.  Each codegen knows how to spit
   out the appropriate bits in either a .c or .s file.