From: Michael H. <gi...@gi...> - 2013-11-04 22:26:12
|
xeno_math: remove unused and inappropriately licensed files http://git.linuxcnc.org/?p=linuxcnc.git;a=commitdiff;h=63cc4bf --- src/rtapi/xeno_math/ceilfloor.c | 179 ----------------------------- src/rtapi/xeno_math/fpP.h | 112 ------------------ src/rtapi/xeno_math/fpmacros.c | 239 --------------------------------------- src/rtapi/xeno_math/frexpldexp.c | 73 ------------ src/rtapi/xeno_math/logb.c | 104 ----------------- src/rtapi/xeno_math/scalb.c | 87 -------------- src/rtapi/xeno_math/sign.c | 58 ---------- 7 files changed, 852 deletions(-) diff --git a/src/rtapi/xeno_math/ceilfloor.c b/src/rtapi/xeno_math/ceilfloor.c deleted file mode 100644 index 9607435..0000000 --- a/src/rtapi/xeno_math/ceilfloor.c +++ /dev/null @@ -1,179 +0,0 @@ -#if defined(__ppc__) -/******************************************************************************* -* * -* File ceilfloor.c, * -* Function ceil(x) and floor(x), * -* Implementation of ceil and floor for the PowerPC. * -* * -* Copyright © 1991 Apple Computer, Inc. All rights reserved. * -* * -* Written by Ali Sazegari, started on November 1991, * -* * -* based on math.h, library code for Macintoshes with a 68881/68882 * -* by Jim Thomas. * -* * -* W A R N I N G: This routine expects a 64 bit double model. * -* * -* December 03 1992: first rs6000 port. * -* July 14 1993: comment changes and addition of #pragma fenv_access. * -* May 06 1997: port of the ibm/taligent ceil and floor routines. * -* April 11 2001: first port to os x using gcc. * -* June 13 2001: replaced __setflm with in-line assembly * -* * -*******************************************************************************/ - -#if !defined(__ppc__) -#define asm(x) -#endif - -static const double twoTo52 = 4503599627370496.0; -static const unsigned long signMask = 0x80000000ul; - -typedef union - { - struct { -#if defined(__BIG_ENDIAN__) - unsigned long int hi; - unsigned long int lo; -#else - unsigned long int lo; - unsigned long int hi; -#endif - } words; - double dbl; - } DblInHex; - -/******************************************************************************* -* Functions needed for the computation. * -*******************************************************************************/ - -/******************************************************************************* -* Ceil(x) returns the smallest integer not less than x. * -*******************************************************************************/ - -double ceil ( double x ) - { - DblInHex xInHex,OldEnvironment; - register double y; - register unsigned long int xhi; - register int target; - - xInHex.dbl = x; - xhi = xInHex.words.hi & 0x7fffffffUL; // xhi is the high half of |x| - target = ( xInHex.words.hi < signMask ); - - if ( xhi < 0x43300000ul ) -/******************************************************************************* -* Is |x| < 2.0^52? * -*******************************************************************************/ - { - if ( xhi < 0x3ff00000ul ) -/******************************************************************************* -* Is |x| < 1.0? * -*******************************************************************************/ - { - if ( ( xhi | xInHex.words.lo ) == 0ul ) // zero x is exact case - return ( x ); - else - { // inexact case - asm ("mffs %0" : "=f" (OldEnvironment.dbl)); - OldEnvironment.words.lo |= 0x02000000ul; - asm ("mtfsf 255,%0" : /*NULLOUT*/ : /*IN*/ "f" ( OldEnvironment.dbl )); - if ( target ) - return ( 1.0 ); - else - return ( -0.0 ); - } - } -/******************************************************************************* -* Is 1.0 < |x| < 2.0^52? * -*******************************************************************************/ - if ( target ) - { - y = ( x + twoTo52 ) - twoTo52; // round at binary pt. - if ( y < x ) - return ( y + 1.0 ); - else - return ( y ); - } - - else - { - y = ( x - twoTo52 ) + twoTo52; // round at binary pt. - if ( y < x ) - return ( y + 1.0 ); - else - return ( y ); - } - } -/******************************************************************************* -* |x| >= 2.0^52 or x is a NaN. * -*******************************************************************************/ - return ( x ); - } - -/******************************************************************************* -* Floor(x) returns the largest integer not greater than x. * -*******************************************************************************/ - -double floor ( double x ) - { - DblInHex xInHex,OldEnvironment; - register double y; - register unsigned long int xhi; - register long int target; - - xInHex.dbl = x; - xhi = xInHex.words.hi & 0x7fffffffUL; // xhi is the high half of |x| - target = ( xInHex.words.hi < signMask ); - - if ( xhi < 0x43300000ul ) -/******************************************************************************* -* Is |x| < 2.0^52? * -*******************************************************************************/ - { - if ( xhi < 0x3ff00000ul ) -/******************************************************************************* -* Is |x| < 1.0? * -*******************************************************************************/ - { - if ( ( xhi | xInHex.words.lo ) == 0ul ) // zero x is exact case - return ( x ); - else - { // inexact case - asm ("mffs %0" : "=f" (OldEnvironment.dbl)); - OldEnvironment.words.lo |= 0x02000000ul; - asm ("mtfsf 255,%0" : /*NULLOUT*/ : /*IN*/ "f" ( OldEnvironment.dbl )); - if ( target ) - return ( 0.0 ); - else - return ( -1.0 ); - } - } -/******************************************************************************* -* Is 1.0 < |x| < 2.0^52? * -*******************************************************************************/ - if ( target ) - { - y = ( x + twoTo52 ) - twoTo52; // round at binary pt. - if ( y > x ) - return ( y - 1.0 ); - else - return ( y ); - } - - else - { - y = ( x - twoTo52 ) + twoTo52; // round at binary pt. - if ( y > x ) - return ( y - 1.0 ); - else - return ( y ); - } - } -/******************************************************************************* -* |x| >= 2.0^52 or x is a NaN. * -*******************************************************************************/ - return ( x ); - } -#endif /* __ppc__ */ diff --git a/src/rtapi/xeno_math/fpP.h b/src/rtapi/xeno_math/fpP.h deleted file mode 100644 index dc36571..0000000 --- a/src/rtapi/xeno_math/fpP.h +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* -* * -* File fpP.h, * -* All pack 4 dependencies for the MathLib elems plus some defines used * -* throughout MathLib. * -* * -* Copyright © 1991 Apple Computer, Inc. All rights reserved. * -* * -* Written by Ali Sazegari, started on October 1991, * -* * -* W A R N I N G: This routine expects a 64 bit double model. * -* * -*******************************************************************************/ - -#define NoException 0 - -/******************************************************************************* -* Values of constants. * -*******************************************************************************/ - -//#define SgnMask 0x8000 -#define dSgnMask 0x80000000 -#define sSgnMask 0x7FFFFFFF - -//#define ExpMask 0x7FFF -#define dExpMask 0x7FF00000 -#define sExpMask 0xFF000000 - - /* according to rounding BIG & SMALL are: */ -#define BIG 1.1e+300 /* used to deliver ±° or largest number, */ -#define SMALL 1.1e-300 /* used to deliver ±0 or smallest number. */ -#define InfExp 0x7FF -#define dMaxExp 0x7FF00000 - -#define MaxExpP1 1024 -#define MaxExp 1023 - -#define DenormLimit -52 - -//#define ManMask 0x80000000 -#define dManMask 0x00080000 - -//#define IsItDenorm 0x80000000 -#define dIsItDenorm 0x00080000 - -//#define xIsItSNaN 0x40000000 -#define dIsItSNaN 0x00080000 - -#define dHighMan 0x000FFFFF -#define dFirstBitSet 0x00080000 -#define BIAS 0x3FF - -//#define GetSign 0x8000 -#define dGetSign 0x80000000 -#define sGetSign 0x80000000 - -//#define Infinity(x) ( x.hex.exponent & ExpMask ) == ExpMask -#define dInfinity(x) ( x.hex.high & dExpMask ) == dExpMask -#define sInfinity(x) ( ( x.hexsgl << 1 ) & sExpMask ) == sExpMask - -//#define Exponent(x) x.hex.exponent & ExpMask -#define dExponent(x) x.hex.high & dExpMask -#define sExponent(x) ( ( x.hexsgl << 1 ) & sExpMask ) - -#define sZero(x) ( x.hexsgl & sSgnMask ) == 0 -//#define Sign(x) ( x.hex.exponent & SgnMask ) == SgnMask - -/******************************************************************************* -* Types used in the auxiliary functions. * -*******************************************************************************/ - -typedef struct /* Hex representation of a double. */ - { -#if defined(__BIG_ENDIAN__) - unsigned long int high; - unsigned long int low; -#else - unsigned long int low; - unsigned long int high; -#endif - } dHexParts; - -typedef union - { - unsigned char byties[8]; - double dbl; - } DblInHex; - -//enum boolean { FALSE, TRUE }; - -/******************************************************************************* -* Macros to access long subfields of a double value. * -*******************************************************************************/ - -#define highpartd(x) *((long *) &x) -#define lowpartd(x) *((long *) &x + 1) - -enum { - FP_SNAN = 0, /* signaling NaN - */ - FP_QNAN = 1, /* quiet NaN - */ - FP_INFINITE = 2, /* + or - infinity - */ - FP_ZERO = 3, /* + or - zero - */ - FP_NORMAL = 4, /* all normal numbers - */ - FP_SUBNORMAL = 5 /* denormal numbers - */ -}; - diff --git a/src/rtapi/xeno_math/fpmacros.c b/src/rtapi/xeno_math/fpmacros.c deleted file mode 100644 index 865e74c..0000000 --- a/src/rtapi/xeno_math/fpmacros.c +++ /dev/null @@ -1,239 +0,0 @@ -/*********************************************************************** -** File: fpmacros.c -** -** Contains: C source code for implementations of floating-point -** functions which involve float format numbers, as -** defined in header <fp.h>. In particular, this file -** contains implementations of functions -** __fpclassify(d,f), __isnormal(d,f), __isfinite(d,f), -** __isnan(d,f), and __signbit(d,f). This file targets -** PowerPC platforms. -** -** Written by: Robert A. Murley, Ali Sazegari -** -** Copyright: c 2001 by Apple Computer, Inc., all rights reserved -** -** Change History (most recent first): -** -** 07 Jul 01 ram First created from fpfloatfunc.c, fp.c, -** classify.c and sign.c in MathLib v3 Mac OS9. -** -***********************************************************************/ - -#include "fpP.h" - -#define SIGN_MASK 0x80000000 -#define NSIGN_MASK 0x7fffffff -#define FEXP_MASK 0x7f800000 -#define FFRAC_MASK 0x007fffff - -/*********************************************************************** - long int __fpclassifyf(float x) returns the classification code of the - argument x, as defined in <fp.h>. - - Exceptions: INVALID signaled if x is a signaling NaN; in this case, - the FP_QNAN code is returned. - - Calls: none -***********************************************************************/ - -long int __fpclassifyf ( float x ) -{ - unsigned long int iexp; - - union { - unsigned long int lval; - float fval; - } z; - - z.fval = x; - iexp = z.lval & FEXP_MASK; /* isolate float exponent */ - - if (iexp == FEXP_MASK) { /* NaN or INF case */ - if ((z.lval & 0x007fffff) == 0) - return (long int) FP_INFINITE; - else if ((z.lval & 0x00400000) != 0) - return (long int) FP_QNAN; - else - return (long int) FP_SNAN; - } - - if (iexp != 0) /* normal float */ - return (long int) FP_NORMAL; - - if (x == 0.0) - return (long int) FP_ZERO; /* zero */ - else - return (long int) FP_SUBNORMAL; /* must be subnormal */ -} - - -/*********************************************************************** - Function __fpclassify, - Implementation of classify of a double number for the PowerPC. - - Exceptions: INVALID signaled if x is a signaling NaN; in this case, - the FP_QNAN code is returned. - - Calls: none -***********************************************************************/ - -long int __fpclassify ( double arg ) -{ - register unsigned long int exponent; - union - { - dHexParts hex; - double dbl; - } x; - - x.dbl = arg; - - exponent = x.hex.high & dExpMask; - if ( exponent == dExpMask ) - { - if ( ( ( x.hex.high & dHighMan ) | x.hex.low ) == 0 ) - return (long int) FP_INFINITE; - else - return ( x.hex.high & 0x00080000 ) ? FP_QNAN : FP_SNAN; - } - else if ( exponent != 0) - return (long int) FP_NORMAL; - else { - if ( arg == 0.0 ) - return (long int) FP_ZERO; - else - return (long int) FP_SUBNORMAL; - } -} - - -/*********************************************************************** - long int __isnormalf(float x) returns nonzero if and only if x is a - normalized float number and zero otherwise. - - Exceptions: INVALID is raised if x is a signaling NaN; in this case, - zero is returned. - - Calls: none -***********************************************************************/ - -long int __isnormalf ( float x ) -{ - unsigned long int iexp; - union { - unsigned long int lval; - float fval; - } z; - - z.fval = x; - iexp = z.lval & FEXP_MASK; /* isolate float exponent */ - return ((iexp != FEXP_MASK) && (iexp != 0)); -} - - -long int __isnorma ( double x ) -{ - return ( __fpclassify ( x ) == FP_NORMAL ); -} - - -/*********************************************************************** - long int __isfinitef(float x) returns nonzero if and only if x is a - finite (normal, subnormal, or zero) float number and zero otherwise. - - Exceptions: INVALID is raised if x is a signaling NaN; in this case, - zero is returned. - - Calls: none -***********************************************************************/ - -long int __isfinitef ( float x ) -{ - union { - unsigned long int lval; - float fval; - } z; - - z.fval = x; - return ((z.lval & FEXP_MASK) != FEXP_MASK); -} - -long int __isfinite ( double x ) -{ - return ( __fpclassify ( x ) >= FP_ZERO ); -} - - - -/*********************************************************************** - long int __isnanf(float x) returns nonzero if and only if x is a - NaN and zero otherwise. - - Exceptions: INVALID is raised if x is a signaling NaN; in this case, - nonzero is returned. - - Calls: none -***********************************************************************/ - -long int __isnanf ( float x ) -{ - union { - unsigned long int lval; - float fval; - } z; - - z.fval = x; - return (((z.lval&FEXP_MASK) == FEXP_MASK) && ((z.lval&FFRAC_MASK) != 0)); -} - -long int __isnan ( double x ) -{ - long int class = __fpclassify(x); - return ( ( class == FP_SNAN ) || ( class == FP_QNAN ) ); -} - - -/*********************************************************************** - long int __signbitf(float x) returns nonzero if and only if the sign - bit of x is set and zero otherwise. - - Exceptions: INVALID is raised if x is a signaling NaN. - - Calls: none -***********************************************************************/ - -long int __signbitf ( float x ) -{ - union { - unsigned long int lval; - float fval; - } z; - - z.fval = x; - return ((z.lval & SIGN_MASK) != 0); -} - - -/*********************************************************************** - Function sign of a double. - Implementation of sign bit for the PowerPC. - - Calls: none -***********************************************************************/ - -long int __signbit ( double arg ) -{ - union - { - dHexParts hex; - double dbl; - } x; - long int sign; - - x.dbl = arg; - sign = ( ( x.hex.high & dSgnMask ) == dSgnMask ) ? 1 : 0; - return sign; -} - - diff --git a/src/rtapi/xeno_math/frexpldexp.c b/src/rtapi/xeno_math/frexpldexp.c deleted file mode 100644 index dbb6fcc..0000000 --- a/src/rtapi/xeno_math/frexpldexp.c +++ /dev/null @@ -1,73 +0,0 @@ -#if defined(__ppc__) -/******************************************************************************* -* * -* File frexpldexp.c, * -* Functions frexp(x) and ldexp(x), * -* Implementation of frexp and ldexp functions for the PowerPC. * -* * -* Copyright © 1991 Apple Computer, Inc. All rights reserved. * -* * -* Written by Ali Sazegari, started on January 1991, * -* * -* W A R N I N G: This routine expects a 64 bit double model. * -* * -* December03 1992: first rs6000 implementation. * -* October 05 1993: added special cases for NaN and ° in frexp. * -* May 27 1997: improved the performance of frexp by eliminating the * -* switch statement. * -* June 13 2001: (ram) rewrote frexp to eliminate calls to scalb and * -* logb. * -* * -*******************************************************************************/ - -#include <limits.h> -#include <math.h> - -static const double two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */ - -typedef union - { - struct { -#if defined(__BIG_ENDIAN__) - unsigned long int hi; - unsigned long int lo; -#else - unsigned long int lo; - unsigned long int hi; -#endif - } words; - double dbl; - } DblInHex; - -double ldexp ( double value, int exp ) - { - if ( exp > SHRT_MAX ) - exp = SHRT_MAX; - else if ( exp < -SHRT_MAX ) - exp = -SHRT_MAX; - return scalb ( value, exp ); - } - -double frexp ( double value, int *eptr ) - { - DblInHex argument; - unsigned long int valueHead; - - argument.dbl = value; - valueHead = argument.words.hi & 0x7fffffffUL; // valueHead <- |x| - - *eptr = 0; - if ( valueHead >= 0x7ff00000 || ( valueHead | argument.words.lo ) == 0 ) - return value; // 0, inf, or NaN - - if ( valueHead < 0x00100000 ) - { // denorm - argument.dbl = two54 * value; - valueHead = argument.words.hi &0x7fffffff; - *eptr = -54; - } - *eptr += ( valueHead >> 20 ) - 1022; - argument.words.hi = ( argument.words.hi & 0x800fffff ) | 0x3fe00000; - return argument.dbl; - } -#endif /* __ppc__ */ diff --git a/src/rtapi/xeno_math/logb.c b/src/rtapi/xeno_math/logb.c deleted file mode 100644 index da2a27d..0000000 --- a/src/rtapi/xeno_math/logb.c +++ /dev/null @@ -1,104 +0,0 @@ -#if defined(__ppc__) -/******************************************************************************* -* * -* File logb.c, * -* Functions logb. * -* Implementation of logb for the PowerPC. * -* * -* Copyright © 1991 Apple Computer, Inc. All rights reserved. * -* * -* Written by Ali Sazegari, started on June 1991, * -* * -* August 26 1991: removed CFront Version 1.1d17 warnings. * -* August 27 1991: no errors reported by the test suite. * -* November 11 1991: changed CLASSEXTENDED to the macro CLASSIFY and * -* + or - infinity to constants. * -* November 18 1991: changed the macro CLASSIFY to CLASSEXTENDEDint to * -* improve performance. * -* February 07 1992: changed bit operations to macros ( object size is * -* unchanged ). * -* September24 1992: took the "#include support.h" out. * -* December 03 1992: first rs/6000 port. * -* August 30 1992: set the divide by zero for the zero argument case. * -* October 05 1993: corrected the environment. * -* October 17 1994: replaced all environmental functions with __setflm. * -* May 28 1997: made speed improvements. * -* April 30 2001: forst mac os x port using gcc. * -* * -******************************************************************************** -* The C math library offers a similar function called "frexp". It is * -* different in details from logb, but similar in spirit. This current * -* implementation of logb follows the recommendation in IEEE Standard 854 * -* which is different in its handling of denormalized numbers from the IEEE * -* Standard 754. * -*******************************************************************************/ - -typedef union - { - struct { -#if defined(__BIG_ENDIAN__) - unsigned long int hi; - unsigned long int lo; -#else - unsigned long int lo; - unsigned long int hi; -#endif - } words; - double dbl; - } DblInHex; - -static const double twoTo52 = 4.50359962737049600e15; // 0x1p52 -static const double klTod = 4503601774854144.0; // 0x1.000008p52 -static const unsigned long int signMask = 0x80000000ul; -static const DblInHex minusInf = {{ 0xFFF00000, 0x00000000 }}; - - -/******************************************************************************* -******************************************************************************** -* L O G B * -******************************************************************************** -*******************************************************************************/ - -double logb ( double x ) - { - DblInHex xInHex; - long int shiftedExp; - - xInHex.dbl = x; - shiftedExp = ( xInHex.words.hi & 0x7ff00000UL ) >> 20; - - if ( shiftedExp == 2047 ) - { // NaN or INF - if ( ( ( xInHex.words.hi & signMask ) == 0 ) || ( x != x ) ) - return x; // NaN or +INF return x - else - return -x; // -INF returns +INF - } - - if ( shiftedExp != 0 ) // normal number - shiftedExp -= 1023; // unbias exponent - - else if ( x == 0.0 ) - { // zero - xInHex.words.hi = 0x0UL; // return -infinity - return ( minusInf.dbl ); - } - - else - { // subnormal number - xInHex.dbl *= twoTo52; // scale up - shiftedExp = ( xInHex.words.hi & 0x7ff00000UL ) >> 20; - shiftedExp -= 1075; // unbias exponent - } - - if ( shiftedExp == 0 ) // zero result - return ( 0.0 ); - - else - { // nonzero result - xInHex.dbl = klTod; - xInHex.words.lo += shiftedExp; - return ( xInHex.dbl - klTod ); - } - } -#endif /* __ppc__ */ diff --git a/src/rtapi/xeno_math/scalb.c b/src/rtapi/xeno_math/scalb.c deleted file mode 100644 index 03d2de9..0000000 --- a/src/rtapi/xeno_math/scalb.c +++ /dev/null @@ -1,87 +0,0 @@ -#if defined(__ppc__) -/*********************************************************************** -** File: scalb.c -** -** Contains: C source code for implementations of floating-point -** scalb functions defined in header <fp.h>. In -** particular, this file contains implementations of -** functions scalb and scalbl for double and long double -** formats on PowerPC platforms. -** -** Written by: Jon Okada, SANEitation Engineer, ext. 4-4838 -** -** Copyright: © 1992 by Apple Computer, Inc., all rights reserved -** -** Change History ( most recent first ): -** -** 28 May 97 ali made an speed improvement for large n, -** removed scalbl. -** 12 Dec 92 JPO First created. -** -***********************************************************************/ - -typedef union - { - struct { -#if defined(__BIG_ENDIAN__) - unsigned long int hi; - unsigned long int lo; -#else - unsigned long int lo; - unsigned long int hi; -#endif - } words; - double dbl; - } DblInHex; - -static const double twoTo1023 = 8.988465674311579539e307; // 0x1p1023 -static const double twoToM1022 = 2.225073858507201383e-308; // 0x1p-1022 - - -/*********************************************************************** - double scalb( double x, long int n ) returns its argument x scaled - by the factor 2^m. NaNs, signed zeros, and infinities are propagated - by this function regardless of the value of n. - - Exceptions: OVERFLOW/INEXACT or UNDERFLOW inexact may occur; - INVALID for signaling NaN inputs ( quiet NaN returned ). - - Calls: none. -***********************************************************************/ - -double scalb ( double x, int n ) - { - DblInHex xInHex; - - xInHex.words.lo = 0UL; // init. low half of xInHex - - if ( n > 1023 ) - { // large positive scaling - if ( n > 2097 ) // huge scaling - return ( ( x * twoTo1023 ) * twoTo1023 ) * twoTo1023; - while ( n > 1023 ) - { // scale reduction loop - x *= twoTo1023; // scale x by 2^1023 - n -= 1023; // reduce n by 1023 - } - } - - else if ( n < -1022 ) - { // large negative scaling - if ( n < -2098 ) // huge negative scaling - return ( ( x * twoToM1022 ) * twoToM1022 ) * twoToM1022; - while ( n < -1022 ) - { // scale reduction loop - x *= twoToM1022; // scale x by 2^( -1022 ) - n += 1022; // incr n by 1022 - } - } - -/******************************************************************************* -* -1022 <= n <= 1023; convert n to double scale factor. * -*******************************************************************************/ - - xInHex.words.hi = ( ( unsigned long ) ( n + 1023 ) ) << 20; - return ( x * xInHex.dbl ); - } -#endif /* __ppc__ */ diff --git a/src/rtapi/xeno_math/sign.c b/src/rtapi/xeno_math/sign.c deleted file mode 100644 index ff6b8ca..0000000 --- a/src/rtapi/xeno_math/sign.c +++ /dev/null @@ -1,58 +0,0 @@ -#if defined(__ppc__) -/******************************************************************************* -* * -* File sign.c, * -* Functions copysign and __signbitd. * -* For PowerPC based machines. * -* * -* Copyright © 1991, 2001 Apple Computer, Inc. All rights reserved. * -* * -* Written by Ali Sazegari, started on June 1991. * -* * -* August 26 1991: no CFront Version 1.1d17 warnings. * -* September 06 1991: passes the test suite with invalid raised on * -* signaling nans. sane rom code behaves the same. * -* September 24 1992: took the Ò#include support.hÓ out. * -* Dcember 02 1992: PowerPC port. * -* July 20 1994: __fabs added * -* July 21 1994: deleted unnecessary functions: neg, COPYSIGNnew, * -* and SIGNNUMnew. * -* April 11 2001: first port to os x using gcc. * -* removed fabs and deffered to gcc for direct * -* instruction generation. * -* * -*******************************************************************************/ - -#include "fpP.h" - -/******************************************************************************* -* * -* Function copysign. * -* Implementation of copysign for the PowerPC. * -* * -******************************************************************************** -* Note: The order of the operands in this function is reversed from that * -* suggested in the IEEE standard 754. * -*******************************************************************************/ - -double copysign ( double arg2, double arg1 ) - { - union - { - dHexParts hex; - double dbl; - } x, y; - -/******************************************************************************* -* No need to flush NaNs out. * -*******************************************************************************/ - - x.dbl = arg1; - y.dbl = arg2; - - y.hex.high = y.hex.high & 0x7FFFFFFF; - y.hex.high = ( y.hex.high | ( x.hex.high & dSgnMask ) ); - - return y.dbl; - } -#endif /* __ppc__ */ |