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

SCM Repository

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

Diff of /branches/vis12/src/compiler/common/float-lit.sml

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

revision 435, Tue Oct 19 13:14:20 2010 UTC revision 462, Wed Oct 27 22:48:45 2010 UTC
# Line 40  Line 40 
40     *)     *)
41      val float : {isNeg : bool, whole : string, frac : string, exp : int} -> float      val float : {isNeg : bool, whole : string, frac : string, exp : int} -> float
42    
43      (* create a float literal from a sign, decimal fraction, and exponent *)
44        val fromDigits : {isNeg : bool, digits : int list, exp : int} -> float
45    
46    (* create a float literal from an integer *)    (* create a float literal from an integer *)
47      val fromInt : int -> float      val fromInt : int -> float
48    
# Line 159  Line 162 
162              (* end case *)              (* end case *)
163            end            end
164    
165      (* create a float literal from a sign, decimal fraction, and exponent *)
166        fun fromDigits arg = let
167            (* normalize by stripping leading zero digits *)
168              fun normalize {isNeg, digits=[], exp} = zero isNeg
169                | normalize {isNeg, digits=0::r, exp} =
170                    normalize {isNeg=isNeg, digits=r, exp=exp-1}
171                | normalize flt = Flt flt
172              in
173                normalize arg
174              end
175    
176      fun fromInt 0 = zero false      fun fromInt 0 = zero false
177        | fromInt n = let        | fromInt n = let
178            val (isNeg, n) = if (n < 0) then (true, ~n) else (false, n)            val (isNeg, n) = if (n < 0) then (true, ~n) else (false, n)

Legend:
Removed from v.435  
changed lines
  Added in v.462

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