add missing file
parent
cd3e4172e9
commit
f8d35998f8
|
@ -236,6 +236,7 @@ vectors words ;
|
|||
"/library/math/integer.facts"
|
||||
"/library/math/math.facts"
|
||||
"/library/math/parse-numbers.facts"
|
||||
"/library/math/pow.facts"
|
||||
"/library/math/random.facts"
|
||||
"/library/math/ratio.facts"
|
||||
"/library/math/trig-hyp.facts"
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
USING: help math ;
|
||||
|
||||
HELP: exp "( x -- y )"
|
||||
{ $values { "x" "a complex number" } { "y" "a complex number" } }
|
||||
{ $description "Computes the exponential function." } ;
|
||||
|
||||
HELP: log "( x -- y )"
|
||||
{ $values { "x" "a complex number" } { "y" "a complex number" } }
|
||||
{ $description "Computes the natural logarithm function. Outputs negative infinity if " { $snippet "x" } " is 0." } ;
|
||||
|
||||
HELP: sqrt "( x -- y )"
|
||||
{ $values { "x" "a complex number" } { "y" "a complex number" } }
|
||||
{ $description "Computes the square root function." } ;
|
||||
|
||||
HELP: ^ "( x y -- z )"
|
||||
{ $values { "x" "a complex number" } { "y" "a complex number" } { "z" "a complex number" } }
|
||||
{ $description "Raises " { $snippet "x" } " to the power of " { $snippet "y" } ". If \texttt{y}" { $snippet "y" } " is an integer the answer is computed exactly, otherwise a floating point approximation is used." }
|
||||
{ $errors "Throws an error if " { $snippet "x" } " and " { $snippet "y" } " are both integer 0." } ;
|
||||
|
||||
HELP: each-bit "( n quot -- )"
|
||||
{ $values { "n" "an integer" } { "quot" "a quotation with stack effect " { $snippet "( 0/1 -- )" } } }
|
||||
{ $description "Applies the quotation to each bit of the input, ranging from least significant to most significant." } ;
|
||||
|
||||
HELP: power-of-2? "( n -- ? )"
|
||||
{ $values { "n" "an integer" } { "?" "a boolean" } }
|
||||
{ $description "Tests if " { $snippet "n" } " is a power of 2." } ;
|
||||
|
||||
HELP: log2 "( n -- b )"
|
||||
{ $values { "n" "a positive integer" } { "b" "an integer" } }
|
||||
{ $description "Computes the largest integer " { $snippet "b" } " such that " { $snippet "2^b" } " is less than " { $snippet "n" } "." }
|
||||
{ $errors "Throws an error if " { $snippet "n" } " is zero or negative." } ;
|
Loading…
Reference in New Issue