support for various angular units in std.math

Colin Wallace wallacoloo at gmail.com
Mon Feb 28 17:03:50 PST 2011


Don Wrote:

> Colin Wallace wrote:
> > When using trigonometric functions, they all deal with radians. So
> > I've been having to do lots of converting. Converting is very
> > straightforward,
> 
> Actually, it isn't!
> assert(sin(360 * PI / 180 ) == 0.0); // fails!

That's a very marginal error (1e-19). For graphics, I never need that much precision. Besides, it has nothing to do with the conversion in this case. sin(2*PI) results in the same value, causing the assertion to fail.


More information about the Digitalmars-d mailing list