Rational numbers in D

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Jun 9 10:47:56 PDT 2012


On Saturday, 9 June 2012 at 01:11:49 UTC, Stewart Gordon wrote:
> Including it in D seems very unlikely.
>
> Including it in Phobos, OTOH, is another matter.

My bad phrasing.  Of course in Phobos.


On 09/06/12 08:25, SomeDude wrote:
> I've never had any use for rational numbers as have 99% of developers I believe.
> Maybe I'm overlooking something, but I see only two possible usages of them:
> math packages and length quotations in the english system. Because of this, I'd
> rather see them in Deimos than in Phobos.

In fact the application I had in mind was for music software, where you want to 
be able to store pitch changes in fractions of a whole tone.  In that context 
it's important that adding up those changes be guaranteed to produce exact results.

e.g. if you take middle C and raise it by 1 whole tone _exactly_ you arrive at 
the note D.  If you raise it by 0.99999999999999999999999999995 instead, how 
does your software reliably handle this?


More information about the Digitalmars-d mailing list