Ticket #7007: math_changes.patch

File math_changes.patch, 6.1 KB (added by ReidH, 9 years ago)
  • src/system/libroot/posix/glibc/math/math.h

     
    129129/* ISO C99 defines some generic macros which work on any data type.  */
    130130#if __USE_ISOC99
    131131
    132 /* Get the architecture specific values describing the floating-point
    133    evaluation.  The following symbols will get defined:
     132# if FLT_EVAL_METHOD == 1
     133typedef double float_t;
     134typedef double double_t;
     135# elif FLT_EVAL_METHOD == 2
     136typedef long double float_t;
     137typedef long double double_t;
     138# else
     139typedef float float_t;
     140typedef double double_t;
     141# endif         
    134142
    135     float_t floating-point type at least as wide as `float' used
    136         to evaluate `float' expressions
    137     double_t    floating-point type at least as wide as `double' used
    138         to evaluate `double' expressions
     143#define FP_FAST_FMA         1
     144#define FP_FAST_FMAL        1
     145#define FP_FAST_FMAF        1
     146#define FP_ILOGB0           2147483648
     147#define FP_ILOGBNAN         2147483647
     148#define MATH_ERRNO          1
     149#define MATH_ERREXCEPT      2
     150#define math_errhandling    3
    139151
    140     FLT_EVAL_METHOD
    141         Defined to
    142           0 if `float_t' is `float' and `double_t' is `double'
    143           1 if `float_t' and `double_t' are `double'
    144           2 if `float_t' and `double_t' are `long double'
    145           else  `float_t' and `double_t' are unspecified
    146 
    147     INFINITY    representation of the infinity value of type `float'
    148 
    149     FP_FAST_FMA
    150     FP_FAST_FMAF
    151     FP_FAST_FMAL
    152         If defined it indicates that the `fma' function
    153         generally executes about as fast as a multiply and an add.
    154         This macro is defined only iff the `fma' function is
    155         implemented directly with a hardware multiply-add instructions.
    156 
    157     FP_ILOGB0   Expands to a value returned by `ilogb (0.0)'.
    158     FP_ILOGBNAN Expands to a value returned by `ilogb (NAN)'.
    159 
    160     DECIMAL_DIG Number of decimal digits supported by conversion between
    161         decimal and all internal floating-point formats.
    162 
    163 */
    164 
    165152/* All floating-point numbers can be put in one of these categories.  */
    166153enum
    167154  {
  • src/system/libroot/posix/glibc/arch/generic/w_gammaf_r.c

     
     1/* w_gammaf_r.c -- float version of w_gamma_r.c.
     2 * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com.
     3 */
     4
     5/*
     6 * ====================================================
     7 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
     8 *
     9 * Developed at SunPro, a Sun Microsystems, Inc. business.
     10 * Permission to use, copy, modify, and distribute this
     11 * software is freely granted, provided that this notice
     12 * is preserved.
     13 * ====================================================
     14 */
     15
     16#if defined(LIBM_SCCS) && !defined(lint)
     17static char rcsid[] = "$NetBSD: w_gammaf_r.c,v 1.8 2002/05/26 22:02:01 wiz Exp $";
     18#endif
     19
     20/*
     21 * wrapper float gammaf_r(float x, int *signgamp)
     22 */
     23
     24#include "math.h"
     25#include "math_private.h"
     26
     27float gammaf_r(float x, int *signgamp) /* wrapper lgammaf_r */
     28{
     29#ifdef _IEEE_LIBM
     30    return __ieee754_lgammaf_r(x,signgamp);
     31#else
     32        float y;
     33        y = __ieee754_lgammaf_r(x,signgamp);
     34        if(_LIB_VERSION == _IEEE_) return y;
     35        if(!finitef(y)&&finitef(x)) {
     36            if(floorf(x)==x&&x<=(float)0.0)
     37            /* gammaf pole */
     38                return (float)__kernel_standard((double)x,(double)x,141);
     39            else
     40            /* gamma overflow */
     41                return (float)__kernel_standard((double)x,(double)x,140);
     42        } else
     43            return y;
     44#endif
     45}
     46weak_alias (__gammaf_r, gammaf_r)
  • src/system/libroot/posix/glibc/arch/generic/w_gamma_r.c

    Property changes on: src/system/libroot/posix/glibc/arch/generic/w_gammaf_r.c
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
     1/* @(#)w_gamma_r.c 1.3 95/01/18 */
     2/*
     3 * ====================================================
     4 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
     5 *
     6 * Developed at SunSoft, a Sun Microsystems, Inc. business.
     7 * Permission to use, copy, modify, and distribute this
     8 * software is freely granted, provided that this notice
     9 * is preserved.
     10 * ====================================================
     11 */
     12
     13#include "math.h"
     14#include "math_private.h"
     15
     16
     17#ifdef __STDC__
     18    double gamma_r(double x, int *signgamp) /* wrapper lgamma_r */
     19#else
     20    double gamma_r(x,signgamp)              /* wrapper lgamma_r */
     21        double x; int *signgamp;
     22#endif
     23{
     24#ifdef _IEEE_LIBM
     25    return __ieee754_gamma_r(x,signgamp);
     26#else
     27        double y;
     28        y = __ieee754_gamma_r(x,signgamp);
     29        if(_LIB_VERSION == _IEEE_) return y;
     30        if(!finite(y)&&finite(x)) {
     31            if(floor(x)==x&&x<=0.0)
     32                return __kernel_standard(x,x,41); /* gamma pole */
     33            else
     34                return __kernel_standard(x,x,40); /* gamma overflow */
     35        } else
     36            return y;
     37#endif
     38}
     39weak_alias (__gamma_r, gamma_r)
     40#ifdef NO_LONG_DOUBLE
     41strong_alias (__gamma_r, __gammal_r)
     42weak_alias (__gamma_r, gammal_r)
     43#endif
  • headers/posix/math.h

    Property changes on: src/system/libroot/posix/glibc/arch/generic/w_gamma_r.c
    ___________________________________________________________________
    Added: svn:executable
       + *
    
     
    1919#define M_2_SQRTPI      1.12837916709551257390  /* 2/sqrt(pi) */
    2020#define M_SQRT2         1.41421356237309504880  /* sqrt(2) */
    2121#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
     22#define MAXFLOAT            3.40282346638528860e+38 /*max float value */
    2223
    2324/* platform independent IEEE floating point special values */
    2425#if __GNUC__ >= 4