Jump to page: 1 26  
Page
Thread overview
std.rational?
Sep 25, 2013
H. S. Teoh
Sep 25, 2013
ponce
Sep 25, 2013
ponce
Sep 26, 2013
bearophile
Sep 27, 2013
Walter Bright
Sep 27, 2013
Dicebot
Sep 27, 2013
Dmitry Olshansky
Sep 27, 2013
BLM768
Sep 27, 2013
Walter Bright
Sep 28, 2013
eles
Sep 28, 2013
eles
Sep 28, 2013
MrSmith
Sep 29, 2013
MrSmith
Sep 29, 2013
MrSmith
Sep 29, 2013
John Colvin
Sep 29, 2013
John Colvin
Sep 29, 2013
H. S. Teoh
Sep 30, 2013
bearophile
Oct 01, 2013
ilya-stromberg
Oct 01, 2013
ilya-stromberg
Oct 01, 2013
H. S. Teoh
Sep 27, 2013
Walter Bright
Sep 28, 2013
Dmitry Olshansky
Sep 29, 2013
John Colvin
Sep 29, 2013
Andrej Mitrovic
Sep 29, 2013
John Colvin
Sep 30, 2013
Andrej Mitrovic
Sep 29, 2013
Walter Bright
Sep 30, 2013
MrSmith
Sep 27, 2013
H. S. Teoh
Sep 27, 2013
H. S. Teoh
September 25, 2013
Does anybody happen to have a working rational number library in D? Any plans to add that to Phobos at some point?

Just wondering, because I'm working on some numerical code that would benefit from a custom number type that could be implemented in terms of rational numbers. I just don't feel like reinventing a rational library if one already exists. :)


T

-- 
GEEK = Gatherer of Extremely Enlightening Knowledge
September 25, 2013
On Wednesday, 25 September 2013 at 16:59:15 UTC, H. S. Teoh wrote:
> Does anybody happen to have a working rational number library in D?

https://github.com/p0nce/gfm/blob/master/gfm/math/fraction.d

disclaimer: I've never used it for anything except writing its unittest block.
September 25, 2013
On Wednesday, 25 September 2013 at 17:15:25 UTC, ponce wrote:
> On Wednesday, 25 September 2013 at 16:59:15 UTC, H. S. Teoh wrote:
>> Does anybody happen to have a working rational number library in D?

Also David Simcha wrote a better one: https://github.com/dsimcha/Rational/blob/master/rational.d
September 26, 2013
On 25/09/13 19:21, ponce wrote:
> On Wednesday, 25 September 2013 at 17:15:25 UTC, ponce wrote:
>> On Wednesday, 25 September 2013 at 16:59:15 UTC, H. S. Teoh wrote:
>>> Does anybody happen to have a working rational number library in D?
>
> Also David Simcha wrote a better one:
> https://github.com/dsimcha/Rational/blob/master/rational.d

Why was this never incorporated into Phobos?
September 26, 2013
Joseph Rushton Wakeling:

> Why was this never incorporated into Phobos?

First it needs the normal review process for Phobos modules :) It should go in the review queue, if it's good enough for Phobos.

> Rational!(BigInt) getTerm(int termNumber) {

I suggest to add inside that "rational.d" module an alias with Bigint, as:

alias Fraction = Rational!BigInt;

Because I don't think I want to use a rational type made with built-in integrals.

Bye,
bearophile
September 26, 2013
On 26/09/13 16:09, bearophile wrote:
> First it needs the normal review process for Phobos modules :) It should go in
> the review queue, if it's good enough for Phobos.

Fair enough, I was wondering if there was any reason David never submitted it.

> I suggest to add inside that "rational.d" module an alias with Bigint, as:
>
> alias Fraction = Rational!BigInt;
>
> Because I don't think I want to use a rational type made with built-in integrals.

Good call.

September 26, 2013
On 9/26/13 7:00 AM, Joseph Rushton Wakeling wrote:
> On 25/09/13 19:21, ponce wrote:
>> On Wednesday, 25 September 2013 at 17:15:25 UTC, ponce wrote:
>>> On Wednesday, 25 September 2013 at 16:59:15 UTC, H. S. Teoh wrote:
>>>> Does anybody happen to have a working rational number library in D?
>>
>> Also David Simcha wrote a better one:
>> https://github.com/dsimcha/Rational/blob/master/rational.d
>
> Why was this never incorporated into Phobos?

Probably because it wasn't proposed for review. I'm favorable to integrating it.

Andrei
September 27, 2013
On Thu, Sep 26, 2013 at 04:50:47PM -0700, Andrei Alexandrescu wrote:
> On 9/26/13 7:00 AM, Joseph Rushton Wakeling wrote:
> >On 25/09/13 19:21, ponce wrote:
> >>On Wednesday, 25 September 2013 at 17:15:25 UTC, ponce wrote:
> >>>On Wednesday, 25 September 2013 at 16:59:15 UTC, H. S. Teoh wrote:
> >>>>Does anybody happen to have a working rational number library in D?
> >>
> >>Also David Simcha wrote a better one: https://github.com/dsimcha/Rational/blob/master/rational.d
> >
> >Why was this never incorporated into Phobos?
> 
> Probably because it wasn't proposed for review. I'm favorable to integrating it.
[...]

Me too.


T

-- 
2+2=4. 2*2=4. 2^2=4. Therefore, +, *, and ^ are the same operation.
September 27, 2013
On 9/26/2013 12:49 PM, Joseph Rushton Wakeling wrote:
> On 26/09/13 16:09, bearophile wrote:
>> First it needs the normal review process for Phobos modules :) It should go in
>> the review queue, if it's good enough for Phobos.
>
> Fair enough, I was wondering if there was any reason David never submitted it.

For things to happen, usually a self-appointed champion is needed that will relentless push it forward. Things tend to fall by the wayside otherwise.

September 27, 2013
On 27/09/13 09:36, Walter Bright wrote:
> For things to happen, usually a self-appointed champion is needed that will
> relentless push it forward. Things tend to fall by the wayside otherwise.

In the past David has seemed like a pretty reliable champion of his own work -- quite a few of the parts of Phobos I use regularly are down to him!

I've written to him asking for his input on std.rational but if he doesn't have time/inclination to pursue it, I'll take a look at it.

At first glance what's there looks pretty good with the main issues being stylistic rather than content-related.
« First   ‹ Prev
1 2 3 4 5 6