MOO-cows Mailing List Archive


floating point support (was Re: suspend())

Pavel writes:
> (I just have to finish integrating HPA's floating-point support,
> a task which is going well and is more than half done.)

[...since I don't know exactly what's in HPA's floating-point support,
 I'll just insert a random plea and/or hope that HPA did it right...]

Whatever you do, please do *NOT* put in implicit coercions.  
For example, in

  a = 5.0;
  b = 3;
  c = a / b;

the third line should be throwing an error.  It may seem convenient to have
an implicit coercion in there, but in the long run this will lead to 
code with truncations silently occurring where you least expect them.

People seem to have this idea that, because integers can be viewed as a 
of the reals, that integers, as a datatype, should be a subTYPE of the 
datatype, and it just ain't so... (capsule summary:  it's not the sets of 
that matters so much as the sets of OPERATIONS that you want to be able to 
sin is not a sensible operation to use on integers ($trig_utils 
nor is % a sensible operation to use on floats; end of story).


Home | Subject Index | Thread Index