diff --git a/basis/math/libm/libm-docs.factor b/basis/math/libm/libm-docs.factor index 9de6e7d127..7dc6313b86 100644 --- a/basis/math/libm/libm-docs.factor +++ b/basis/math/libm/libm-docs.factor @@ -36,53 +36,53 @@ ARTICLE: "math.libm" "C standard library math functions" ABOUT: "math.libm" 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; 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." } ; diff --git a/basis/math/libm/libm.factor b/basis/math/libm/libm.factor index 0288894081..c87a2819ca 100644 --- a/basis/math/libm/libm.factor +++ b/basis/math/libm/libm.factor @@ -1,62 +1,64 @@ ! Copyright (C) 2006 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.c-types ; +USING: alien alien.c-types alien.syntax ; IN: math.libm -: facos ( x -- y ) - double "libm" "acos" { double } alien-invoke ; +LIBRARY: libm -: fasin ( x -- y ) - double "libm" "asin" { double } alien-invoke ; +FUNCTION-ALIAS: facos + double acos ( double x ) ; -: fatan ( x -- y ) - double "libm" "atan" { double } alien-invoke ; +FUNCTION-ALIAS: fasin + double asin ( double x ) ; -: fatan2 ( x y -- z ) - double "libm" "atan2" { double double } alien-invoke ; +FUNCTION-ALIAS: fatan + double atan ( double x ) ; -: fcos ( x -- y ) - double "libm" "cos" { double } alien-invoke ; +FUNCTION-ALIAS: fatan2 + double atan2 ( double x, double y ) ; -: fsin ( x -- y ) - double "libm" "sin" { double } alien-invoke ; +FUNCTION-ALIAS: fcos + double cos ( double x ) ; -: ftan ( x -- y ) - double "libm" "tan" { double } alien-invoke ; +FUNCTION-ALIAS: fsin + double sin ( double x ) ; -: fcosh ( x -- y ) - double "libm" "cosh" { double } alien-invoke ; +FUNCTION-ALIAS: ftan + double tan ( double x ) ; -: fsinh ( x -- y ) - double "libm" "sinh" { double } alien-invoke ; +FUNCTION-ALIAS: fcosh + double cosh ( double x ) ; -: ftanh ( x -- y ) - double "libm" "tanh" { double } alien-invoke ; +FUNCTION-ALIAS: fsinh + double sinh ( double x ) ; -: fexp ( x -- y ) - double "libm" "exp" { double } alien-invoke ; +FUNCTION-ALIAS: ftanh + double tanh ( double x ) ; -: flog ( x -- y ) - double "libm" "log" { double } alien-invoke ; +FUNCTION-ALIAS: fexp + double exp ( double x ) ; -: flog10 ( x -- y ) - double "libm" "log10" { double } alien-invoke ; +FUNCTION-ALIAS: flog + double log ( double x ) ; -: fpow ( x y -- z ) - double "libm" "pow" { double double } alien-invoke ; +FUNCTION-ALIAS: flog10 + double log10 ( double x ) ; -: fsqrt ( x -- y ) - double "libm" "sqrt" { double } alien-invoke ; +FUNCTION-ALIAS: fpow + double pow ( double x, double y ) ; + +FUNCTION-ALIAS: fsqrt + double sqrt ( double x ) ; ! Windows doesn't have these... -: flog1+ ( x -- y ) - double "libm" "log1p" { double } alien-invoke ; +FUNCTION-ALIAS: flog1+ + double log1p ( double x ) ; -: facosh ( x -- y ) - double "libm" "acosh" { double } alien-invoke ; +FUNCTION-ALIAS: facosh + double acosh ( double x ) ; -: fasinh ( x -- y ) - double "libm" "asinh" { double } alien-invoke ; +FUNCTION-ALIAS: fasinh + double asinh ( double x ) ; -: fatanh ( x -- y ) - double "libm" "atanh" { double } alien-invoke ; +FUNCTION-ALIAS: fatanh + double atanh ( double x ) ;