[Issue 5900] std.math.radians(), std.math.degrees()
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Apr 28 00:35:40 PDT 2011
http://d.puremagic.com/issues/show_bug.cgi?id=5900
Don <clugdbug at yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug at yahoo.com.au
--- Comment #2 from Don <clugdbug at yahoo.com.au> 2011-04-28 00:31:53 PDT ---
It's worse than that. A bigger issue is that it encourages the wrong approach.
These functions would encourage people to write wrong code like this:
sin(degreesToRadians(360));
Which gives the wrong answer -- sin(360degrees) should be EXACTLY zero, not a
small nonsense value like 1.4534e-17.
I don't think it's fair to trick people like that.
The correct way to do trig with degrees is: sin( ((x%360.0)/180)*PI );
I'll put this in the docs for std.math, since it's not obvious.
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list