Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2612

Show
Ignore:
Timestamp:
10/03/07 14:19:27 (1 year ago)
Author:
sean
Message:

Fix for ticket #627.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tango/stdc/math.d

    r871 r2612  
    134134    { 
    135135        return (real.sizeof == double.sizeof) 
    136            ? __fpclassify_d(x) 
    137            : __fpclassify_ld(x); 
     136            ? __fpclassify_d(x) 
     137            : __fpclassify_ld(x); 
    138138    } 
    139139 
     
    165165        return (real.sizeof == double.sizeof) 
    166166            ? (cast(short*)&(x))[3] & 0x8000 
    167            : (cast(short*)&(x))[4] & 0x8000; 
     167            : (cast(short*)&(x))[4] & 0x8000; 
    168168    } 
    169169  } 
    170170} 
    171 else version( Posix ) 
     171else version( linux ) 
    172172{ 
    173173    enum 
     
    215215    { 
    216216        return (real.sizeof == double.sizeof) 
    217            ? __fpclassify(x) 
    218            : __fpclassifyl(x); 
     217            ? __fpclassify(x) 
     218            : __fpclassifyl(x); 
    219219    } 
    220220 
     
    225225    { 
    226226        return (real.sizeof == double.sizeof) 
    227            ? __finite(x) 
    228            : __finitel(x); 
     227            ? __finite(x) 
     228            : __finitel(x); 
    229229    } 
    230230 
     
    235235    { 
    236236        return (real.sizeof == double.sizeof) 
    237            ? __isinf(x) 
    238            : __isinfl(x); 
     237            ? __isinf(x) 
     238            : __isinfl(x); 
    239239    } 
    240240 
     
    245245    { 
    246246        return (real.sizeof == double.sizeof) 
    247            ? __isnan(x) 
    248            : __isnanl(x); 
     247            ? __isnan(x) 
     248            : __isnanl(x); 
    249249    } 
    250250 
     
    260260    { 
    261261        return (real.sizeof == double.sizeof) 
    262             ? __signbit(x) 
    263             : __signbitl(x); 
     262            ? __signbit(x) 
     263            : __signbitl(x); 
     264    } 
     265  } 
     266
     267else version( darwin ) 
     268
     269    enum 
     270    { 
     271        FP_NAN         = 1, 
     272        FP_INFINITE    = 2, 
     273        FP_ZERO        = 3, 
     274        FP_NORMAL      = 4, 
     275        FP_SUBNORMAL   = 5, 
     276        FP_SUPERNORMAL = 6 
     277    } 
     278 
     279    enum 
     280    { 
     281        FP_FAST_FMA  = 0, 
     282        FP_FAST_FMAF = 0, 
     283        FP_FAST_FMAL = 0, 
     284    } 
     285 
     286    int __fpclassifyf(float x); 
     287    int __fpclassifyd(double x); 
     288    int __fpclassify(real x); 
     289 
     290    int __isfinitef(float x); 
     291    int __isfinited(double x); 
     292    int __isfinite(real x); 
     293 
     294    int __isinff(float x); 
     295    int __isinfd(double x); 
     296    int __isinf(real x); 
     297 
     298    int __isnanf(float x); 
     299    int __isnand(double x); 
     300    int __isnan(real x); 
     301 
     302    int __signbitf(float x); 
     303    int __signbitd(double x); 
     304    int __signbitl(real x); 
     305 
     306  extern (D) 
     307  { 
     308    //int fpclassify(real-floating x); 
     309    int fpclassify(float x)     { return __fpclassifyf(x); } 
     310    int fpclassify(double x)    { return __fpclassifyd(x); } 
     311    int fpclassify(real x) 
     312    { 
     313        return (real.sizeof == double.sizeof) 
     314            ? __fpclassifyd(x) 
     315            : __fpclassify(x); 
     316    } 
     317 
     318    //int isfinite(real-floating x); 
     319    int isfinite(float x)       { return __isfinitef(x); } 
     320    int isfinite(double x)      { return __isfinited(x); } 
     321    int isfinite(real x) 
     322    { 
     323        return (real.sizeof == double.sizeof) 
     324            ? __isfinited(x) 
     325            : __isfinite(x); 
     326    } 
     327 
     328    //int isinf(real-floating x); 
     329    int isinf(float x)          { return __isinff(x); } 
     330    int isinf(double x)         { return __isinfd(x); } 
     331    int isinf(real x) 
     332    { 
     333        return (real.sizeof == double.sizeof) 
     334            ? __isinfd(x) 
     335            : __isinf(x); 
     336    } 
     337 
     338    //int isnan(real-floating x); 
     339    int isnan(float x)          { return __isnanf(x); } 
     340    int isnan(double x)         { return __isnand(x); } 
     341    int isnan(real x) 
     342    { 
     343        return (real.sizeof == double.sizeof) 
     344            ? __isnand(x) 
     345            : __isnan(x); 
     346    } 
     347 
     348    //int isnormal(real-floating x); 
     349    int isnormal(float x)       { return fpclassify(x) == FP_NORMAL; } 
     350    int isnormal(double x)      { return fpclassify(x) == FP_NORMAL; } 
     351    int isnormal(real x)        { return fpclassify(x) == FP_NORMAL; } 
     352 
     353    //int signbit(real-floating x); 
     354    int signbit(float x)     { return __signbitf(x); } 
     355    int signbit(double x)    { return __signbitd(x); } 
     356    int signbit(real x) 
     357    { 
     358        return (real.sizeof == double.sizeof) 
     359            ? __signbitd(x) 
     360            : __signbitl(x); 
    264361    } 
    265362  }