Ticket #7007: math_changes.2.patch

File math_changes.2.patch, 6.3 KB (added by ReidH, 9 years ago)
  • 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
     
    5657#define FP_ZERO         2
    5758#define FP_SUBNORMAL    3
    5859#define FP_NORMAL       4
     60#define FP_FAST_FMA         1
     61#define FP_FAST_FMAL        1
     62#define FP_FAST_FMAF        1
     63#define FP_ILOGB0           2147483648
     64#define FP_ILOGBNAN         2147483647
     65#define MATH_ERRNO          1
     66#define MATH_ERREXCEPT      2
     67#define math_errhandling    3
    5968
     69# if FLT_EVAL_METHOD == 1
     70typedef double float_t;
     71typedef double double_t;
     72# elif FLT_EVAL_METHOD == 2
     73typedef long double float_t;
     74typedef long double double_t;
     75# else
     76typedef float float_t;
     77typedef double double_t;
     78# endif
     79
    6080#ifdef __cplusplus
    6181struct __exception;
    6282extern "C" int matherr(struct __exception *);
     
    350370        : sizeof(value) == sizeof(double) ? __isinf(value)      \
    351371        : __isinfl(value))
    352372
     373/* Return nonzero value if X is greater than Y.  */
     374#  define isgreater(x, y) \
     375  (__extension__                                  \
     376   ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
     377      !isunordered (__x, __y) && __x > __y; }))
     378
     379/* Return nonzero value if X is greater than or equal to Y.  */
     380#  define isgreaterequal(x, y) \
     381  (__extension__                                  \
     382   ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
     383      !isunordered (__x, __y) && __x >= __y; }))
     384
     385/* Return nonzero value if X is less than Y.  */
     386#  define isless(x, y) \
     387  (__extension__                                  \
     388   ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
     389      !isunordered (__x, __y) && __x < __y; }))
     390
     391/* Return nonzero value if X is less than or equal to Y.  */
     392#  define islessequal(x, y) \
     393  (__extension__                                  \
     394   ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
     395      !isunordered (__x, __y) && __x <= __y; }))
     396
     397/* Return nonzero value if either X is less than Y or Y is less than X.  */
     398#  define islessgreater(x, y) \
     399  (__extension__                                  \
     400   ({ __typeof__(x) __x = (x); __typeof__(y) __y = (y);               \
     401      !isunordered (__x, __y) && (__x < __y || __y < __x); }))
     402
     403/* Return nonzero value if arguments are unordered.  */
     404#  define isunordered(u, v) \
     405  (__extension__                                  \
     406   ({ __typeof__(u) __u = (u); __typeof__(v) __v = (v);               \
     407      fpclassify (__u) == FP_NAN || fpclassify (__v) == FP_NAN; }))
     408
    353409#ifdef __cplusplus
    354410}
    355411#endif