math.libm: use FUNCTION-ALIAS:
parent
e5c1a82643
commit
efbc3033da
|
@ -36,53 +36,53 @@ ARTICLE: "math.libm" "C standard library math functions"
|
||||||
ABOUT: "math.libm"
|
ABOUT: "math.libm"
|
||||||
|
|
||||||
HELP: facos
|
HELP: facos
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the inverse trigonometric cosine function from the C standard library. User code should call " { $link acos } " instead." } ;
|
{ $description "Calls the inverse trigonometric cosine function from the C standard library. User code should call " { $link acos } " instead." } ;
|
||||||
|
|
||||||
HELP: fasin
|
HELP: fasin
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the inverse trigonometric sine function from the C standard library. User code should call " { $link asin } " instead." } ;
|
{ $description "Calls the inverse trigonometric sine function from the C standard library. User code should call " { $link asin } " instead." } ;
|
||||||
|
|
||||||
HELP: fatan
|
HELP: fatan
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the inverse trigonometric tangent function from the C standard library. User code should call " { $link atan } " instead." } ;
|
{ $description "Calls the inverse trigonometric tangent function from the C standard library. User code should call " { $link atan } " instead." } ;
|
||||||
|
|
||||||
HELP: fatan2
|
HELP: fatan2
|
||||||
{ $values { "x" real } { "y" real } { "z" real } }
|
{ $values { "x" real } { "y" real } { "double" real } }
|
||||||
{ $description "Calls the two-parameter inverse trigonometric tangent function from the C standard library. User code should call " { $link arg } " instead." } ;
|
{ $description "Calls the two-parameter inverse trigonometric tangent function from the C standard library. User code should call " { $link arg } " instead." } ;
|
||||||
|
|
||||||
HELP: fcos
|
HELP: fcos
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the trigonometric cosine function from the C standard library. User code should call " { $link cos } " instead." } ;
|
{ $description "Calls the trigonometric cosine function from the C standard library. User code should call " { $link cos } " instead." } ;
|
||||||
|
|
||||||
HELP: fsin
|
HELP: fsin
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the trigonometric sine function from the C standard library. User code should call " { $link sin } " instead." } ;
|
{ $description "Calls the trigonometric sine function from the C standard library. User code should call " { $link sin } " instead." } ;
|
||||||
|
|
||||||
HELP: fcosh
|
HELP: fcosh
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the hyperbolic cosine function from the C standard library. User code should call " { $link cosh } " instead." } ;
|
{ $description "Calls the hyperbolic cosine function from the C standard library. User code should call " { $link cosh } " instead." } ;
|
||||||
|
|
||||||
HELP: fsinh
|
HELP: fsinh
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the hyperbolic sine function from the C standard library. User code should call " { $link sinh } " instead." } ;
|
{ $description "Calls the hyperbolic sine function from the C standard library. User code should call " { $link sinh } " instead." } ;
|
||||||
|
|
||||||
HELP: fexp
|
HELP: fexp
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the exponential function (" { $snippet "y=e^x" } " from the C standard library. User code should call " { $link exp } " instead." } ;
|
{ $description "Calls the exponential function (" { $snippet "y=e^x" } " from the C standard library. User code should call " { $link exp } " instead." } ;
|
||||||
|
|
||||||
HELP: flog
|
HELP: flog
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
|
{ $description "Calls the natural logarithm function from the C standard library. User code should call " { $link log } " instead." } ;
|
||||||
|
|
||||||
HELP: flog10
|
HELP: flog10
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the base 10 logarithm function from the C standard library. User code should call " { $link log10 } " instead." } ;
|
{ $description "Calls the base 10 logarithm function from the C standard library. User code should call " { $link log10 } " instead." } ;
|
||||||
|
|
||||||
HELP: fpow
|
HELP: fpow
|
||||||
{ $values { "x" real } { "y" real } { "z" real } }
|
{ $values { "x" real } { "y" real } { "double" real } }
|
||||||
{ $description "Calls the power function (" { $snippet "z=x^y" } ") from the C standard library. User code should call " { $link ^ } " instead." } ;
|
{ $description "Calls the power function (" { $snippet "z=x^y" } ") from the C standard library. User code should call " { $link ^ } " instead." } ;
|
||||||
|
|
||||||
HELP: fsqrt
|
HELP: fsqrt
|
||||||
{ $values { "x" real } { "y" real } }
|
{ $values { "x" real } { "double" real } }
|
||||||
{ $description "Calls the square root function from the C standard library. User code should call " { $link sqrt } " instead." } ;
|
{ $description "Calls the square root function from the C standard library. User code should call " { $link sqrt } " instead." } ;
|
||||||
|
|
|
@ -1,62 +1,64 @@
|
||||||
! Copyright (C) 2006 Slava Pestov.
|
! Copyright (C) 2006 Slava Pestov.
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: alien alien.c-types ;
|
USING: alien alien.c-types alien.syntax ;
|
||||||
IN: math.libm
|
IN: math.libm
|
||||||
|
|
||||||
: facos ( x -- y )
|
LIBRARY: libm
|
||||||
double "libm" "acos" { double } alien-invoke ;
|
|
||||||
|
|
||||||
: fasin ( x -- y )
|
FUNCTION-ALIAS: facos
|
||||||
double "libm" "asin" { double } alien-invoke ;
|
double acos ( double x ) ;
|
||||||
|
|
||||||
: fatan ( x -- y )
|
FUNCTION-ALIAS: fasin
|
||||||
double "libm" "atan" { double } alien-invoke ;
|
double asin ( double x ) ;
|
||||||
|
|
||||||
: fatan2 ( x y -- z )
|
FUNCTION-ALIAS: fatan
|
||||||
double "libm" "atan2" { double double } alien-invoke ;
|
double atan ( double x ) ;
|
||||||
|
|
||||||
: fcos ( x -- y )
|
FUNCTION-ALIAS: fatan2
|
||||||
double "libm" "cos" { double } alien-invoke ;
|
double atan2 ( double x, double y ) ;
|
||||||
|
|
||||||
: fsin ( x -- y )
|
FUNCTION-ALIAS: fcos
|
||||||
double "libm" "sin" { double } alien-invoke ;
|
double cos ( double x ) ;
|
||||||
|
|
||||||
: ftan ( x -- y )
|
FUNCTION-ALIAS: fsin
|
||||||
double "libm" "tan" { double } alien-invoke ;
|
double sin ( double x ) ;
|
||||||
|
|
||||||
: fcosh ( x -- y )
|
FUNCTION-ALIAS: ftan
|
||||||
double "libm" "cosh" { double } alien-invoke ;
|
double tan ( double x ) ;
|
||||||
|
|
||||||
: fsinh ( x -- y )
|
FUNCTION-ALIAS: fcosh
|
||||||
double "libm" "sinh" { double } alien-invoke ;
|
double cosh ( double x ) ;
|
||||||
|
|
||||||
: ftanh ( x -- y )
|
FUNCTION-ALIAS: fsinh
|
||||||
double "libm" "tanh" { double } alien-invoke ;
|
double sinh ( double x ) ;
|
||||||
|
|
||||||
: fexp ( x -- y )
|
FUNCTION-ALIAS: ftanh
|
||||||
double "libm" "exp" { double } alien-invoke ;
|
double tanh ( double x ) ;
|
||||||
|
|
||||||
: flog ( x -- y )
|
FUNCTION-ALIAS: fexp
|
||||||
double "libm" "log" { double } alien-invoke ;
|
double exp ( double x ) ;
|
||||||
|
|
||||||
: flog10 ( x -- y )
|
FUNCTION-ALIAS: flog
|
||||||
double "libm" "log10" { double } alien-invoke ;
|
double log ( double x ) ;
|
||||||
|
|
||||||
: fpow ( x y -- z )
|
FUNCTION-ALIAS: flog10
|
||||||
double "libm" "pow" { double double } alien-invoke ;
|
double log10 ( double x ) ;
|
||||||
|
|
||||||
: fsqrt ( x -- y )
|
FUNCTION-ALIAS: fpow
|
||||||
double "libm" "sqrt" { double } alien-invoke ;
|
double pow ( double x, double y ) ;
|
||||||
|
|
||||||
|
FUNCTION-ALIAS: fsqrt
|
||||||
|
double sqrt ( double x ) ;
|
||||||
|
|
||||||
! Windows doesn't have these...
|
! Windows doesn't have these...
|
||||||
: flog1+ ( x -- y )
|
FUNCTION-ALIAS: flog1+
|
||||||
double "libm" "log1p" { double } alien-invoke ;
|
double log1p ( double x ) ;
|
||||||
|
|
||||||
: facosh ( x -- y )
|
FUNCTION-ALIAS: facosh
|
||||||
double "libm" "acosh" { double } alien-invoke ;
|
double acosh ( double x ) ;
|
||||||
|
|
||||||
: fasinh ( x -- y )
|
FUNCTION-ALIAS: fasinh
|
||||||
double "libm" "asinh" { double } alien-invoke ;
|
double asinh ( double x ) ;
|
||||||
|
|
||||||
: fatanh ( x -- y )
|
FUNCTION-ALIAS: fatanh
|
||||||
double "libm" "atanh" { double } alien-invoke ;
|
double atanh ( double x ) ;
|
||||||
|
|
Loading…
Reference in New Issue