-
-
Notifications
You must be signed in to change notification settings - Fork 421
Fix Issue 20760 - checkaction=context doesnt print floating point num… #3058
Conversation
|
Thanks for your pull request and interest in making D better, @MoonlightSentinel! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please see CONTRIBUTING.md for more information. If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment. Bugzilla references
Testing this PR locallyIf you don't have a local development environment setup, you can use Digger to test this PR: dub run digger -- build "master + druntime#3058" |
| else // ireal | ||
| { | ||
| static if (is(LD == real)) | ||
| alias R = ireal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't R be a C type? I didn't think that C supported imaginary D types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Casting to a non-imaginary type yields 0, e.g.
ireal num = 2i;
writeln(cast(double) num); // 0
writeln(cast(idouble) num); // 2i
But ireal is stored the same way as real IIRC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see what the point of this is then. I was thinking the issue was that C wasn't properly using the types because of the imaginariness.
One last thing: put a static assert that V is ireal. It shouldn't affect compilation time at all, and ensures some weird problem doesn't creep in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| else // ireal | ||
| { | ||
| static if (is(LD == real)) | ||
| alias R = ireal; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I see what the point of this is then. I was thinking the issue was that C wasn't properly using the types because of the imaginariness.
One last thing: put a static assert that V is ireal. It shouldn't affect compilation time at all, and ensures some weird problem doesn't creep in here.
…bers correctly This fixes most issues allthough casting from real to c_long_double might be problematic for platforms where D's real uses 80 bits but C's long double is only 64 bit wide (e.g. Win64).
602e3dd to
8134855
Compare
…bers correctly
This fixes most issues allthough casting from real to c_long_double might be
problematic for platforms where D's real uses 80 bits but C's long double is
only 64 bit wide (e.g. Win64).
Note that this might cause some deprecations because of https://issues.dlang.org/show_bug.cgi?id=20759