Project

General

Profile

Revision f0195e96 src/real.ml

View differences:

src/real.ml
16 16
  let num_10 = Num.num_of_int 10 in
17 17
  Num.(c // (num_10 **/ (num_of_int e)))
18 18

  
19
let rec to_q (c, e, s) =
20
  if e = 0 then
21
        Q.of_string (Num.string_of_num c)
22
  else
23
    if e > 0 then Q.div (to_q (c,e-1,s)) (Q.of_int 10)
24
    else (* if exp<0 then *)
25
      Q.mul
26
        (to_q (c,e+1,s))
27
        (Q.of_int 10)
28

  
19 29
let to_string (_, _, s) = s
20 30
                        
21 31
let eq r1 r2 =

Also available in: Unified diff