📄 mathalib.s
字号:
** INCLUDE FILES: math.h ** RETURNS: The smallest integral value greater than or equal to <v>,* in single precision.*/_ceilf: movel _mathCeilfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* cosf - compute a cosine (ANSI)** SYNOPSIS* \ss* float cosf* (* float x /@ angle in radians @/* )* \se** This routine returns the cosine of <x> in single precision.* The angle <x> is expressed in radians.** INCLUDE FILES: math.h ** RETURNS: The single-precision cosine of <x>.*/_cosf: movel _mathCosfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* coshf - compute a hyperbolic cosine (ANSI)** SYNOPSIS* \ss* float coshf* (* float x /@ value to compute the hyperbolic cosine of @/* )* \se** This routine returns the hyperbolic cosine of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS:* The single-precision hyperbolic cosine of <x> if the parameter is greater* than 1.0, or NaN if the parameter is less than 1.0.* * Special cases:* If <x> is +INF, -INF, or NaN, coshf() returns <x>.*/_coshf: movel _mathCoshfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* expf - compute an exponential value (ANSI)** SYNOPSIS* \ss* float expf* (* float x /@ exponent @/* )* \se** This routine returns the exponential of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS:* The single-precision exponential value of <x>.*/_expf: movel _mathExpfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* fabsf - compute an absolute value (ANSI)** SYNOPSIS* \ss* float fabsf* (* float v /@ number to return the absolute value of @/* )* \se** This routine returns the absolute value of <v> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision absolute value of <v>.*/_fabsf: movel _mathFabsfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* floorf - compute the largest integer less than or equal to a specified value (ANSI)** SYNOPSIS* \ss* float floorf* (* float v /@ value to find the floor of @/* )* \se** This routine returns the largest integer less than or equal to <v>,* in single precision.** INCLUDE FILES: math.h ** RETURNS:* The largest integral value less than or equal to <v>,* in single precision.*/_floorf: movel _mathFloorfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* fmodf - compute the remainder of x/y (ANSI)** SYNOPSIS* \ss* float fmodf* (* float x, /@ numerator @/* float y /@ denominator @/* )* \se** This routine returns the remainder of <x>/<y> with the sign of <x>,* in single precision.** INCLUDE FILES: math.h ** RETURNS:* The single-precision modulus of <x>/<y>.*/_fmodf: movel _mathFmodfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* hypotf - compute a Euclidean distance (hypotenuse)** SYNOPSIS* \ss* float hypotf* (* float x, /@ argument @/* float y /@ argument @/* )* \se** This routine returns the length of the Euclidean distance (hypotenuse)* of two single-precision parameters.** The distance is calculated as:* .CS* sqrtf ((x * x) + (y * y))* .CE** INCLUDE FILES: math.h ** RETURNS: The single-precision hypotenuse of <x> and <y>.** NOMANUAL*/_hypotf: movel _mathHypotfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* infinityf - return a very large float** SYNOPSIS* \ss* float infinityf (void)* \se** This routine returns a very large float.** INCLUDE FILES: math.h ** RETURNS: The single-precision representation of positive infinity.*/_infinityf: movel _mathInfinityfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* irintf - convert a single-precision value to an integer** SYNOPSIS* \ss* int irintf* (* float x /@ argument @/* )* \se** This routine converts a single-precision value <x> to an integer using the * selected IEEE rounding direction.** CAVEAT:* The rounding direction is not pre-selectable* and is fixed as round-to-the-nearest.** INCLUDE FILES: math.h ** RETURNS: The integer representation of <x>.*/_irintf: movel _mathIrintfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* iroundf - round a number to the nearest integer** SYNOPSIS* \ss* int iroundf* (* float x /@ argument @/* )* \se** This routine rounds a single-precision value <x> to the nearest * integer value.** NOTE:* If <x> is spaced evenly between two integers, the even integer is* returned.** INCLUDE FILES: math.h ** RETURNS: The integer nearest to <x>.*/_iroundf: movel _mathIroundfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* logf - compute a natural logarithm (ANSI)** SYNOPSIS* \ss* float logf* (* float x /@ value to compute the natural logarithm of @/* )* \se** This routine returns the logarithm of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision natural logarithm of <x>.*/_logf: movel _mathLogfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* log10f - compute a base-10 logarithm (ANSI)** SYNOPSIS* \ss* float log10f* (* float x /@ value to compute the base-10 logarithm of @/* )* \se** This routine returns the base-10 logarithm of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision base-10 logarithm of <x>.*/_log10f: movel _mathLog10fFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* log2f - compute a base-2 logarithm** SYNOPSIS* \ss* float log2f* (* float x /@ value to compute the base-2 logarithm of @/* )* \se** This routine returns the base-2 logarithm of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision base-2 logarithm of <x>.*/_log2f: movel _mathLog2fFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* powf - compute the value of a number raised to a specified power (ANSI)** SYNOPSIS* \ss* float powf* (* float x, /@ operand @/* float y /@ exponent @/* )* \se** This routine returns the value of <x> to the power of <y> in* single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision value of <x> to the power of <y>.*/_powf: /* pow (x,y) = exp (y * log(x)) */ movel _mathPowfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* roundf - round a number to the nearest integer** SYNOPSIS* \ss* float roundf* (* float x /@ argument @/* )* \se** This routine rounds a single-precision value <x> to the nearest * integral value.** INCLUDE FILES: math.h ** RETURNS: The single-precision representation of <x> rounded to the* nearest integral value.*/_roundf: movel _mathRoundfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* sinf - compute a sine (ANSI)** SYNOPSIS* \ss* float sinf* (* float x /@ angle in radians @/* )* \se** This routine returns the sine of <x> in single precision.* The angle <x> is expressed in radians.** INCLUDE FILES: math.h ** RETURNS:* The single-precision sine of <x>.*/_sinf: movel _mathSinfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* sincosf - compute both a sine and cosine** SYNOPSIS* \ss* void sincosf* (* float x, /@ angle in radians @/* float *sinResult, /@ sine result buffer @/* float *cosResult /@ cosine result buffer @/* )* \se** This routine computes both the sine and cosine of <x> in single precision.* The sine is copied to <sinResult> and the cosine is copied to <cosResult>.* The angle <x> is expressed in radians.** INCLUDE FILES: math.h ** RETURNS: N/A*/_sincosf: movel _mathSincosfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* sinhf - compute a hyperbolic sine (ANSI)** SYNOPSIS* \ss* float sinhf* (* float x /@ number whose hyperbolic sine is required @/* )* \se** This routine returns the hyperbolic sine of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision hyperbolic sine of <x>.*/_sinhf: movel _mathSinhfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* sqrtf - compute a non-negative square root (ANSI)** SYNOPSIS* \ss* float sqrtf* (* float x /@ value to compute the square root of @/* )* \se** This routine returns the non-negative square root of <x> in single* precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision square root of <x>.*/_sqrtf: movel _mathSqrtfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* tanf - compute a tangent (ANSI)** SYNOPSIS* \ss* float tanf* (* float x /@ angle in radians @/* )* \se** This routine returns the tangent of <x> in single precision.* The angle <x> is expressed in radians.** INCLUDE FILES: math.h ** RETURNS: The single-precision tangent of <x>.*/_tanf: movel _mathTanfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* tanhf - compute a hyperbolic tangent (ANSI)** SYNOPSIS* \ss* float tanhf* (* float x /@ number whose hyperbolic tangent is required @/* )* \se** This routine returns the hyperbolic tangent of <x> in single precision.** INCLUDE FILES: math.h ** RETURNS: The single-precision hyperbolic tangent of <x>.*/_tanhf: movel _mathTanhfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* truncf - truncate to integer** SYNOPSIS* \ss* float truncf* (* float x /@ value to truncate @/* )* \se** This routine discards the fractional part of a single-precision value <x>.** INCLUDE FILES: math.h ** RETURNS:* The integer portion of <x>, represented in single precision.*/_truncf: movel _mathTruncfFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* mathErrNoInit - default routine for uninitialized floating-point functions** SYNOPSIS* \ss* void mathErrNoInit ()* \se** This routine is called if floating point math operations are attempted* before either a mathSoftInit() or mathHardInit() call is performed. The* address of this routine is the initial value of the various mathXXXFunc* pointers, which are re-initialized with actual function addresses during* either of the floating point initialization calls.** SEE ALSO: mathHardInit(), mathSoftInit()** NOMANUAL*/_mathErrNoInit: tstl __func_logMsg beqs _mathErrDone clrl sp@- clrl sp@- clrl sp@- clrl sp@- clrl sp@- clrl sp@- movel #_mathErrNoInitString,sp@- movel __func_logMsg,a0 jsr a0@ /* log the message if logger avail */ addl #0x1c,sp /* cleanup stack */_mathErrDone: rts
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -