RFC: Units of measurement for D (Phobos?)
Nordlöw via Digitalmars-d
digitalmars-d at puremagic.com
Wed Mar 16 15:16:20 PDT 2016
On Wednesday, 16 March 2016 at 17:46:39 UTC, David Nadlinger
wrote:
> Hi Per,
>
> Many thanks for working on the code! Could you put it up as a
> separate Dub package to make it easier for people to try out?
Ok, I'll do that in a couple of days. In the mean while could you
take a look at the overloads of sin, cos and tan in si.d. I just
want to start at something, IMHO, having type-safe handling of
angles in trigonometric functions would some projects more
correct.
This is cheap solution (used by many unit-libraries) uses a
floating-point-scaling of the radian unit. Which of course may
result in loss accuracy. A better approach to represent degrees
would of course be to use `ScaledUnit`. How should then sin, cos,
tan, expi be redesigned to support `ScaledUnit` aswell as
`Quantity`? Could you, please, highlight the basic idea here or
perhaps give a code.
Thanks in advance, David.
More information about the Digitalmars-d
mailing list