⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mathalib.s

📁 Vxworks OS source code
💻 S
📖 第 1 页 / 共 3 页
字号:
/* mathALib.s - C-callable floating-point math entry points *//* Copyright 1984-2001 Wind River Systems, Inc. *//*modification history --------------------01d,05sep01,hdn  added FUNC/FUNC_LABEL GTEXT/GDATA macros		 replaced .align with .balign		 removed cosh, sinh, tanh for one in libc/math01c,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	.globl	FUNC(copyright_wind_river)	.long	FUNC(copyright_wind_river)		/* externals */	.globl FUNC(logMsg)	/* internals */        .globl  GTEXT(acos)		/* double-precision functions */        .globl  GTEXT(asin)        .globl  GTEXT(atan)	.globl  GTEXT(atan2)	.globl  GTEXT(cbrt)	.globl  GTEXT(ceil)        .globl  GTEXT(cos)        .globl  GTEXT(exp)        .globl  GTEXT(fabs)	.globl  GTEXT(floor)	.globl  GTEXT(fmod)	.globl	GTEXT(hypot)	.globl  GTEXT(infinity)	.globl  GTEXT(irint)	.globl  GTEXT(iround)        .globl  GTEXT(log)        .globl  GTEXT(log2)        .globl  GTEXT(log10)        .globl  GTEXT(pow)	.globl  GTEXT(round)        .globl  GTEXT(sin)	.globl  GTEXT(sincos)        .globl  GTEXT(sqrt)        .globl  GTEXT(tan)	.globl  GTEXT(trunc)        .globl  GTEXT(facos)		/* single-precision functions */        .globl  GTEXT(fasin)        .globl  GTEXT(fatan)	.globl  GTEXT(fatan2)	.globl  GTEXT(fcbrt)	.globl  GTEXT(fceil)        .globl  GTEXT(fcos)        .globl  GTEXT(fcosh)        .globl  GTEXT(fexp)        .globl  GTEXT(ffabs)	.globl  GTEXT(ffloor)	.globl  GTEXT(ffmod)	.globl	GTEXT(fhypot)	.globl  GTEXT(finfinity)	.globl  GTEXT(firint)	.globl  GTEXT(firound)        .globl  GTEXT(flog)        .globl  GTEXT(flog2)        .globl  GTEXT(flog10)        .globl  GTEXT(fpow)	.globl  GTEXT(fround)        .globl  GTEXT(fsin)	.globl  GTEXT(fsincos)        .globl  GTEXT(fsinh)        .globl  GTEXT(fsqrt)        .globl  GTEXT(ftan)        .globl  GTEXT(ftanh)	.globl  GTEXT(ftrunc)	.globl	GTEXT(mathErrNoInit)	/* default routine (log error msg) */	.globl  GDATA(mathAcosFunc)	/* double-precision function pointers */	.globl  GDATA(mathAsinFunc)	.globl  GDATA(mathAtanFunc)	.globl  GDATA(mathAtan2Func)	.globl  GDATA(mathCbrtFunc)	.globl  GDATA(mathCeilFunc)	.globl  GDATA(mathCosFunc)	.globl  GDATA(mathCoshFunc)	.globl  GDATA(mathExpFunc)	.globl  GDATA(mathFabsFunc)	.globl  GDATA(mathFloorFunc)	.globl  GDATA(mathFmodFunc)	.globl  GDATA(mathHypotFunc)	.globl  GDATA(mathInfinityFunc)	.globl  GDATA(mathIrintFunc)	.globl  GDATA(mathIroundFunc)	.globl  GDATA(mathLogFunc)	.globl  GDATA(mathLog2Func)	.globl  GDATA(mathLog10Func)	.globl  GDATA(mathPowFunc)	.globl  GDATA(mathRoundFunc)	.globl  GDATA(mathSinFunc)	.globl  GDATA(mathSincosFunc)	.globl  GDATA(mathSinhFunc)	.globl  GDATA(mathSqrtFunc)	.globl  GDATA(mathTanFunc)	.globl  GDATA(mathTanhFunc)	.globl  GDATA(mathTruncFunc)	.globl  GDATA(mathFacosFunc)	/* single-precision function pointers */	.globl  GDATA(mathFasinFunc)	.globl  GDATA(mathFatanFunc)	.globl  GDATA(mathFatan2Func)	.globl  GDATA(mathFcbrtFunc)	.globl  GDATA(mathFceilFunc)	.globl  GDATA(mathFcosFunc)	.globl  GDATA(mathFcoshFunc)	.globl  GDATA(mathFexpFunc)	.globl  GDATA(mathFfabsFunc)	.globl  GDATA(mathFfloorFunc)	.globl  GDATA(mathFfmodFunc)	.globl  GDATA(mathFhypotFunc)	.globl  GDATA(mathFinfinityFunc)	.globl  GDATA(mathFirintFunc)	.globl  GDATA(mathFiroundFunc)	.globl  GDATA(mathFlogFunc)	.globl  GDATA(mathFlog2Func)	.globl  GDATA(mathFlog10Func)	.globl  GDATA(mathFpowFunc)	.globl  GDATA(mathFroundFunc)	.globl  GDATA(mathFsinFunc)	.globl  GDATA(mathFsincosFunc)	.globl  GDATA(mathFsinhFunc)	.globl  GDATA(mathFsqrtFunc)	.globl  GDATA(mathFtanFunc)	.globl  GDATA(mathFtanhFunc)	.globl  GDATA(mathFtruncFunc)	.data	.balign 16FUNC_LABEL(mathAcosFunc)		/* double-precision function pointers */	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathAsinFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathAtanFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathAtan2Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathCbrtFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathCeilFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathCosFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathCoshFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathExpFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFabsFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFloorFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFmodFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathHypotFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathInfinityFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathIrintFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathIroundFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathLogFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathLog2Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathLog10Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathPowFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathRoundFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathSinFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathSincosFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathSinhFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathSqrtFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathTanFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathTanhFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathTruncFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFacosFunc)		/* single-precision function pointers */	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFasinFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFatanFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFatan2Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFcbrtFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFceilFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFcosFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFcoshFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFexpFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFfabsFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFfloorFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFfmodFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFhypotFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFinfinityFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFirintFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFiroundFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFlogFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFlog2Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFlog10Func)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFpowFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFroundFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFsinFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFsincosFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFsinhFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFsqrtFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFtanFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFtanhFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathFtruncFunc)	.long	FUNC(mathErrNoInit)FUNC_LABEL(mathErrNoInitString)	.asciz	"ERROR - floating point math not initialized!\n"        .text	.balign 16/********************************************************************************* 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 **/FUNC_LABEL(acos)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(asin)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(atan)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(atan2)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(cbrt)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(ceil)	movl	FUNC(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 **/	.balign 16,0x90FUNC_LABEL(cos)	movl	FUNC(mathCosFunc),%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 **/	.balign 16,0x90FUNC_LABEL(exp)	movl	FUNC(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: 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -