?? mathalib.s
字號:
/* mathALib.s - C interface library to high-level math functions *//* Copyright 1984-1995 Wind River Systems, Inc. */ .data .globl _copyright_wind_river .long _copyright_wind_river/*modification history--------------------01w,09may02,wsl fix warning about incomplete implementation on some arch's01v,10oct01,dgp doc: fix formatting for doc build01u,25nov95,jdi doc: removed references to 68k-specific docs.01t,03feb95,rhp warn not all functions available on all architectures01s,09dec94,rhp fix man pages for inverse trig, hyperbolic fns01r,09dec94,rhp mention include file math.h in man pages (SPR #2502)01q,26nov94,kdl added 68LC040 support.01p,02aug94,tpr added MC68060 cpu support.01o,15feb93,jdi made NOMANUAL: hypot() and hypotf().01n,12feb93,smb removed pow and fmod for the MC6804001m,05feb93,jdi changed sqrt() to sqrtf() in doc for hypotf().01l,02dec92,jdi documentation; added modhist entry 01k omitted by jcf in last checkin (mistakenly called 01j in scl). 01k,13nov92,jcf made logMsg calls indirect to reduce coupling.01j,13oct92,jdi made mathErrNoInit() nomanual.01i,26sep92,yp added title so doc run would work01h,23aug92,jcf changed bxxx to jxx.01g,30jul92,kdl changed to ANSI single precision names (e.g. fsin -> sinf)01f,26may92,rrr the tree shuffle01e,04oct91,rrr passed through the ansification filter -changed VOID to void -changed ASMLANGUAGE to _ASMLANGUAGE -changed copyright notice01d,27aug91,wmd added #include "vxWorks.h".01c,23jul91,gae changed 68k/asm.h to asm.h.01b,30jan91,kdl mangen fixes.01a,28jan91,kdl written; old "mathALib" renamed to "mathHardALib".*//*DESCRIPTIONThis library provides a C interface to high-level floating-point mathfunctions, which can use either a hardware floating-point unit or asoftware floating-point emulation library. The appropriate routine iscalled based on whether mathHardInit() or mathSoftInit() or both havebeen called to initialize the interface.All angle-related parameters are expressed in radians. All functions inthis library with names corresponding to ANSI C specifications are ANSIcompatible.WARNINGNot all functions in this library are available on all architectures. For information on available math functions, consult the VxWorks architecture supplement for your processor. INTERNALWhen generating man pages, the man pages from this library should bebuilt BEFORE those from ansiMath. Thus, the equivalent man pages in ansiMath will overwrite those from this library, which is the correctbehavior. This ordering is set up in the overall makefile system.Even though this library is 68K, the man pages are meant to serviceall architectures, within the limitation described in the above WARNING.INTERNALSee "MC68881/MC68882 Floating-Point Coprocessor User's Manual, 2nd Edition"INCLUDE FILES: math.hSEE ALSO:'ansiMath', fppLib, floatLib, mathHardLib, mathSoftLib, the various.I "Architecture Supplements,"Kernighan & Ritchie:.I "The C Programming Language, 2nd Edition"*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "errno.h" .data .even .globl _mathAcosFunc /* double-precision function pointers */ .globl _mathAsinFunc .globl _mathAtanFunc .globl _mathAtan2Func .globl _mathCbrtFunc .globl _mathCeilFunc .globl _mathCosFunc .globl _mathCoshFunc .globl _mathExpFunc .globl _mathFabsFunc .globl _mathFloorFunc .globl _mathFmodFunc .globl _mathHypotFunc .globl _mathInfinityFunc .globl _mathIrintFunc .globl _mathIroundFunc .globl _mathLogFunc .globl _mathLog2Func .globl _mathLog10Func .globl _mathPowFunc .globl _mathRoundFunc .globl _mathSinFunc .globl _mathSincosFunc .globl _mathSinhFunc .globl _mathSqrtFunc .globl _mathTanFunc .globl _mathTanhFunc .globl _mathTruncFunc .globl _mathAcosfFunc /* single-precision function pointers */ .globl _mathAsinfFunc .globl _mathAtanfFunc .globl _mathAtan2fFunc .globl _mathCbrtfFunc .globl _mathCeilfFunc .globl _mathCosfFunc .globl _mathCoshfFunc .globl _mathExpfFunc .globl _mathFabsfFunc .globl _mathFloorfFunc .globl _mathFmodfFunc .globl _mathHypotfFunc .globl _mathInfinityfFunc .globl _mathIrintfFunc .globl _mathIroundfFunc .globl _mathLogfFunc .globl _mathLog2fFunc .globl _mathLog10fFunc .globl _mathPowfFunc .globl _mathRoundfFunc .globl _mathSinfFunc .globl _mathSincosfFunc .globl _mathSinhfFunc .globl _mathSqrtfFunc .globl _mathTanfFunc .globl _mathTanhfFunc .globl _mathTruncfFunc_mathAcosFunc: /* double-precision function pointers */ .long _mathErrNoInit_mathAsinFunc: .long _mathErrNoInit_mathAtanFunc: .long _mathErrNoInit_mathAtan2Func: .long _mathErrNoInit_mathCbrtFunc: .long _mathErrNoInit_mathCeilFunc: .long _mathErrNoInit_mathCosFunc: .long _mathErrNoInit_mathCoshFunc: .long _mathErrNoInit_mathExpFunc: .long _mathErrNoInit_mathFabsFunc: .long _mathErrNoInit_mathFloorFunc: .long _mathErrNoInit_mathFmodFunc: .long _mathErrNoInit_mathHypotFunc: .long _mathErrNoInit_mathInfinityFunc: .long _mathErrNoInit_mathIrintFunc: .long _mathErrNoInit_mathIroundFunc: .long _mathErrNoInit_mathLogFunc: .long _mathErrNoInit_mathLog2Func: .long _mathErrNoInit_mathLog10Func: .long _mathErrNoInit_mathPowFunc: .long _mathErrNoInit_mathRoundFunc: .long _mathErrNoInit_mathSinFunc: .long _mathErrNoInit_mathSincosFunc: .long _mathErrNoInit_mathSinhFunc: .long _mathErrNoInit_mathSqrtFunc: .long _mathErrNoInit_mathTanFunc: .long _mathErrNoInit_mathTanhFunc: .long _mathErrNoInit_mathTruncFunc: .long _mathErrNoInit_mathAcosfFunc: /* single-precision function pointers */ .long _mathErrNoInit_mathAsinfFunc: .long _mathErrNoInit_mathAtanfFunc: .long _mathErrNoInit_mathAtan2fFunc: .long _mathErrNoInit_mathCbrtfFunc: .long _mathErrNoInit_mathCeilfFunc: .long _mathErrNoInit_mathCosfFunc: .long _mathErrNoInit_mathCoshfFunc: .long _mathErrNoInit_mathExpfFunc: .long _mathErrNoInit_mathFabsfFunc: .long _mathErrNoInit_mathFloorfFunc: .long _mathErrNoInit_mathFmodfFunc: .long _mathErrNoInit_mathHypotfFunc: .long _mathErrNoInit_mathInfinityfFunc: .long _mathErrNoInit_mathIrintfFunc: .long _mathErrNoInit_mathIroundfFunc: .long _mathErrNoInit_mathLogfFunc: .long _mathErrNoInit_mathLog2fFunc: .long _mathErrNoInit_mathLog10fFunc: .long _mathErrNoInit_mathPowfFunc: .long _mathErrNoInit_mathRoundfFunc: .long _mathErrNoInit_mathSinfFunc: .long _mathErrNoInit_mathSincosfFunc: .long _mathErrNoInit_mathSinhfFunc: .long _mathErrNoInit_mathSqrtfFunc: .long _mathErrNoInit_mathTanfFunc: .long _mathErrNoInit_mathTanhfFunc: .long _mathErrNoInit_mathTruncfFunc: .long _mathErrNoInit_mathErrNoInitString: .asciz "ERROR - floating point math not initialized!\n" .text .even .globl _acos /* double-precision functions */ .globl _asin .globl _atan .globl _atan2 .globl _cbrt .globl _ceil .globl _cos .globl _cosh .globl _exp .globl _fabs .globl _floor#if (CPU!=MC68040) && (CPU!=MC68LC040) && (CPU!=MC68060) .globl _fmod#endif /* (CPU!=MC68040) && (CPU!=MC68LC040) && (CPU!=MC68060) */ .globl _hypot .globl _infinity .globl _irint .globl _iround .globl _log .globl _log2 .globl _log10#if (CPU!=MC68040) && (CPU!=MC68LC040) && (CPU!=MC68060) .globl _pow#endif /* (CPU!=MC68040) && (CPU!=MC68LC040) && (CPU!=MC68060) */ .globl _round .globl _sin .globl _sincos .globl _sinh .globl _sqrt .globl _tan .globl _tanh .globl _trunc .globl _acosf /* single-precision functions */ .globl _asinf .globl _atanf .globl _atan2f .globl _cbrtf .globl _ceilf .globl _cosf .globl _coshf .globl _expf .globl _fabsf .globl _floorf .globl _fmodf .globl _hypotf .globl _infinityf .globl _irintf .globl _iroundf .globl _logf .globl _log2f .globl _log10f .globl _powf .globl _roundf .globl _sinf .globl _sincosf .globl _sinhf .globl _sqrtf .globl _tanf .globl _tanhf .globl _truncf .globl _mathErrNoInit /* default routine (log error msg) */ .globl __func_logMsg /* logMsg virtual function *//********************************************************************************* acos - compute an arc cosine (ANSI)** SYNOPSIS* \ss* double acos* (* double x /@ angle in radians @/* )* \se** INCLUDE FILES: math.h ** RETURNS: The double-precision arc cosine of <x> in the range 0.0* to pi radians.** SEE ALSO:* Kernighan & Ritchie,* .I "The C Programming Language, 2nd Edition"**/_acos: movel _mathAcosFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* asin - compute an arc sine (ANSI)** SYNOPSIS* \ss* double asin* (* double x /@ angle in radians @/* )* \se** INCLUDE FILES: math.h ** RETURNS: The double-precision arc sine of <x> in the range* -pi/2 to pi/2 radians.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_asin: movel _mathAsinFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* atan - compute an arc tangent (ANSI)** SYNOPSIS* \ss* double atan* (* double x /@ angle in radians @/* )* \se** INCLUDE FILES: math.h ** RETURNS: The double-precision arc tangent of <x> in the range -pi/2 to pi/2.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_atan: movel _mathAtanFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* atan2 - compute the arc tangent of y/x (ANSI)** SYNOPSIS* \ss* double atan2* (* double y, /@ numerator @/* double x /@ denominator @/* )* \se** INCLUDE FILES: math.h ** RETURNS:* The double-precision arc tangent of <y>/<x> in the range -pi to pi.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_atan2: movel _mathAtan2Func,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* cbrt - compute a cube root** SYNOPSIS* \ss* double cbrt* (* double x /@ value to compute the cube root of @/* )* \se** This routine returns the cube root of <x> in double precision.** INCLUDE FILES: math.h ** RETURNS: The double-precision cube root of <x>.*/_cbrt: movel _mathCbrtFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* ceil - compute the smallest integer greater than or equal to a specified value (ANSI)** SYNOPSIS* \ss* double ceil* (* double v /@ value to return the ceiling of @/* )* \se** Performs a round-to-positive-infinity.** INCLUDE FILES: math.h ** RETURNS:* The smallest integral value greater than or equal to <v>,* represented in double precision.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_ceil: movel _mathCeilFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* cos - compute a cosine (ANSI)** SYNOPSIS* \ss* double cos* (* double x /@ angle in radians @/* )* \se** INCLUDE FILES: math.h ** RETURNS: The double-precision cosine of <x>.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_cos: movel _mathCosFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* cosh - compute a hyperbolic cosine (ANSI)** SYNOPSIS* \ss* double cosh* (* double x /@ angle in radians @/* )* \se** INCLUDE FILES: math.h ** RETURNS:* The double-precision hyperbolic cosine of <x> if the parameter is greater* than 1.0, or NaN if the parameter is less than 1.0.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_cosh: movel _mathCoshFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* exp - compute an exponential value (ANSI)** SYNOPSIS* \ss* double exp* (* double x /@ exponent @/* )* \se** This routine returns the exponential value of <x> -- the inverse natural* logarithm (e ** <x>) -- in double precision.** INCLUDE FILES: math.h ** RETURNS:* The double-precision exponential value of <x>.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_exp: movel _mathExpFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* fabs - compute an absolute value (ANSI)** SYNOPSIS* \ss* double fabs* (* double v /@ number to return the absolute value of @/* )* \se** INCLUDE FILES: math.h ** RETURNS: The double-precision absolute value of <v>.** SEE ALSO:* Kernighan & Ritchie:* .I "The C Programming Language, 2nd Edition"*/_fabs: movel _mathFabsFunc,a0 /* get appropriate function addr */ jmp a0@ /* jump, let that routine rts *//********************************************************************************* floor - compute the largest integer less than or equal to a specified value (ANSI)** SYNOPSIS* \ss* double floor* (
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -