📄 mathalib.s
字号:
/* mathALib.s - C-callable floating-point math entry points *//* Copyright 1984-1991 Wind River Systems, Inc. */ .data .globl _copyright_wind_river .long _copyright_wind_river/*modification history --------------------01c,16jun93,hdn updated to 5.1.01b,14oct92,hdn aligned all functions.01a,16sep92,hdn written by modifying Tron's mathALib.s*//*DESCRIPTIONThis library provides a C interface to the high-level math functions,provided either by an i80387 floating-point coprocessor ora software floating point emulation library. The appropriate functionis called, based on whether mathHardInit() or mathSoftInit() has beencalled.All angle-related parameters and return values are expressed in radians. Functions capable of errors will set errno upon an error. All functionsincluded in this library whos names correspond to the ANSI C specificationare, indeed, ANSI-compatable. In the spirit of ANSI, HUGE_VAL is nowsupported.SEE ALSO:fppLib (1), floatLib (1), The C Programming Language - Second EditionINCLUDE FILE: math.h*/#define _ASMLANGUAGE#include "vxWorks.h"#include "asm.h"#include "errno.h" .data .align 4 .globl _logMsg .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 _mathFacosFunc /* single-precision function pointers */ .globl _mathFasinFunc .globl _mathFatanFunc .globl _mathFatan2Func .globl _mathFcbrtFunc .globl _mathFceilFunc .globl _mathFcosFunc .globl _mathFcoshFunc .globl _mathFexpFunc .globl _mathFfabsFunc .globl _mathFfloorFunc .globl _mathFfmodFunc .globl _mathFhypotFunc .globl _mathFinfinityFunc .globl _mathFirintFunc .globl _mathFiroundFunc .globl _mathFlogFunc .globl _mathFlog2Func .globl _mathFlog10Func .globl _mathFpowFunc .globl _mathFroundFunc .globl _mathFsinFunc .globl _mathFsincosFunc .globl _mathFsinhFunc .globl _mathFsqrtFunc .globl _mathFtanFunc .globl _mathFtanhFunc .globl _mathFtruncFunc_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_mathFacosFunc: /* single-precision function pointers */ .long _mathErrNoInit_mathFasinFunc: .long _mathErrNoInit_mathFatanFunc: .long _mathErrNoInit_mathFatan2Func: .long _mathErrNoInit_mathFcbrtFunc: .long _mathErrNoInit_mathFceilFunc: .long _mathErrNoInit_mathFcosFunc: .long _mathErrNoInit_mathFcoshFunc: .long _mathErrNoInit_mathFexpFunc: .long _mathErrNoInit_mathFfabsFunc: .long _mathErrNoInit_mathFfloorFunc: .long _mathErrNoInit_mathFfmodFunc: .long _mathErrNoInit_mathFhypotFunc: .long _mathErrNoInit_mathFinfinityFunc: .long _mathErrNoInit_mathFirintFunc: .long _mathErrNoInit_mathFiroundFunc: .long _mathErrNoInit_mathFlogFunc: .long _mathErrNoInit_mathFlog2Func: .long _mathErrNoInit_mathFlog10Func: .long _mathErrNoInit_mathFpowFunc: .long _mathErrNoInit_mathFroundFunc: .long _mathErrNoInit_mathFsinFunc: .long _mathErrNoInit_mathFsincosFunc: .long _mathErrNoInit_mathFsinhFunc: .long _mathErrNoInit_mathFsqrtFunc: .long _mathErrNoInit_mathFtanFunc: .long _mathErrNoInit_mathFtanhFunc: .long _mathErrNoInit_mathFtruncFunc: .long _mathErrNoInit_mathErrNoInitString: .asciz "ERROR - floating point math not initialized!\n" .text .align 4 .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 .globl _fmod .globl _hypot .globl _infinity .globl _irint .globl _iround .globl _log .globl _log2 .globl _log10 .globl _pow .globl _round .globl _sin .globl _sincos .globl _sinh .globl _sqrt .globl _tan .globl _tanh .globl _trunc .globl _facos /* single-precision functions */ .globl _fasin .globl _fatan .globl _fatan2 .globl _fcbrt .globl _fceil .globl _fcos .globl _fcosh .globl _fexp .globl _ffabs .globl _ffloor .globl _ffmod .globl _fhypot .globl _finfinity .globl _firint .globl _firound .globl _flog .globl _flog2 .globl _flog10 .globl _fpow .globl _fround .globl _fsin .globl _fsincos .globl _fsinh .globl _fsqrt .globl _ftan .globl _ftanh .globl _ftrunc .globl _mathErrNoInit /* default routine (log error msg) *//********************************************************************************* acos - ANSI-compatable floating-point arc-cosine** RETURNS: The arc-cosine in the range -pi/2 to pi/2 radians.* double acos (dblParam)* double dblParam; /* angle in radians **/_acos: movl _mathAcosFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* asin - ANSI-compatable floating-point arc-sine** RETURNS: The arc-sine in the range 0.0 to pi radians.* * SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"* double asin (dblParam)* double dblParam; /* angle in radians **/ .align 4,0x90_asin: movl _mathAsinFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* atan - ANSI-compatable floating-point arc-tangent** RETURNS: The arc-tangent of dblParam in the range -pi/2 to pi/2.** SEE ALSO: floatLib (1), acos (2), asin (2)* double atan (dblParam)* double dblParam; /* angle in radians **/ .align 4,0x90_atan: movl _mathAtanFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* atan2 - function returns the arc tangent of (dblY/dblX) ** RETURNS:* The arc-tangent of (dblY/dblX) in the range -pi to pi.** SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"* double atan2 (dblY, dblX)* double dblY; /* Y ** double dblX; /* X **/ .align 4,0x90_atan2: movl _mathAtan2Func,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* cbrt - floating-point cube root** This routine takes a double-precision floating point parameter* and returns the double-precision cube root.** RETURNS: double-precision cube root* double cbrt (dblParam)* double dblParam; /* argument **/ .align 4,0x90_cbrt: movl _mathCbrtFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* ceil - ANSI-compatable floating-point ceiling** Performs a 'round-to-positive-infinity'** RETURNS: * The least integral value greater than or equal to dblParam,* result is returned in double precision.** SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"* double ceil (dblParam)* double dblParam; /* argument **/ .align 4,0x90_ceil: movl _mathCeilFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* cos - ANSI-compatable floating-point cosine** RETURNS: the cosine of the radian argument dblParam** SEE ALSO: * floatLib (1), sin (2), tan(2),* "The C Programming Language - Second Edition"* double cos (dblParam)* double dblParam; /* angle in radians **/ .align 4,0x90_cos: movl _mathCosFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* cosh - ANSI-compatable floating-point hyperbolic cosine** RETURNS:* The hyperbolic cosine of dblParam if (dblParam > 1.0), or* NaN if (dblParam < 1.0) ** SEE ALSO: "The C Programming Language - Second Edition"* double cosh (dblParam)* double dblParam; /* angle in radians **/ .align 4,0x90_cosh: movl _mathCoshFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* exp - exponential function** RETURNS:* Floating-point inverse natural logarithm (e ** (dblExponent)).** SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"* double exp (dblExponent)* double dblExponent; /* argument **/ .align 4,0x90_exp: movl _mathExpFunc,%eax jmp *%eax /* jump, let that routine rts *//********************************************************************************* fabs - ANSI-compatable floating-point absolute value** RETURNS: The floating-point absolute value of dblParam.** SEE ALSO: * floatLib (1), "The C Programming Language - Second Edition"* double fabs (dblParam)* double dblParam; /* argument **/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -