1 (* Copyright (C
) 1999-2006, 2008 Henry Cejtin
, Matthew Fluet
, Suresh
2 * Jagannathan
, and Stephen Weeks
.
4 * MLton is released under a BSD
-style license
.
5 * See the file MLton
-LICENSE for details
.
8 functor Real (Real: sig
20 OrderedRing (structure R
=
21 RingWithIdentity (structure R
=
24 val layout
= Layout
.str
o toString
29 Relation
.lessEqual
{< = op <, equals
= equals
})
31 structure F
= OrderedField (open R
Real
32 fun inverse x
= one
/ x
)
38 case fromString (In
.inputToSpace i
) of
46 val fromIntInf
= fromLargeInt
47 val toIntInf
= toLargeInt IEEEReal
.TO_NEAREST
61 fun format (x
, f
) = Real.fmt f x
65 val k
= max (k
, n
- k
)
67 prodFromTo
{from
= add1 k
,
73 fun log (base
, arg
) = ln arg
/ ln base
77 fun log2 x
= ln x
/ ln2
79 fun realPower(m
, n
) = exp(n
* ln m
)
85 datatype t
= datatype IEEEReal
.float_class
90 structure Real64
= Real (open Real64
93 structure Real = Real64
94 structure Real32
= Real (open Real32