REBOL3 tracker
  0.9.12 beta
Ticket #0001029 User: anonymous

Project:



rss
TypeBug Statusreviewed Date1-Jul-2009 10:03
Versionalpha 65 CategoryDatatype Submitted bymeijeru
PlatformAll Severityminor Prioritynormal

Summary Treatment of INF (and NaN) in 64 and 32 bit decimals
Description Decimals are stored according to the IEEE standard 754-2008. This foresees special encoding of positive and negative infinity, as well as "not a number" (NaN). For the type decimal! these encodings cannot be stored, e.g. through conversion from binary. However, I have found at least a way to get +INF through defining a vector with 32 bit decimals and storing too large a number. This value is then printed out as 1.#INF (!).
Example code
>> to-decimal #{7FF0000000000000} ;; official encoding of +INF in 64 bits
** Math error: math or number overflow
>> make vector! [decimal! 32] ;; cannot hold more than ca. 1E38
>> v/1: 1E39 ; push it beyond the limit
== 1.0e39
>> to-binary v/1
== #{7FF0000000000000} ; to-binary operates AFTER conversion of 32 bit +INF to 64 bits +INF!
>> v/1
== 1.#INF ; this is how it is formed/molded

Assigned ton/a Fixed in- Last Update4-Aug-2009 20:07


Comments
(0001170)
BrianH
1-Jul-2009 14:00

Sounds like this line:
>> v/1: 1E39
== 1.0e39
should have done some bounds-checking during the assignment.

Date User Field Action Change
4-Aug-2009 20:07 BrianH Code Modified -
4-Aug-2009 20:07 BrianH Category Modified => Datatype
4-Aug-2009 20:07 BrianH Status Modified submitted => reviewed
4-Aug-2009 20:07 BrianH Type Modified Issue => Bug
1-Jul-2009 14:00 BrianH Comment : 0001170 Added -
1-Jul-2009 10:03 meijeru Ticket Added -