D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 3963 - out(result) in contract programming is nan
Summary: out(result) in contract programming is nan
Status: RESOLVED DUPLICATE of issue 3667
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: x86 Windows
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-14 15:03 UTC by bearophile_hugs
Modified: 2014-02-15 02:46 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description bearophile_hugs 2010-03-14 15:03:20 UTC
This program prints "nan" inside the out(result){}


import std.stdio: writeln;

double sqr(double x)
    out(result) {
        writeln("result1: ", result); // prints: result1: nan
        //assert(result >= 0);
    }
    body {
        return x * x;
    }
    
void main() {
    writeln("result2: ", sqr(100)); // prints: result2: 10000
}
Comment 1 Don 2010-03-15 00:55:49 UTC

*** This issue has been marked as a duplicate of issue 3667 ***