On Sunday, 22 October 2017 at 14:59:41 UTC, Andrei Alexandrescu
wrote:
On 10/22/17 9:41 AM, User wrote:
Is there a list of such quirks or gotchas in dlang?
The ones I know of are
1. Implicit conversion from double to float
2. Integer division results in integer result truncation the
On Tuesday, 24 October 2017 at 15:29:38 UTC, Basile B. wrote:
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I was working on some sort of math library for use in
graphical computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I
On Wednesday, 25 October 2017 at 01:24:01 UTC, codephantom wrote:
http://web.mit.edu/curhan/www/docs/Articles/15341_Readings/Group_Dynamics/Janis_Groupthink_from_Psych_Today.pdf
Great read, thank you for sharing!
On Tuesday, 24 October 2017 at 17:54:55 UTC, Andrei Alexandrescu
wrote:
For the record, I remember the points made:
* When converting across integral types, any failed coercion
yields a value essentially unrelated to the source. So we
deemed these unacceptable.
* When converting int to
On Wednesday, 25 October 2017 at 01:06:40 UTC, codephantom wrote:
Consensus within groups is kind of important actually...it
encourages harmony and coherence..with which.. there is no
group.
if only we could edit our post to correct it...when's that going
to happen btw. ;-)
of course I
On Tuesday, 24 October 2017 at 16:28:03 UTC, Fool wrote:
@all: It is sad to see how parts of the community are losing
their distance to the project and even put a gloss on
completely absurd design decisions.
Consensus within groups is kind of important actually...it
encourages harmony and
On 10/24/2017 12:28 PM, Fool wrote:
On Tuesday, 24 October 2017 at 14:28:20 UTC, Basile B. wrote:
float f0 = cos(2 * PI / 1.123548789545545646452154L);
float f1 = cos(cast(float)(2 * PI / 1.123548789545545646452154L));
[...]
but paradoxically the first is more accurate.
There is no
On Tuesday, 24 October 2017 at 14:28:20 UTC, Basile B. wrote:
float f0 = cos(2 * PI / 1.123548789545545646452154L);
float f1 = cos(cast(float)(2 * PI /
1.123548789545545646452154L));
[...]
but paradoxically the first is more accurate.
There is no paradox. That's comparing apples
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I was working on some sort of math library for use in graphical
computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I realized that atan() returns double (in
this case) but wait,
On Tuesday, 24 October 2017 at 01:22:57 UTC, codephantom wrote:
On Monday, 23 October 2017 at 21:51:24 UTC, Basile B. wrote:
---
/**
* Wraps a floating point type that doesn't follow D
permissive float conversion
* rules.
*
* In D, as in C++, implicit conversion from $(D double) to
$(D
On Monday, 23 October 2017 at 21:51:24 UTC, Basile B. wrote:
---
/**
* Wraps a floating point type that doesn't follow D permissive
float conversion
* rules.
*
* In D, as in C++, implicit conversion from $(D double) to $(D
float) is allowed,
* leading to a possible precision loss. This
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I was working on some sort of math library for use in graphical
computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I realized that atan() returns double (in
this case) but wait,
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I was working on some sort of math library for use in graphical
computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I realized that atan() returns double (in
this case) but wait,
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I think this is a serious topic and needs clarification.
Just out of interest, as opposed to wanting to debate the
merits...
I did a little investigation of how various languages deal with
floating point precision (by default) for
On Sunday, 22 October 2017 at 10:57:24 UTC, NX wrote:
On Sunday, 22 October 2017 at 02:25:44 UTC, codephantom wrote:
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
Interestingly enough, I realized that atan() returns double
(in this case) but wait, it's assigned to a float variable!
On Sunday, 22 October 2017 at 10:57:24 UTC, NX wrote:
I just think spec should be reviewed at this point.
Well, as Andrei famously once said, don't argue with the
language, just build stuff.
So in that spirit, lets not argue with the language
specification, but find a solution that meets
On 10/22/17 9:41 AM, User wrote:
Is there a list of such quirks or gotchas in dlang?
The ones I know of are
1. Implicit conversion from double to float
2. Integer division results in integer result truncation the fractional
part.
These are not gotchas, as TDPL explains. One unpleasant
On Sunday, 22 October 2017 at 13:41:23 UTC, User wrote:
Is there a list of such quirks or gotchas in dlang?
The ones I know of are
1. Implicit conversion from double to float
2. Integer division results in integer result truncation the
fractional part.
3. ??
#2 is common for statically
Is there a list of such quirks or gotchas in dlang?
The ones I know of are
1. Implicit conversion from double to float
2. Integer division results in integer result truncation the
fractional part.
3. ??
On Sunday, 22 October 2017 at 12:17:49 UTC, Basile B. wrote:
On Sunday, 22 October 2017 at 10:57:24 UTC, NX wrote:
[...]
Fortunately D provides enough to simplify self-discipline:
---
import std.traits;
struct FP(T)
if (isFloatingPoint!T)
{
T _value;
alias _value this;
void
On Sunday, 22 October 2017 at 10:57:24 UTC, NX wrote:
On Sunday, 22 October 2017 at 02:25:44 UTC, codephantom wrote:
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
Interestingly enough, I realized that atan() returns double
(in this case) but wait, it's assigned to a float variable!
On Sunday, 22 October 2017 at 10:57:24 UTC, NX wrote:
D is not C/C++ either. I fail to see how does it help to be C++
compliant. It's absolutely trivial to tell the compiler that
conversion is on purpose by explicitly casting and it immensely
helps to reduce bugs (since we are humans after
On Sunday, 22 October 2017 at 02:25:44 UTC, codephantom wrote:
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
Interestingly enough, I realized that atan() returns double
(in this case) but wait, it's assigned to a float variable!
Compiler didn't even emit warnings, let alone errors.
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
Interestingly enough, I realized that atan() returns double (in
this case) but wait, it's assigned to a float variable!
Compiler didn't even emit warnings, let alone errors.
There a few lessons here.
(1) D is not Java ;-)
(2) Know
On Saturday, 21 October 2017 at 20:17:12 UTC, NX wrote:
I was working on some sort of math library for use in graphical
computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I realized that atan() returns double (in
this case) but wait,
I was working on some sort of math library for use in graphical
computing and I wrote something like this:
const float PiOver2 = (atan(1.0) * 4) / 2;
Interestingly enough, I realized that atan() returns double (in
this case) but wait, it's assigned to a float variable! Compiler
didn't even
26 matches
Mail list logo