diff --git a/extra/math/functions/functions-tests.factor b/extra/math/functions/functions-tests.factor index 6176c12d21..232fdb25b3 100755 --- a/extra/math/functions/functions-tests.factor +++ b/extra/math/functions/functions-tests.factor @@ -44,7 +44,10 @@ IN: math.functions.tests [ t ] [ 10 asin sin 10 1.e-10 ~ ] unit-test [ t ] [ -1 sqrt neg dup acos cos 1.e-10 ~ ] unit-test +[ t ] [ -100 atan tan -100 1.e-10 ~ ] unit-test [ t ] [ 10 asinh sinh 10 1.e-10 ~ ] unit-test +[ t ] [ 10 atanh tanh 10 1.e-10 ~ ] unit-test +[ t ] [ 0.5 atanh tanh 0.5 1.e-10 ~ ] unit-test [ 100 ] [ 100 100 gcd nip ] unit-test [ 100 ] [ 1000 100 gcd nip ] unit-test diff --git a/extra/math/functions/functions.factor b/extra/math/functions/functions.factor index bb43e4a721..4dcb215138 100755 --- a/extra/math/functions/functions.factor +++ b/extra/math/functions/functions.factor @@ -182,17 +182,17 @@ M: number (^) : coth ( x -- y ) tanh recip ; inline : acosh ( x -- y ) - dup >=1? [ facosh ] [ dup sq 1- sqrt + log ] if ; inline + dup sq 1- sqrt + log ; inline : asech ( x -- y ) recip acosh ; inline : asinh ( x -- y ) - dup complex? [ dup sq 1+ sqrt + log ] [ fasinh ] if ; inline + dup sq 1+ sqrt + log ; inline : acosech ( x -- y ) recip asinh ; inline : atanh ( x -- y ) - dup [-1,1]? [ fatanh ] [ dup 1+ swap 1- neg / log 2 / ] if ; inline + dup 1+ swap 1- neg / log 2 / ; inline : acoth ( x -- y ) recip atanh ; inline diff --git a/extra/math/libm/libm.factor b/extra/math/libm/libm.factor old mode 100644 new mode 100755 index f70c8d2a77..8bda6a6dd0 --- a/extra/math/libm/libm.factor +++ b/extra/math/libm/libm.factor @@ -15,18 +15,6 @@ IN: math.libm "double" "libm" "atan" { "double" } alien-invoke ; foldable -: facosh ( x -- y ) - "double" "libm" "acosh" { "double" } alien-invoke ; - foldable - -: fasinh ( x -- y ) - "double" "libm" "asinh" { "double" } alien-invoke ; - foldable - -: fatanh ( x -- y ) - "double" "libm" "atanh" { "double" } alien-invoke ; - foldable - : fatan2 ( x y -- z ) "double" "libm" "atan2" { "double" "double" } alien-invoke ; foldable @@ -70,3 +58,16 @@ IN: math.libm : fsqrt ( x -- y ) "double" "libm" "sqrt" { "double" } alien-invoke ; foldable + +! Windows doesn't have these... +: facosh ( x -- y ) + "double" "libm" "acosh" { "double" } alien-invoke ; + foldable + +: fasinh ( x -- y ) + "double" "libm" "asinh" { "double" } alien-invoke ; + foldable + +: fatanh ( x -- y ) + "double" "libm" "atanh" { "double" } alien-invoke ; + foldable