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
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
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
Typo in the first paragraph: angle -> angleDeg
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