Re: [prolog-standard] Re: Fwd: Preliminary draft for the revised ISO Prolog core standard

From: Mats Carlsson <matsc_at_sics.se>
Date: Thu, 16 Nov 2006 22:30:49 +0100

> >>> One consequence of this floating-point contagion is that in a system
> >>> with
> >>>
> >>> bigints - like SICStus - max/2 can now also throw an overflow exception:
> >>> | ?- X is 234<<23423, Y is max(X,0.1).
> >>>
> >>> ! Evaluation error in argument 2 of is/2
> >>> ! float_overflow at 2482014388617793184935802414678 [some more digits
> >>> snipped away by me]
>
> But that's simply a bug, isn't it? ECLiPSe says:
>
> ?- X is 234 << 23423, Y is max(X, 0.1).
> X = 2482014388617793184935802414678453594506527110211601991200031311191...
> Y = 1.0Inf
> Yes (0.00s cpu)

It's not a bug, it follows from the type coersion semantics that
SICStus uses. One argument is a float => the value is a float. But
234<<23423 can't be converted to a floating-point number: there are
not enough bits in the exponent, which is what the exception is about.
--Mats

P.S. What does "1.0Inf" mean?
_______________________________________________
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