Re: Confusion Concerning Numerical Equation

2019-11-16 Thread berni44 via Digitalmars-d-learn
On Saturday, 16 November 2019 at 10:01:25 UTC, Avery Stupidman wrote: assert(angleDeg(sqrt(3.0)/2.0, 1.5) == 60.0); // Fails On my computer the results are very close, that is: import std.math: nextUp; assert(nextUp(angleDeg(sqrt(3.0)/2.0, 1.5)) == 60.0); // OK On Saturday, 16 November 2019

Re: Confusion Concerning Numerical Equation

2019-11-16 Thread Avery Stupidman via Digitalmars-d-learn
On Saturday, 16 November 2019 at 10:17:12 UTC, drug wrote: 16.11.2019 13:01, Avery Stupidman пишет: [...] In general you shouldn't compare floating point values for equality because of their nature, you can use something like approxEqual https://dlang.org/library/std/math/approx_equal.html P

Re: Confusion Concerning Numerical Equation

2019-11-16 Thread drug via Digitalmars-d-learn
16.11.2019 13:01, Avery Stupidman пишет: Hello, I have a function "angle" that returns the angle (in degrees) of a right triangle given the length of the its lengths as type "real". It works, but when trying to test the equality of the angle with the seemingly identical value, I'm informed th

Re: Confusion Concerning Numerical Equation

2019-11-16 Thread Avery Stupidman via Digitalmars-d-learn
Typo in the first paragraph: angle -> angleDeg

Confusion Concerning Numerical Equation

2019-11-16 Thread Avery Stupidman via Digitalmars-d-learn
Hello, I have a function "angle" that returns the angle (in degrees) of a right triangle given the length of the its lengths as type "real". It works, but when trying to test the equality of the angle with the seemingly identical value, I'm informed that the two are not equal. Thus, when angl