| 1 |
= MLtonReal |
| 2 |
|
| 3 |
[source,sml] |
| 4 |
---- |
| 5 |
signature MLTON_REAL = |
| 6 |
sig |
| 7 |
type t |
| 8 |
|
| 9 |
val fromWord: word -> t |
| 10 |
val fromLargeWord: LargeWord.word -> t |
| 11 |
val toWord: IEEEReal.rounding_mode -> t -> word |
| 12 |
val toLargeWord: IEEEReal.rounding_mode -> t -> LargeWord.word |
| 13 |
end |
| 14 |
---- |
| 15 |
|
| 16 |
* `type t` |
| 17 |
+ |
| 18 |
the type of reals. For `MLton.LargeReal` this is `LargeReal.real`, |
| 19 |
for `MLton.Real` this is `Real.real`, for `MLton.Real32` this is |
| 20 |
`Real32.real`, for `MLton.Real64` this is `Real64.real`. |
| 21 |
|
| 22 |
* `fromWord w` |
| 23 |
* `fromLargeWord w` |
| 24 |
+ |
| 25 |
convert the word `w` to a real value. If the value of `w` is larger |
| 26 |
than (the appropriate) `REAL.maxFinite`, then infinity is returned. |
| 27 |
If `w` cannot be exactly represented as a real value, then the current |
| 28 |
rounding mode is used to determine the resulting value. |
| 29 |
|
| 30 |
* `toWord mode r` |
| 31 |
* `toLargeWord mode r` |
| 32 |
+ |
| 33 |
convert the argument `r` to a word type using the specified rounding |
| 34 |
mode. They raise `Overflow` if the result is not representable, in |
| 35 |
particular, if `r` is an infinity. They raise `Domain` if `r` is NaN. |
| 36 |
|
| 37 |
* `MLton.Real32.castFromWord w` |
| 38 |
* `MLton.Real64.castFromWord w` |
| 39 |
+ |
| 40 |
convert the argument `w` to a real type as a bit-wise cast. |
| 41 |
|
| 42 |
* `MLton.Real32.castToWord r` |
| 43 |
* `MLton.Real64.castToWord r` |
| 44 |
+ |
| 45 |
convert the argument `r` to a word type as a bit-wise cast. |