Math libraries for Atari

Currently, there are two free math libraries available for Atari ST, PML (Portable Math Library), and fdlibm. The following table should give a brief overview over which functions are available.

 

PMLfdlibm
Name DoubleFloatLong Double DoubleFloatLong Double Description Comments
Trigonometric functions.
acosyesnonoyesyesyesArc cosine of X.
asinyesnonoyesyesyesArc sine of X.
atanyesnonoyesyesyesArc tangent of X.
atan2yesnonoyesyesyesArc tangent of Y/X.
cosyesnonoyesyesyesCosine of X.
sinyesnonoyesyesyesSine of X.
tanyesnonoyesyesyesTangent of X.
sincosnononoyesyesyesCosine and sine of X.
Hyperbolic functions.
coshyesnonoyesyesyesHyperbolic cosine of X.
sinhyesnonoyesyesyesHyperbolic sine of X.
tanhyesnonoyesyesyesHyperbolic tangent of X.
acoshyesnonoyesyesyesHyperbolic arc cosine of X.
asinhyesnonoyesyesyesHyperbolic arc sine of X.
atanhyesnonoyesyesyesHyperbolic arc tangent of X.
Exponential and logarithmic functions.
expyesnonoyesyesyesExponential function of X.when using PML, you may get unresolved externals when using the softfloat function, because ldexp and frexp are not implemented
exp2nononoyesyesyesCompute base-2 exponential of X.
exp10yesnonoyesyesyesCompute exponent to base ten.Same as pow10()
logyesnonoyesyesyesNatural logarithm of X.
log2nononoyesyesyesCompute base-2 logarithm of X.
log10yesnonoyesyesyesBase-ten logarithm of X.
frexpnononoyesyesyesBreak VALUE into a normalized fraction and an integral power of 2.double version also implemented in mintlib
ldexpnononoyesyesyesX times (two to the EXP power).double version also implemented in mintlib
modfnononoyesyesyesBreak VALUE into integral and fractional parts.
expm1nononoyesyesyesReturn exp(X) - 1.
log1pnononoyesyesyesReturn log(1 + X).
logbnononoyesyesyesReturn the base 2 signed integral exponent of X.
Power functions.
powyesnonoyesyesyesReturn X to the Y power.
pow2nononoyesyesyesCompute base-2 exponential of X.Same as exp2()
pow10nononoyesyesyesReturn the value of 10 raised to the power xSame as exp10()
sqrtyesnonoyesyesyesReturn the square root of X.when using PML, you may get unresolved externals when using the softfloat function, because frexp is not implemented
hypotnononoyesyesyesReturn sqrt(X*X + Y*Y).
cbrtnononoyesyesyesReturn the cube root of X.
Nearest integer, absolute value, and remainder functions.
ceilyesnonoyesyesyesSmallest integral value not less than X.when using PML, you may get unresolved externals when using the softfloat function, because modf is not implemented
fabsyesyesnoyesyesyesAbsolute value of X.
flooryesnonoyesyesyesLargest integer not greater than X.when using PML, you may get unresolved externals when using the softfloat function, because modf is not implemented
fmodyesnonoyesyesyesFloating-point modulo remainder of X/Y.
finitenononoyesyesyesReturn nonzero if VALUE is finite and not NaN.double version also implemented in mintlib
dremnononoyesyesyesReturn the remainder of X/Y.Obsolete synonym for remainder
significandnononoyesyesyesReturn the fractional part of X after dividing out `ilogb (X)'.
copysignyesnonoyesyesyesReturn X with its signed changed to Y's.
nannononoyesyesyesReturn representation of qNaN for double type.Implemented using GCC builtin
Bessel functions.
j0nononoyesyesyesBessel function of the first kind of order 0
j1nononoyesyesyesBessel function of the first kind of order 1
jnnononoyesyesyesBessel function of the first kind of order n
y0nononoyesyesyesBessel function of the second kind of order 0
y1nononoyesyesyesBessel function of the second kind of order 1
ynnononoyesyesyesBessel function of the second kind of order n
Error and gamma functions.
erfnononoyesyesyeserror function
erfcnononoyesyesyescomplementary error function
lgammanononoyesyesyeslog gamma function
tgammanononoyesyesyestrue gamma function
gammanononoyesyesyes(logarithm of the) gamma function
lgamma_rnononoyesyesyesreentrant version of lgamma
ISO C99 rounding functions.
rintyesnonoyesyesyesReturn the integer nearest X in the direction of the prevailing rounding mode.when using PML, you may get unresolved externals when using the softfloat function, because modf is not implemented
nextafternononoyesyesyesReturn X + epsilon if X < Y, X - epsilon if X > Y.
nexttowardnononoyesyesyesReturn X + epsilon if X < Y, X - epsilon if X > Y.
nextdownnonononononoreturn next floating-point number toward negative infinity
nextupnonononononoreturn next floating-point number toward positive infinity
remaindernononoyesyesyesReturn the remainder of integer divison X / Y with infinite precision.
scalbnononoyesyesyesReturn X times (2 to the Nth power).
scalbnnononoyesyesyesReturn X times (2 to the Nth power).
scalblnnononoyesyesyesReturn X times (2 to the Nth power).Overkill for m68k. The int argument to scalbn() will never exceed the maximum possible range.
ilogbnononoyesyesyesReturn the binary exponent of X, which must be nonzero.
llogbnonononononoLike ilogb, but returning long int.
nearbyintnononoyesyesyesRound X to integral value in floating-point format using current rounding direction, but do not raise inexact exception.Same as rint
roundyesnonoyesyesyesRound X to nearest integral value, rounding halfway cases away from zero.
truncnononoyesyesyesRound X to the integral value in floating-point format nearest but not larger in magnitude.
remquonononoyesyesyesCompute remainder of X and Y and put in *QUO a value with sign of x/y and magnitude congruent `mod 2^n' to the magnitude of the integral quotient x/y, with n >= 3.
Conversion functions.
lrintnononoyesyesyesRound X to nearest integral value according to current rounding direction.
llrintnononoyesyesyesLike lrint, but returning long long int.
lroundnononoyesyesyesRound X to nearest integral value, rounding halfway cases away from zero.
llroundnononoyesyesyesLike lround, but returning long long int.
fdimnononoyesyesyesReturn positive difference between X and Y.
fmaxnononoyesyesyesReturn maximum numeric value from X and Y.
fminnononoyesyesyesReturn minimum numeric value from X and Y.
fmanonononononoMultiply-add function computed as a ternary operation.
roundevennonononononoRound X to nearest integer value, rounding halfway cases to even.
fromfpnonononononoRound X to nearest signed integer value, not raising inexact, with control of rounding direction and width of result.
ufromfpnonononononoRound X to nearest unsigned integer value, not raising inexact, with control of rounding direction and width of result.
fromfpxnonononononoRound X to nearest signed integer value, raising inexact for non-integers, with control of rounding direction and width of result.
ufromfpxnonononononoRound X to nearest unsigned integer value, raising inexact for non-integers, with control of rounding direction and width of result.
Classification functions.
fpclassifynononoyesyesyesReturn number of classification appropriate for X.
signbityesyesyesyesyesyesReturn nonzero value if sign of X is negative.double version also implemented in mintlib
isfiniteyesyesyesyesyesyesReturn nonzero value if X is not +-Inf or NaN.double version also implemented in mintlib
isnormalnononoyesyesyesReturn nonzero value if X is neither zero, subnormal, Inf, nor NaN.Implemented as macro
isnanyesyesyesyesyesyesReturn nonzero if VALUE is not a number.double version also implemented in mintlib
isinfyesyesyesyesyesyesReturn 0 if VALUE is finite or NaN, +1 if it is +Infinity, -1 if it is -Infinity.double version also implemented in mintlib
issignalingnononoyesyesyesReturn nonzero value if X is a signaling NaN.
issubnormalnononoyesyesyesReturn nonzero value if X is subnormal.Implemented as macro
iszerononononononoReturn nonzero value if X is zero.
iscanonicalnonononononoReturn nonzero value if X is canonical.
relational tests without exception for NaN.
isgreaternononoyesyesyesdetermines (x) > (y) without an exception if x or y is NaN. Implemented using GCC builtin
isgreaterequalnononoyesyesyesdetermines (x) >= (y) without an exception if x or y is NaN. Implemented using GCC builtin
islessnononoyesyesyesdetermines (x) < (y) without an exception if x or y is NaN. Implemented using GCC builtin
islessequalnononoyesyesyesdetermines (x) <= (y) without an exception if x or y is NaN. Implemented using GCC builtin
islessgreaternononoyesyesyesdetermines (x) < (y) || (x) > (y) without an exception if x or y is NaN. This macro is not equivalent to x != y because that expression is true if x or y is NaN.Implemented using GCC builtin
isunorderednononoyesyesyesdetermines whether its arguments are unordered, that is, whether at least one of the arguments is a NaN.Implemented using GCC builtin
iseqsignononoyesyesyesReturn X == Y but raising "invalid" and setting errno if X or Y is a NaN.Implemented using GCC builtin
Miscellaneous functions.
fmaxmagnonononononoReturn value with maximum magnitude.
fminmagnonononononoReturn value with minimum magnitude.
totalordernonononononoTotal order operation.
totalordermagnonononononoTotal order operation on absolute values.
canonicalizenonononononoCanonicalize floating-point representation.
getpayloadnonononononoGet NaN payload.
setpayloadnonononononoSet quiet NaN payload.
setpayloadsignonononononoSet signaling NaN payload.
matherryesyesSVID math library exception handlingDeprecated in favour of math_error
math_errornoyesdetecting errors from mathematical functionsPartly implemented in fdlibm. Since most of the functions are derived from glibc, see the linux manpage for notes
Exception handling.
feclearexceptnoyesClear the supported exceptions represented by EXCEPTS.
fegetexceptflagnoyesStore implementation-defined representation of the exception flags indicated by EXCEPTS in the object pointed to by FLAGP.
feraiseexceptnoyesRaise the supported exceptions represented by EXCEPTS.
fesetexceptflagnoyesSet the supported exception flags represented by EXCEPTS, without causing enabled traps to be taken.
fetestexceptnoyesDetermine which of subset of the exceptions specified by EXCEPTS are currently set.
fetestexceptflagnonoDetermine which of subset of the exceptions specified by EXCEPTS are set in *FLAGP.
feenableexceptnoyesEnable individual exceptions. Will not enable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully set, otherwise returns -1.
fedisableexceptnoyesDisable individual exceptions. Will not disable more exceptions than EXCEPTS specifies. Returns the previous enabled exceptions if all exceptions are successfully disabled, otherwise returns -1.
fegetexceptnoyesReturn enabled exceptions.
Rounding control.
fegetroundnoyesGet current rounding direction.
fesetroundnoyesEstablish the rounding direction represented by ROUND.
Floating-point environment.
fegetenvnoyesStore the current floating-point environment in the object pointed to by ENVP.
feholdexceptnoyesSave the current environment in the object pointed to by ENVP, clear exception flags and install a non-stop mode (if available) for all exceptions.
fesetenvnoyesEstablish the floating-point environment represented by the object pointed to by ENVP.
feupdateenvnoyesSave current exceptions in temporary storage, install environment represented by object pointed to by ENVP and raise exceptions according to saved exceptions.
Control modes.
fegetmodenonoStore the current floating-point control modes in the object pointed to by MODEP.
fesetmodenonoEstablish the floating-point control modes represented by the object pointed to by MODEP.
Complex Trigonometric functions.
cacosyesnononononoArc cosine of X.
casinyesnononononoArc sine of X.
catanyesnononononoArc tangent of X.
ccosyesnononononoCosine of X.
csinyesnononononoSine of X.
ctanyesnononononoTangent of X.
Complex Hyperbolic functions.
ccoshyesnononononoHyperbolic cosine of X.
csinhyesnononononoHyperbolic sine of X.
ctanhyesnononononoHyperbolic tangent of X.
cacoshnonononononoHyperbolic arc cosine of X.
casinhnonononononoHyperbolic arc sine of X.
catanhnonononononoHyperbolic arc tangent of X.
Complex Exponential and logarithmic functions.
cexpyesnononononoExponential function of X.
clogyesnononononoNatural logarithm of X.
clog10nonononononoBase-ten logarithm of X.
Complex Power functions.
cpownonononononoReturn X to the Y power.
csqrtyesnononononoReturn the square root of X.
crcpyesnononononocomplex reciprocal of zNon-standard function
Absolute value, conjugates, and projection.
cabsyesnononononoAbsolute value of Z.
cargnonononononoArgument value of Z.
conjnonononononoComplex conjugate of Z.
cprojnonononononoProjection of Z onto the Riemann sphere.
cimagnonononononoImaginary part of Z.
crealnonononononoReal part of Z.

Home