Home My Page Projects Code Snippets Project Openings SML/NJ
Summary Activity Forums Tracker Lists Tasks Docs Surveys News SCM Files

SCM Repository

[smlnj] Diff of /sml/trunk/src/system/Basis/Implementation/real64.sml
ViewVC logotype

Diff of /sml/trunk/src/system/Basis/Implementation/real64.sml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1380, Wed Sep 17 20:20:51 2003 UTC revision 1381, Wed Sep 17 21:28:41 2003 UTC
# Line 28  Line 28 
28              | _ => true              | _ => true
29            (* end case *))            (* end case *))
30    
31      val rbase = 1073741824.0    (* should be taken from CoreIntInf.base *)  
32        val w31_r = InlineT.Real64.from_int32 o InlineT.Int32.copy_word31
33    
34        val rbase = w31_r CoreIntInf.base
35        val intbound = w31_r 0wx40000000    (* not necessarily the same as rbase *)
36        val negintbound = ~intbound
37    
38    (* The next three values are computed laboriously, partly to    (* The next three values are computed laboriously, partly to
39     * avoid problems with inaccurate string->float conversions     * avoid problems with inaccurate string->float conversions
# Line 77  Line 82 
82    
83      fun isFinite x = negInf < x andalso x < posInf      fun isFinite x = negInf < x andalso x < posInf
84      fun isNan x = Bool.not(x==x)      fun isNan x = Bool.not(x==x)
85      fun floor x = if x < 1073741824.0 andalso x >= ~1073741824.0      fun floor x = if x < intbound andalso x >= negintbound then
86                     then Assembly.A.floor x                        Assembly.A.floor x
87                    else if isNan x then raise General.Domain                    else if isNan x then raise General.Domain
88                    else raise General.Overflow                    else raise General.Overflow
89    
# Line 111  Line 116 
116      val realFloor = realround IEEEReal.TO_NEGINF      val realFloor = realround IEEEReal.TO_NEGINF
117      val realCeil = realround IEEEReal.TO_POSINF      val realCeil = realround IEEEReal.TO_POSINF
118      val realTrunc = realround IEEEReal.TO_ZERO      val realTrunc = realround IEEEReal.TO_ZERO
119        val realRound = realround IEEEReal.TO_NEAREST
120      end      end
121    
122      val abs : real -> real = InlineT.Real64.abs      val abs : real -> real = InlineT.Real64.abs
123      val fromInt : int -> real = InlineT.real      val fromInt : int -> real = InlineT.Real64.from_int31
124    
125      fun toInt IEEEReal.TO_NEGINF = floor      fun toInt IEEEReal.TO_NEGINF = floor
126        | toInt IEEEReal.TO_POSINF = ceil        | toInt IEEEReal.TO_POSINF = ceil
# Line 146  Line 152 
152          else if x == y then IEEEReal.EQUAL          else if x == y then IEEEReal.EQUAL
153          else IEEEReal.UNORDERED          else IEEEReal.UNORDERED
154    
155  (** This proably needs to be reorganized **)  (** This probably needs to be reorganized **)
156      fun class x =  (* does not distinguish between quiet and signalling NaN *)      fun class x =  (* does not distinguish between quiet and signalling NaN *)
157        if signBit x        if signBit x
158         then if x>negInf then if x == 0.0 then IEEEReal.ZERO         then if x>negInf then if x == 0.0 then IEEEReal.ZERO

Legend:
Removed from v.1380  
changed lines
  Added in v.1381

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0