summaryrefslogtreecommitdiff
path: root/libm/powerpc/s_rint.c
diff options
context:
space:
mode:
Diffstat (limited to 'libm/powerpc/s_rint.c')
-rw-r--r--libm/powerpc/s_rint.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/libm/powerpc/s_rint.c b/libm/powerpc/s_rint.c
index 47a79ae5e..72c4834d0 100644
--- a/libm/powerpc/s_rint.c
+++ b/libm/powerpc/s_rint.c
@@ -1,18 +1,18 @@
/*******************************************************************************
** File: rndint.c
-**
+**
** Contains: C source code for implementations of floating-point
** functions which round to integral value or format, as
** defined in header <fp.h>. In particular, this file
** contains implementations of functions rint, nearbyint,
** rinttol, round, roundtol, trunc, modf and modfl. This file
** targets PowerPC or Power platforms.
-**
+**
** Written by: A. Sazegari, Apple AltiVec Group
** Created originally by Jon Okada, Apple Numerics Group
-**
+**
** Copyright: © 1992-2001 by Apple Computer, Inc., all rights reserved
-**
+**
** Change History (most recent first):
**
** 13 Jul 01 ram replaced --setflm calls with inline assembly
@@ -21,7 +21,7 @@
** 1. removed double_t, put in double for now.
** 2. removed iclass from nearbyint.
** 3. removed wrong comments intrunc.
-** 4.
+** 4.
** 13 May 97 ali made performance improvements in rint, rinttol, roundtol
** and trunc by folding some of the taligent ideas into this
** implementation. nearbyint is faster than the one in taligent,
@@ -33,7 +33,7 @@
** 18 Feb 93 ali Changed the return value of fenv functions
** feclearexcept and feraiseexcept to their new
** NCEG X3J11.1/93-001 definitions.
-** 16 Dec 92 JPO Removed __itrunc implementation to a
+** 16 Dec 92 JPO Removed __itrunc implementation to a
** separate file.
** 15 Dec 92 JPO Added __itrunc implementation and modified
** rinttol to include conversion from double
@@ -41,7 +41,7 @@
** call __itrunc.
** 10 Dec 92 JPO Added modf (double) implementation.
** 04 Dec 92 JPO First created.
-**
+**
*******************************************************************************/
#include <limits.h>
@@ -73,7 +73,7 @@ static const DblInHex TOWARDZERO = {{ 0x00000000, 0x00000001 }};
* *
* The function rint rounds its double argument to integral value *
* according to the current rounding direction and returns the result in *
-* double format. This function signals inexact if an ordered return *
+* double format. This function signals inexact if an ordered return *
* value is not equal to the operand. *
* *
********************************************************************************
@@ -89,16 +89,16 @@ static const DblInHex TOWARDZERO = {{ 0x00000000, 0x00000001 }};
*double rint ( double x )
* {
* double y;
-*
+*
* y = twoTo52.fval;
-*
-* if ( fabs ( x ) >= y ) // huge case is exact
+*
+* if ( fabs ( x ) >= y ) // huge case is exact
* return x;
-* if ( x < 0 ) y = -y; // negative case
-* y = ( x + y ) - y; // force rounding
-* if ( y == 0.0 ) // zero results mirror sign of x
+* if ( x < 0 ) y = -y; // negative case
+* y = ( x + y ) - y; // force rounding
+* if ( y == 0.0 ) // zero results mirror sign of x
* y = copysign ( y, x );
-* return ( y );
+* return ( y );
* }
********************************************************************************
* Now a bit twidling version that is about %30 faster. *
@@ -110,17 +110,17 @@ double rint ( double x )
register double y;
unsigned long int xHead;
register long int target;
-
+
argument.dbl = x;
xHead = argument.words.hi & 0x7fffffffUL; // xHead <- high half of |x|
target = ( argument.words.hi < signMask ); // flags positive sign
-
- if ( xHead < 0x43300000ul )
+
+ if ( xHead < 0x43300000ul )
/*******************************************************************************
* Is |x| < 2.0^52? *
*******************************************************************************/
{
- if ( xHead < 0x3ff00000ul )
+ if ( xHead < 0x3ff00000ul )
/*******************************************************************************
* Is |x| < 1.0? *
*******************************************************************************/
@@ -129,7 +129,7 @@ double rint ( double x )
y = ( x + twoTo52 ) - twoTo52; // round at binary point
else
y = ( x - twoTo52 ) + twoTo52; // round at binary point
- if ( y == 0.0 )
+ if ( y == 0.0 )
{ // fix sign of zero result
if ( target )
return ( 0.0 );
@@ -138,7 +138,7 @@ double rint ( double x )
}
return y;
}
-
+
/*******************************************************************************
* Is 1.0 < |x| < 2.0^52? *
*******************************************************************************/
@@ -148,7 +148,7 @@ double rint ( double x )
else
return ( ( x - twoTo52 ) + twoTo52 );
}
-
+
/*******************************************************************************
* |x| >= 2.0^52 or x is a NaN. *
*******************************************************************************/