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

SCM Repository

[diderot] Diff of /trunk/src/compiler/fields/rational.sml
ViewVC logotype

Diff of /trunk/src/compiler/fields/rational.sml

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

revision 460, Wed Oct 27 16:11:13 2010 UTC revision 461, Wed Oct 27 22:48:29 2010 UTC
# Line 13  Line 13 
13    
14      val zero : rat      val zero : rat
15    
16        val explode : rat -> {sign : int, num : IntInf.int, denom : IntInf.int}
17    
18      val ~ : rat -> rat      val ~ : rat -> rat
19      val + : rat * rat -> rat      val + : rat * rat -> rat
20      val - : rat * rat -> rat      val - : rat * rat -> rat
# Line 59  Line 61 
61     *)     *)
62      datatype rat = R of {num : II.int, denom : II.int}      datatype rat = R of {num : II.int, denom : II.int}
63    
64        fun explode {num, denom} =
65              if (num < 0)
66                then {sign = -1, num = ~num, denom = denom}
67              else if (num = 0)
68                then {sign = 0, num = 0, denom = 0}
69                else {sign = 1, num = num, denom = denom}
70    
71      val zero = R{num=0, denom=1}      val zero = R{num=0, denom=1}
72    
73      fun gcd (a : II.int, 0) = a      fun gcd (a : II.int, 0) = a

Legend:
Removed from v.460  
changed lines
  Added in v.461

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