base/math/sign.c

Go to the documentation of this file.
00001 #if defined(__ppc__) 00002 /******************************************************************************* 00003 * * 00004 * File sign.c, * 00005 * Functions copysign and __signbitd. * 00006 * For PowerPC based machines. * 00007 * * 00008 * Copyright © 1991, 2001 Apple Computer, Inc. All rights reserved. * 00009 * * 00010 * Written by Ali Sazegari, started on June 1991. * 00011 * * 00012 * August 26 1991: no CFront Version 1.1d17 warnings. * 00013 * September 06 1991: passes the test suite with invalid raised on * 00014 * signaling nans. sane rom code behaves the same. * 00015 * September 24 1992: took the ̉#include support.hÓ out. * 00016 * Dcember 02 1992: PowerPC port. * 00017 * July 20 1994: __fabs added * 00018 * July 21 1994: deleted unnecessary functions: neg, COPYSIGNnew, * 00019 * and SIGNNUMnew. * 00020 * April 11 2001: first port to os x using gcc. * 00021 * removed fabs and deffered to gcc for direct * 00022 * instruction generation. * 00023 * * 00024 *******************************************************************************/ 00025 00026 #include "fpP.h" 00027 00028 /******************************************************************************* 00029 * * 00030 * Function copysign. * 00031 * Implementation of copysign for the PowerPC. * 00032 * * 00033 ******************************************************************************** 00034 * Note: The order of the operands in this function is reversed from that * 00035 * suggested in the IEEE standard 754. * 00036 *******************************************************************************/ 00037 00038 double copysign ( double arg2, double arg1 ) 00039 { 00040 union 00041 { 00042 dHexParts hex; 00043 double dbl; 00044 } x, y; 00045 00046 /******************************************************************************* 00047 * No need to flush NaNs out. * 00048 *******************************************************************************/ 00049 00050 x.dbl = arg1; 00051 y.dbl = arg2; 00052 00053 y.hex.high = y.hex.high & 0x7FFFFFFF; 00054 y.hex.high = ( y.hex.high | ( x.hex.high & dSgnMask ) ); 00055 00056 return y.dbl; 00057 } 00058 #endif /* __ppc__ */

Generated on Thu Nov 20 11:49:52 2008 for RTAI API by doxygen 1.3.8