| [b17b911f] | 1 | this change was made to generic __nexttowardf, but not the long double version
 | 
|---|
 | 2 | 
 | 
|---|
 | 3 | 2008-05-05  Aurelien Jarno  <aurelien@aurel32.net>
 | 
|---|
 | 4 | 
 | 
|---|
 | 5 |         * sysdeps/ieee754/ldbl-128/s_nexttowardf.c: Include float.h.
 | 
|---|
 | 6 |         (__nexttowardf): Use math_opt_barrier and
 | 
|---|
 | 7 |         math_force_eval macros.  If FLT_EVAL_METHOD is not 0, force
 | 
|---|
 | 8 |         x to float using asm.
 | 
|---|
 | 9 | 
 | 
|---|
 | 10 | ---
 | 
|---|
 | 11 |  sysdeps/ieee754/ldbl-128/s_nexttowardf.c |   26 ++++++++++++++++----------
 | 
|---|
 | 12 |  1 file changed, 16 insertions(+), 10 deletions(-)
 | 
|---|
 | 13 | 
 | 
|---|
 | 14 | --- a/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
 | 
|---|
 | 15 | +++ b/sysdeps/ieee754/ldbl-128/s_nexttowardf.c
 | 
|---|
 | 16 | @@ -19,7 +19,8 @@
 | 
|---|
 | 17 |  #endif
 | 
|---|
 | 18 |  
 | 
|---|
 | 19 |  #include "math.h"
 | 
|---|
 | 20 | -#include "math_private.h"
 | 
|---|
 | 21 | +#include <math_private.h>
 | 
|---|
 | 22 | +#include <float.h>
 | 
|---|
 | 23 |  
 | 
|---|
 | 24 |  #ifdef __STDC__
 | 
|---|
 | 25 |         float __nexttowardf(float x, long double y)
 | 
|---|
 | 26 | @@ -44,10 +45,12 @@
 | 
|---|
 | 27 |            return x+y;
 | 
|---|
 | 28 |         if((long double) x==y) return y;        /* x=y, return y */
 | 
|---|
 | 29 |         if(ix==0) {                             /* x == 0 */
 | 
|---|
 | 30 | -           float x2;
 | 
|---|
 | 31 | +           float u;
 | 
|---|
 | 32 |             SET_FLOAT_WORD(x,(u_int32_t)((hy>>32)&0x80000000)|1);/* return +-minsub*/
 | 
|---|
 | 33 | -           x2 = x*x;
 | 
|---|
 | 34 | -           if(x2==x) return x2; else return x; /* raise underflow flag */
 | 
|---|
 | 35 | +           u = math_opt_barrier (x);
 | 
|---|
 | 36 | +           u = u * u;
 | 
|---|
 | 37 | +           math_force_eval (u);                /* raise underflow flag */
 | 
|---|
 | 38 | +           return x;
 | 
|---|
 | 39 |         }
 | 
|---|
 | 40 |         if(hx>=0) {                             /* x > 0 */
 | 
|---|
 | 41 |             if(hy<0||(ix>>23)>(iy>>48)-0x3f80
 | 
|---|
 | 42 | @@ -67,13 +70,16 @@
 | 
|---|
 | 43 |             }
 | 
|---|
 | 44 |         }
 | 
|---|
 | 45 |         hy = hx&0x7f800000;
 | 
|---|
 | 46 | -       if(hy>=0x7f800000) return x+x;  /* overflow  */
 | 
|---|
 | 47 | +       if(hy>=0x7f800000) {
 | 
|---|
 | 48 | +         x = x+x;      /* overflow  */
 | 
|---|
 | 49 | +         if (FLT_EVAL_METHOD != 0)
 | 
|---|
 | 50 | +           /* Force conversion to float.  */
 | 
|---|
 | 51 | +           asm ("" : "+m"(x));
 | 
|---|
 | 52 | +         return x;
 | 
|---|
 | 53 | +       }
 | 
|---|
 | 54 |         if(hy<0x00800000) {             /* underflow */
 | 
|---|
 | 55 | -           float x2 = x*x;
 | 
|---|
 | 56 | -           if(x2!=x) {         /* raise underflow flag */
 | 
|---|
 | 57 | -               SET_FLOAT_WORD(x2,hx);
 | 
|---|
 | 58 | -               return x2;
 | 
|---|
 | 59 | -           }
 | 
|---|
 | 60 | +           float u = x*x;
 | 
|---|
 | 61 | +           math_force_eval (u);        /* raise underflow flag */
 | 
|---|
 | 62 |         }
 | 
|---|
 | 63 |         SET_FLOAT_WORD(x,hx);
 | 
|---|
 | 64 |         return x;
 | 
|---|
 | 65 | 
 | 
|---|