Jan Wielemaker <wielemak_at_science.uva.nl>
First of all, in practice min and max are rarely used with mixed types.
So what? That doesn't absolve us of the duty of getting them right.
Second, most implementations providing unbounded integer
arithmetic do not provide unbounded floats, so max(2<<10000,
2.0) raises an error if we promote the floats.
That is a straw man argument. Who said anything about promoting floats?
The only alternatives being considered are
- return wrong answers (apply floating-point contagion)
- return exact answers (*compare* floats and bignums correctly
without *converting* either).
What you do is compare
- signs first,
- then scale (power of two),
- then significands
so that no overflow, loss of precision, or other error is possible.
If you leave it undefined, there is no problem. I can't see
realistic scenarios where it matters.
There is always the possibility of making mixed mode min and max errors,
so that only
max(integer, integer) -> integer
and max(float, float) -> float
are allowed.
_______________________________________________
prolog-standard mailing list
prolog-standard_at_neve.di.ubi.pt
http://neve.di.ubi.pt/mailman/listinfo/prolog-standard
Received on Mon Jul 14 2008 - 13:01:02 EST
This archive was generated by hypermail 2.2.0 : Wed Sep 08 2010 - 23:28:17 EST