|
Module Nummodule Num:
Operation on arbitrary-precision numbers.
Numbers (type type num =
The type of numbers.
val (+/) :
Same as
Num.add_num .val add_num :
Addition
val minus_num :
Unary negation.
val (-/) :
Same as
Num.sub_num .val sub_num :
Subtraction
val (*/) :
Same as
Num.mult_num .val mult_num :
Multiplication
val square_num :
Squaring
val (//) :
Same as
Num.div_num .val div_num :
Division
val quo_num :
Euclidean division: quotient.
val mod_num :
Euclidean division: remainder.
val (**/) :
Same as
Num.power_num .val power_num :
Exponentiation
val abs_num :
Absolute value.
val succ_num : succ n is n+1 val pred_num : pred n is n-1 val incr_num : incr r is r:=!r+1 , where r is a reference to a number.val decr_num : decr r is r:=!r-1 , where r is a reference to a number.val is_integer_num :
Test if a number is an integer
The four following functions approximate a number by an integer : val integer_num : integer_num n returns the integer closest to n . In case of ties,
rounds towards zero.val floor_num : floor_num n returns the largest integer smaller or equal to n .val round_num : round_num n returns the integer closest to n . In case of ties,
rounds off zero.val ceiling_num : ceiling_num n returns the smallest integer bigger or equal to n .val sign_num :
Return
-1 , 0 or 1 according to the sign of the argument.
val (=/) : val () : val (>/) : val (<=/) : val (>=/) : val (<>/) : val eq_num : val lt_num : val le_num : val gt_num : val ge_num : val compare_num :
Return
-1 , 0 or 1 if the first argument is less than,
equal to, or greater than the second argument.val max_num :
Return the greater of the two arguments.
val min_num :
Return the smaller of the two arguments.
val string_of_num :
Convert a number to a string, using fractional notation.
val approx_num_fix :
See
Num.approx_num_exp .val approx_num_exp :
Approximate a number by a decimal. The first argument is the
required precision. The second argument is the number to
approximate.
Num.approx_num_fix uses decimal notation; the first
argument is the number of digits after the decimal point.
approx_num_exp uses scientific (exponential) notation; the
first argument is the number of digits in the mantissa.val num_of_string :
Convert a string to a number.
|