Using shorthand *= leads to unexpected result?

Saurabh Das via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 15 06:12:44 PDT 2016


On Sunday, 15 May 2016 at 13:01:45 UTC, Michael wrote:
> It may be that I'm doing something wrong here, but after 
> updating DMD to the latest version, my simulations started 
> producing some very odd results and I think I've pinpointed it 
> to a sign inversion that I was making. Here is some code from 
> dpaste to demonstrate the behaviour I get vs. the behaviour I 
> expected:
> https://dpaste.dzfl.pl/9bd7aea75fb2
>
> Any ideas? Am I getting something wrong or is this some sort of 
> regression with the latest DMD?

Strangely, if I substitute the variable type 'auto' for 'float' 
or 'real', it gives the expected output of -1. Variable type 
'double' gives the incorrect value of 1.

This is strange behaviour. Perhaps someone more knowledgeable can 
shed light. If it is a regression, it is a very serious 
regression :(

~ sd



More information about the Digitalmars-d-learn mailing list