Skip to content

Commit

Permalink
fix Issue 4887 - Right-shifting by 32 is allowed and broken
Browse files Browse the repository at this point in the history
  • Loading branch information
WalterBright committed Jan 24, 2012
1 parent 259fef5 commit ecbc5db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion std/numeric.d
Expand Up @@ -367,7 +367,9 @@ struct CustomFloat(

/// Returns: number of decimal digits of precision
static @property size_t dig(){
return cast(size_t) log10( 1uL << precision - ((flags&Flags.storeNormalized) != 0));
auto shiftcnt = precision - ((flags&Flags.storeNormalized) != 0);
auto x = (shiftcnt == 64) ? 0 : 1uL << shiftcnt;
return cast(size_t) log10(x);
}

/// Returns: smallest increment to the value 1
Expand Down

0 comments on commit ecbc5db

Please sign in to comment.