Using shorthand *= leads to unexpected result?

Michael via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 15 06:25:42 PDT 2016


On Sunday, 15 May 2016 at 13:12:44 UTC, Saurabh Das wrote:
> 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

Well I'm pretty sure the code was working just fine earlier in 
the week at the office, but running the code at home with the 
newest version of DMD started producing these odd results.


More information about the Digitalmars-d-learn mailing list