alice
library
manual.

Alice Project

The REAL signature


________ Synopsis ____________________________________________________

    signature REAL
    structure Real : REAL where type real = real
    structure LargeReal : REAL = Real
  

An extended version of the Standard ML Basis' REAL signature.

See also: IEEEReal, MATH, HASHABLE, ORDERED


________ Import ______________________________________________________

Imported implicitly.


________ Interface ___________________________________________________

    signature REAL =
    sig
	eqtype real
	type t = real

	structure Math :   MATH where type real = real

	val posInf :       real
	val negInf :       real

	val ~ :            real -> real
	val op + :         real * real -> real
	val op - :         real * real -> real
	val op * :         real * real -> real
	val op / :         real * real -> real
	val rem :          real * real -> real
	val *+ :           real * real * real -> real
	val *- :           real * real * real -> real

	val abs :          real -> real
	val min :          real * real -> real
	val max :          real * real -> real
	val sign :         real -> int
	val signBit :      real -> bool
	val sameSign :     real * real -> bool
	val copySign :     real * real -> real

	val op < :         real * real -> bool
	val op > :         real * real -> bool
	val op <= :        real * real -> bool
	val op >= :        real * real -> bool
	val equal :        real * real -> bool
	val compare :      real * real -> order
	val compareReal :  real * real -> IEEEReal.real_order

	val == :           real * real -> bool
	val != :           real * real -> bool
	val ?= :           real * real -> bool

	val isFinite :     real -> bool
	val isNan :        real -> bool
	val isNormal :     real -> bool
	val class :        real -> IEEEReal.float_class
	val checkFloat :   real -> real

	val ceil :         real -> int
	val floor :        real -> int
	val trunc :        real -> int
	val round :        real -> int
	val realFloor :    real -> real
	val realCeil :     real -> real
	val realTrunc :    real -> real
	val realRound :    real -> real

	val toInt :        IEEEReal.rounding_mode -> real -> int
	val toLargeInt :   IEEEReal.rounding_mode -> real -> LargeInt.int
	val fromInt :      int -> real
	val fromLargeInt : LargeInt.int -> real
	val toLarge :      real -> LargeReal.real
	val fromLarge :    IEEEReal.rounding_mode -> LargeReal.real -> real

	val toString :     real -> string
	val fromString :   string -> real option
	val scan :         (char,'a) StringCvt.reader -> (real,'a) StringCvt.reader
    end
  

________ Description _________________________________________________

Items not described here are as in the Standard ML Basis' REAL signature.

Limitations: The following standard values and functions are currently missing:

Furthermore, the functions isNormal and class are not implemented accurately.

eqtype real
type t = real

A type for representing floating point numbers. Note that, unlike in the Standard Basis, real is an equality type. However, two reals compare as equal only if they have exactly the same representation. In particular, 0.0 <> ~0.0. For IEEE equality, Real.== should be used.

equal (x1, x2)

An explicit equality function on reals. Equivalent to op=.

hash x

A hash function on reals.



last modified 2007/Mar/30 17:10