expi

Undocumented in source. Be warned that the author may not have intended to support it.
expi
(
Q
)
()
if (
Q.init.isConvertibleTo!radian
)

Examples

import std.math : isClose;

assert(0.0*radian < 1.0*radian);
// TODO fix Quantitiy.opCmp to allow: assert(0.0*radian < 1.0*degree);

assert(isClose(cos(0.0*radian), 1));
assert(isClose(cos(PI*radian), -1));
assert(isClose(cos(2*PI*radian), 1));

enum d = (180*degree);
// pragma(msg, d.stringof ~ " : " ~ typeof(d).stringof);

enum r = d.convert!radian;
// pragma(msg, r.stringof ~ " : " ~ typeof(r).stringof);

// TODO enable when cast in ScaledUnit.{to|from}Base have been removed:
// TODO assert(isClose(cos(180*degree), -1));

assert(isClose(sin(0.0*radian), 0));
assert(isClose(sin(PI*radian), 0));
assert(isClose(sin(2*PI*radian), 0));
// TODO enable when cast in ScaledUnit.{to|from}Base have been removed:
// TODO assert(isClose(sin(360*degree), 0));
assert(isClose(sin(PI*radian), 0));

// assert(isClose(expi(0.0*radian)!0.toValue, 0));

Meta