On Saturday, 9 February 2019 at 02:54:18 UTC, Adam D. Ruppe wrote:
(The `real` thing in D was a massive mistake. It is slow and
adds nothing but confusion.)
We've had occasional problems with `real` being 80-bit on FPU
giving more precision than asked, and effectively hiding 32-bit
float pr
On Tuesday, 12 February 2019 at 09:20:27 UTC, Aurélien Plazzotta
wrote:
Thank you both for your lesson Adam D. Ruppe and H.S. Teoh.
Is there a wish or someone showing one's intention to implement
into the language the hypothetical built-in 128 bit types via
the "cent" and "ucent" reserved keywo
On Saturday, 9 February 2019 at 03:03:41 UTC, H. S. Teoh wrote:
If you want to hold more than 15 digits, you'll either have to
use `real`, which depending on your CPU will be 80-bit (x86) or
128-bit (a few newer, less common CPUs), or an
arbitrary-precision library that simulates larger precis
On Sunday, 10 February 2019 at 21:27:43 UTC, Dennis wrote:
On Sunday, 10 February 2019 at 20:25:02 UTC, Murilo wrote:
It seems this is a feature of D I will have to get used to and
accept the fact I can't always get the same number as in C
What compilers and settings do you use? What you're ac
On Sunday, 10 February 2019 at 20:25:02 UTC, Murilo wrote:
It seems this is a feature of D I will have to get used to and
accept the fact I can't always get the same number as in C
What compilers and settings do you use? What you're actually
comparing here are different implementations of the
On Saturday, 9 February 2019 at 05:46:22 UTC, H. S. Teoh wrote:
On Sat, Feb 09, 2019 at 03:52:38AM +, Murilo via
Digitalmars-d-learn wrote:
On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe
wrote:
[...]
> But you can change this with the format specifiers (use
> `writefln` instea
On Saturday, 9 February 2019 at 02:12:29 UTC, Murilo wrote:
Why is it that in C when I attribute the number
991234307654329925.7865 to a double it prints
991234299470108672. and in D it prints
9912342990. ? Apparently both languages
cause a certain loss
On Sat, Feb 09, 2019 at 04:36:26AM +, DanielG via Digitalmars-d-learn wrote:
> On Saturday, 9 February 2019 at 04:32:44 UTC, Murilo wrote:
> > Thank you very much for clearing this up. But how do I make D
> > behave just like C? Is there a way to do that?
>
> Off the top of my head, you'd have
On Sat, Feb 09, 2019 at 03:52:38AM +, Murilo via Digitalmars-d-learn wrote:
> On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe wrote:
[...]
> > But you can change this with the format specifiers (use `writefln`
> > instead of `writeln` and give a precision argument) or, of course,
>
On Saturday, 9 February 2019 at 04:36:26 UTC, DanielG wrote:
On Saturday, 9 February 2019 at 04:32:44 UTC, Murilo wrote:
Thank you very much for clearing this up. But how do I make D
behave just like C? Is there a way to do that?
Off the top of my head, you'd have to link against libc so you
On Saturday, 9 February 2019 at 04:32:44 UTC, Murilo wrote:
Thank you very much for clearing this up. But how do I make D
behave just like C? Is there a way to do that?
Off the top of my head, you'd have to link against libc so you
could use printf() directly.
But may I ask why that is so im
On Saturday, 9 February 2019 at 04:30:22 UTC, DanielG wrote:
On Saturday, 9 February 2019 at 03:33:13 UTC, Murilo wrote:
Thanks but here is the situation, I use printf("%.20f", 0.1);
in both C and D, C returns 0.1555 whereas D
returns 0.10001000. So I understand your
On Saturday, 9 February 2019 at 03:33:13 UTC, Murilo wrote:
Thanks but here is the situation, I use printf("%.20f", 0.1);
in both C and D, C returns 0.1555 whereas D
returns 0.10001000. So I understand your point, D
rounds off more, but that causes loss of precision,
On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe wrote:
On Saturday, 9 February 2019 at 03:21:51 UTC, Murilo wrote:
Now, changing a little bit the subject. All FPs in D turn out
to be printed differently than they are in C and in C it comes
out a little more precise than in D. Is thi
On Saturday, 9 February 2019 at 03:28:24 UTC, Adam D. Ruppe wrote:
On Saturday, 9 February 2019 at 03:21:51 UTC, Murilo wrote:
Now, changing a little bit the subject. All FPs in D turn out
to be printed differently than they are in C and in C it comes
out a little more precise than in D. Is thi
On Saturday, 9 February 2019 at 03:21:51 UTC, Murilo wrote:
Now, changing a little bit the subject. All FPs in D turn out
to be printed differently than they are in C and in C it comes
out a little more precise than in D. Is this really supposed to
happen?
Like I said in my first message, the
On Saturday, 9 February 2019 at 03:03:41 UTC, H. S. Teoh wrote:
On Sat, Feb 09, 2019 at 02:12:29AM +, Murilo via
Digitalmars-d-learn wrote:
Why is it that in C when I attribute the number
991234307654329925.7865 to a double it prints
991234299470108672. and in D it print
On Saturday, 9 February 2019 at 03:03:41 UTC, H. S. Teoh wrote:
It's not only because of converting decimal to binary, it's
also because double only has 64 bits to store information, and
your number has far more digits than can possibly fit into 64
bits.
Adding to that, here's a nice little o
On Sat, Feb 09, 2019 at 02:54:18AM +, Adam D. Ruppe via Digitalmars-d-learn
wrote:
[...]
> (The `real` thing in D was a massive mistake. It is slow and adds
> nothing but confusion.)
Yeah, it is also the only variable-width built-in type in D, which makes
it a wart in an otherwise elegant sys
On Saturday, 9 February 2019 at 02:54:18 UTC, Adam D. Ruppe wrote:
On Saturday, 9 February 2019 at 02:46:52 UTC, Murilo wrote:
But I used the type double in D which is supposed to be only
64 bits long and not 80 bits long, the type real is the one
which is supposed to be 80 bits long. Right?
On Sat, Feb 09, 2019 at 02:12:29AM +, Murilo via Digitalmars-d-learn wrote:
> Why is it that in C when I attribute the number
> 991234307654329925.7865 to a double it prints
> 991234299470108672. and in D it prints
> 9912342990. ? Apparently both language
On Saturday, 9 February 2019 at 02:46:52 UTC, Murilo wrote:
But I used the type double in D which is supposed to be only 64
bits long and not 80 bits long, the type real is the one which
is supposed to be 80 bits long. Right?
Right, BUT the compile time stuff is done before that.
double a = 1
On Saturday, 9 February 2019 at 02:42:09 UTC, Adam D. Ruppe wrote:
On Saturday, 9 February 2019 at 02:12:29 UTC, Murilo wrote:
prints
Two likely reasons: the D compiler does compile time stuff at
80 bit, whereas the C++ one probably uses 64 bit, and the D
default print rounds more aggressive
On Saturday, 9 February 2019 at 02:12:29 UTC, Murilo wrote:
prints
Two likely reasons: the D compiler does compile time stuff at 80
bit, whereas the C++ one probably uses 64 bit, and the D default
print rounds more aggressively than default C++ printing.
It is useful to put stuff in runtime
Why is it that in C when I attribute the number
991234307654329925.7865 to a double it prints
991234299470108672. and in D it prints
9912342990. ? Apparently both languages cause
a certain loss of precision(which is part of converting the
decimal system
25 matches
Mail list logo