I was writing an example to show that not every 'long' value can be
represented by a 'double'. (They are both 64 bits; but for 'double',
some of those bits are parts of the exponent, not the mantissa.)
Although my demonstration works with to!double, the compiler does
something different and
On 01/04/2016 12:22 AM, Ali Çehreli wrote:
> assert(l != l.to!double); // passes
> assert(l != cast(double)l);// FAILS
I've realized that I had the -m32 switch on unintentionally. The above
results are for when -m32 is used. (I am on a 64-bit system.)
Without -m32 both
On 04.01.2016 09:22, Ali Çehreli wrote:
void main() {
const l = long.max;
assert(l != l.to!double); // passes
assert(l != cast(double)l);// FAILS
}
Is there a good explanation for this difference? I would expect both
expressions to be compiled the same way. (I am aware