Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /trunk/src/compiler/common/float-lit.sml
ViewVC logotype

Diff of /trunk/src/compiler/common/float-lit.sml

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

revision 2355, Sun Apr 7 11:35:08 2013 UTC revision 2356, Sun Apr 7 14:45:25 2013 UTC
# Line 15  Line 15 
15      val isZero : float -> bool          (* true for 0 or -0 *)      val isZero : float -> bool          (* true for 0 or -0 *)
16      val isNeg : float -> bool           (* true for negative numbers (incl. -0) *)      val isNeg : float -> bool           (* true for negative numbers (incl. -0) *)
17    
18    (* return the representation of +/-0.0 *)    (* return the representation of +/-0.0, where zero true is -0.0 *)
19      val zero : bool -> float      val zero : bool -> float
20    
21    (* plus and minus one *)    (* plus and minus one *)
# Line 48  Line 48 
48      val fromDigits : {isNeg : bool, digits : int list, exp : int} -> float      val fromDigits : {isNeg : bool, digits : int list, exp : int} -> float
49    
50    (* create a float literal from an integer *)    (* create a float literal from an integer *)
51      val fromInt : int -> float      val fromInt : IntInf.int -> float
52    
53      val toString : float -> string      val toString : float -> string
54      val toReal : float -> real      val toReal : float -> real
# Line 191  Line 191 
191        | fromInt n = let        | fromInt n = let
192            val (isNeg, n) = if (n < 0) then (true, ~n) else (false, n)            val (isNeg, n) = if (n < 0) then (true, ~n) else (false, n)
193            fun toDigits (n, d) = if n < 10            fun toDigits (n, d) = if n < 10
194                  then n :: d                  then IntInf.toInt n :: d
195                  else toDigits(Int.quot(n, 10), Int.rem(n, 10) :: d)                  else toDigits(IntInf.quot(n, 10), IntInf.toInt(IntInf.rem(n, 10)) :: d)
196            fun cvt isNeg = let            fun cvt isNeg = let
197                  val digits = toDigits(n, [])                  val digits = toDigits(n, [])
198                  in                  in

Legend:
Removed from v.2355  
changed lines
  Added in v.2356

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