On Monday, 18 November 2019 at 21:54:53 UTC, Steven Schveighoffer
wrote:
You are expecting floating point to behave as if it is stored
as a decimal number. It's not.
I was actually asking why 'c' and 'c2' functions behave
differently. After mipri's answer I learned that the default
floating p
On 11/18/19 4:54 PM, Steven Schveighoffer wrote:
What you may want to do is use std.math.ceil.
Sorry, what you want is std.math.round.
-Steve
On 11/18/19 4:08 PM, Luiz Silveira wrote:
Hello, everyone!
I'm a new D fan, still learning the language and this is my first post.
I came up with a strange behavior, using D 2.089 for windows.
Considering the program "error.d":
import std.stdio;
import std.conv;
void main() {
On Monday, 18 November 2019 at 21:14:37 UTC, mipri wrote:
double f;
If this is changed to `real f;`, you get the desired result.
real is also the type used for the comparison code:
https://dlang.org/spec/float.html#fp_const_folding
Yes, it worked as expected.
Thank you,
Luiz.
On Monday, 18 November 2019 at 21:08:39 UTC, Luiz Silveira wrote:
double f;
If this is changed to `real f;`, you get the desired result.
real is also the type used for the comparison code:
https://dlang.org/spec/float.html#fp_const_folding
Hello, everyone!
I'm a new D fan, still learning the language and this is my
first post.
I came up with a strange behavior, using D 2.089 for windows.
Considering the program "error.d":
import std.stdio;
import std.conv;
void main() {
uint c(double v) {
return