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

Changeset 3228

Show
Ignore:
Timestamp:
02/19/08 03:07:29 (5 months ago)
Author:
Don Clugston
Message:

Workaround for compiler bug: Stop compiler from generating ridiculous warnings in IEEE. Added L suffix to constants in Math.

Files:

Legend:

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

    r3192 r3228  
    880880        return (*p & 0x7FF0_0000_0000_0000 == 0x7FF0_0000_0000_0000) && *p & 0x000F_FFFF_FFFF_FFFF; 
    881881  } else static if (real.mant_dig==64) {     // real80 
    882         ushort e = EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT]; 
     882        // Prevent a ridiculous warning (why does (ushort | ushort) get promoted to int???) 
     883        ushort e = cast(ushort)(EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT]); 
    883884        ulong*  ps = cast(ulong *)&x; 
    884885        return e == 0x7FFF && 
     
    925926    ushort *p = cast(ushort *)&d; 
    926927    version(LittleEndian) { 
    927         ushort e = p[3] & 0x7FF0; 
     928        ushort e = p[3]; 
     929        e &= 0x7FF0; 
    928930    } else { 
    929         ushort e = p[0] & 0x7FF0; 
     931        ushort e = p[0]; e &= 0x7FF0; 
    930932    } 
    931933    return e!=0 && e != 0x7FF0; 
     
    941943        return isNormal((cast(double*)&x)[1]); 
    942944    } else static if (real.mant_dig == 64) { // real80 
    943         ushort e = EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT]; 
     945    // ridiculous DMD warning 
     946        ushort e = cast(ushort)(EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT]); 
    944947        return (e != 0x7FFF && e!=0); 
    945948    } else static if (real.mant_dig == 113) { // quadruple 
     
    11371140         && (ps[MANTISSA_MSB] & 0x7FFF_FFFF_FFFF_FFFF) == 0x7FFF_0000_0000_0000; 
    11381141    } else { // real80 
    1139         ushort e = EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT]
     1142        ushort e = cast(ushort)(EXPMASK & (cast(ushort *)&x)[EXPONENTPOS_SHORT])
    11401143        ulong*  ps = cast(ulong *)&x; 
    11411144 
  • trunk/tango/math/Math.d

    r2706 r3228  
    7878 
    7979const real E          = 2.7182818284590452354L;  /** e */ 
    80 const real LOG2T      = 0x1.a934f0979a3715fcp+1; /** log<sub>2</sub>10 */ // 3.32193 fldl2t 
    81 const real LOG2E      = 0x1.71547652b82fe178p+0; /** log<sub>2</sub>e */ // 1.4427 fldl2e 
    82 const real LOG2       = 0x1.34413509f79fef32p-2; /** log<sub>10</sub>2 */ // 0.30103 fldlg2 
     80const real LOG2T      = 0x1.a934f0979a3715fcp+1L; /** log<sub>2</sub>10 */ // 3.32193 fldl2t 
     81const real LOG2E      = 0x1.71547652b82fe178p+0L; /** log<sub>2</sub>e */ // 1.4427 fldl2e 
     82const real LOG2       = 0x1.34413509f79fef32p-2L; /** log<sub>10</sub>2 */ // 0.30103 fldlg2 
    8383const real LOG10E     = 0.43429448190325182765L;  /** log<sub>10</sub>e */ 
    84 const real LN2        = 0x1.62e42fefa39ef358p-1; /** ln 2 */    // 0.693147 fldln2 
     84const real LN2        = 0x1.62e42fefa39ef358p-1L; /** ln 2 */    // 0.693147 fldln2 
    8585const real LN10       = 2.30258509299404568402L;  /** ln 10 */ 
    86 const real PI         = 0x1.921fb54442d1846ap+1; /** &pi; */ // 3.14159 fldpi 
     86const real PI         = 0x1.921fb54442d1846ap+1L; /** &pi; */ // 3.14159 fldpi 
    8787const real PI_2       = 1.57079632679489661923L;  /** &pi; / 2 */ 
    8888const real PI_4       = 0.78539816339744830962L;  /** &pi; / 4 */ 
     
    9696//const real SQRT2PI = 2.50662827463100050242E0L; /** &radic;(2 &pi;) */ 
    9797 
    98 const real MAXLOG = 0x1.62e42fefa39ef358p+13;  /** log(real.max) */ 
    99 const real MINLOG = -0x1.6436716d5406e6d8p+13; /** log(real.min*real.epsilon) */ 
    100 const real EULERGAMMA = 0.57721_56649_01532_86060_65120_90082_40243_10421_59335_93992; /** Euler-Mascheroni constant 0.57721566.. */ 
     98const real MAXLOG = 0x1.62e42fefa39ef358p+13L;  /** log(real.max) */ 
     99const real MINLOG = -0x1.6436716d5406e6d8p+13L; /** log(real.min*real.epsilon) */ 
     100const real EULERGAMMA = 0.57721_56649_01532_86060_65120_90082_40243_10421_59335_93992L; /** Euler-Mascheroni constant 0.57721566.. */ 
    101101 
    102102/*