Ticket #6230: math.h.2.diff

File math.h.2.diff, 1.9 KB (added by TechnoMancer, 14 years ago)

my version of the patch as I think it should be, tested quickly to make sure nothing complains when changed bits were used

  • headers/posix/math.h

     
    2121#define M_SQRT1_2       0.70710678118654752440  /* 1/sqrt(2) */
    2222
    2323/* platform independent IEEE floating point special values */
    24 #define __HUGE_VAL_v    0x7ff0000000000000LL
    25 #define __huge_val_t    union { unsigned char __c[8]; long long __ll; double __d; }
    26 #ifndef HUGE_VAL
    27 #   define HUGE_VAL     (((__huge_val_t) { __ll: __HUGE_VAL_v }).__d)
     24#if __GNUC__ >= 4
     25#   ifndef HUGE_VAL
     26#       define HUGE_VAL     __builtin_huge_val()
     27#   endif
     28#else
     29#   define  __HUGE_VAL_v    0x7ff0000000000000LL
     30#   define __huge_val_t union { unsigned char __c[8]; long long __ll; double __d; }
     31#   ifndef HUGE_VAL
     32#       define HUGE_VAL     (((__huge_val_t) { __ll: __HUGE_VAL_v }).__d)
     33#   endif
    2834#endif
    2935
    30 #define __HUGE_VALF_v   0x7f800000L
    31 #define __huge_valf_t   union { unsigned char __c[4]; long __l; float __f; }
    32 #define HUGE_VALF       (((__huge_valf_t) { __l: __HUGE_VALF_v }).__f)
     36#if __GNUC__ >= 4
     37#   define HUGE_VALF        __builtin_huge_valf()
     38#else
     39#   define __HUGE_VALF_v    0x7f800000L
     40#   define __huge_valf_t    union { unsigned char __c[4]; long __l; float __f; }
     41#   define HUGE_VALF        (((__huge_valf_t) { __l: __HUGE_VALF_v }).__f)
     42#endif
    3343
    34 /* TODO: define HUGE_VALL for long doubles */
     44/* TODO: define HUGE_VALL for long doubles for gcc2 */
     45#if __GNUC__ >= 4
     46#   define HUGE_VALL        __builtin_huge_vall()
     47#endif
    3548
    36 #define __NAN_VALF_v    0x7fc00000L
    37 #define NAN             (((__huge_valf_t) { __l: __NAN_VALF_v }).__f)
     49#if __GNUC__ >= 4
     50#   define NAN              __builtin_nanf("")
     51#else
     52#   define __NAN_VALF_v 0x7fc00000L
     53#   define NAN              (((__huge_valf_t) { __l: __NAN_VALF_v }).__f)
     54#endif
    3855
    39 #define INFINITY        HUGE_VALF
     56#if __GNUC__ >= 4
     57#   define INFINITY     __builtin_inff()
     58#else
     59#   define INFINITY     HUGE_VALF
     60#endif
    4061
    4162/* floating-point categories */
    4263#define FP_NAN          0