[Issue 15466] Incorrect result for 'real'

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Oct 24 13:45:31 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=15466

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |WORKSFORME

--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
Hi, Ali!

I was not able to compile your initial code in the bug report, so I slightly
modified it to compile:

```d
import std.stdio;
import std.datetime.stopwatch;    // this was `import std.datetime;`

alias T = real;     // Must be 'real'
enum testCount = 7; // Must be > 6

T foo() {           // Must return a value
    return 42; 
}

void main() {
                    // Must cast to void
    const m = benchmark!(() => cast(void)foo)(testCount);
    writeln(m[0].total!"msecs");  // this was `writeln(m[0].msecs);`            
}
```

Running this code yields `0`.

I will close this as WORKSFORME, but please reopen if there is anything that I
am missing.

--


More information about the Digitalmars-d-bugs mailing list