September 28, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | 28-Sep-2013 15:11, Joseph Rushton Wakeling пишет: > On 27/09/13 20:20, Walter Bright wrote: >> On 9/27/2013 6:47 AM, Joseph Rushton Wakeling wrote: >>> [...] >> >> Sounds like we have a new champion! Thanks, Joseph! > > I feel more like a cheerleader than a champion -- David did all the hard > work! ;-) Which is a good thing. There is some much of hard work done on D libraries that is just piled up in the dusty corner, including Phobos candidates. -- Dmitry Olshansky |
September 28, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | On Friday, 27 September 2013 at 22:20:42 UTC, Walter Bright wrote:
> On 9/27/2013 1:25 PM, Andrei Alexandrescu wrote:
>> No aliases please.
>
> I agree. Aliases are not a solution to bikeshedding about names and inability to reach a consensus.
what about std.uni => std.unicode?
|
September 28, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Saturday, 28 September 2013 at 11:16:03 UTC, Joseph Rushton Wakeling wrote:
> On 27/09/13 17:36, Dmitry Olshansky wrote:
>> I bet the reason is practicality: try using full names of
>> denominator/numerator in some involved numeric code. It's a mess.
up/down?
above/below?
hi/lo?
|
September 28, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to eles | This code fails: rational(0, 1) * rational(1, 1); object.Error: Integer Divide by Zero ---------------- 0x00408228 in int std.rational.gcf!(int, int).gcf(int, int) at C:\rational\rational.d(878) 0x0040820A in int std.rational.gcf!(int, int).gcf(int, int) at C:\rational\rational.d(870) 0x004082E7 in std.rational.Rational!(int).Rational std.rational.Rational!(int).Rational.opOpAssign!("*", std.rational.Rational!(int).Rational).opOpAssign(std.rational.Rational!(int).Rational) at C:\rational\rational.d(235) 0x004087C3 in std.rational.Rational!(int).Rational std.rational.Rational!(int).Rational.opBinary!("*", std.rational.Rational!(int).Rational).opBinary(std.rational.Rational!(int).Rational) at C:\rational\rational.d(218) 0x0040880C in _Dmain at C:\rational\test.d(8) 0x0040C7EC in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runMain() 0x0040C827 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int function(char[][])*).void runAll() 0x0040C425 in _d_run_main 0x0040A064 in main 0x769C33AA in BaseThreadInitThunk 0x77C19EF2 in RtlInitializeExceptionChain 0x77C19EC5 in RtlInitializeExceptionChain ---------------- It seems to me like gcf is not properly implemented. Also why its name is gcf (greatest common factor) and not gcd (greatest common divisor)? |
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith | On 28/09/13 15:56, MrSmith wrote:
> This code fails:
>
> rational(0, 1) * rational(1, 1);
>
>
> object.Error: Integer Divide by Zero
> ----------------
> 0x00408228 in int std.rational.gcf!(int, int).gcf(int, int) at
> C:\rational\rational.d(878)
> 0x0040820A in int std.rational.gcf!(int, int).gcf(int, int) at
> C:\rational\rational.d(870)
> 0x004082E7 in std.rational.Rational!(int).Rational
> std.rational.Rational!(int).Rational.opOpAssign!("*",
> std.rational.Rational!(int).Rational).opOpAssign(std.rational.Rational!(int).Rational)
> at C:\rational\rational.d(235)
> 0x004087C3 in std.rational.Rational!(int).Rational
> std.rational.Rational!(int).Rational.opBinary!("*",
> std.rational.Rational!(int).Rational).opBinary(std.rational.Rational!(int).Rational)
> at C:\rational\rational.d(218)
> 0x0040880C in _Dmain at C:\rational\test.d(8)
> 0x0040C7EC in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
> function(char[][])*).void runMain()
> 0x0040C827 in extern (C) int rt.dmain2._d_run_main(int, char**, extern (C) int
> function(char[][])*).void runAll()
> 0x0040C425 in _d_run_main
> 0x0040A064 in main
> 0x769C33AA in BaseThreadInitThunk
> 0x77C19EF2 in RtlInitializeExceptionChain
> 0x77C19EC5 in RtlInitializeExceptionChain
> ----------------
>
> It seems to me like gcf is not properly implemented. Also why its name is gcf
> (greatest common factor) and not gcd (greatest common divisor)?
Good catch, thank you!
What compiler and options are you using to get that detailed error report? With dmd -main -unittest -debug rational.d I get only: "Floating point exception (core dumped)". (Albeit I'm on Linux not Windows, I guess that might make a difference.)
|
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Saturday, 28 September 2013 at 11:29:25 UTC, Dmitry Olshansky wrote:
> 28-Sep-2013 15:11, Joseph Rushton Wakeling пишет:
>> On 27/09/13 20:20, Walter Bright wrote:
>>> On 9/27/2013 6:47 AM, Joseph Rushton Wakeling wrote:
>>>> [...]
>>>
>>> Sounds like we have a new champion! Thanks, Joseph!
>>
>> I feel more like a cheerleader than a champion -- David did all the hard
>> work! ;-)
>
> Which is a good thing. There is some much of hard work done on D libraries that is just piled up in the dusty corner, including Phobos candidates.
There is a lot of this. Many of them are recoverable: it never seems to take me long to grok someone work in D compared to many other languages, overall the abstractions tend to be natural and intuitive.
|
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | use -debug -gc |
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to MrSmith | On 29/09/13 16:46, MrSmith wrote:
> use -debug -gc
Nope, I still get just the "floating point exception" message.
|
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On Saturday, 28 September 2013 at 11:11:33 UTC, Joseph Rushton Wakeling wrote:
> On 27/09/13 20:20, Walter Bright wrote:
>> On 9/27/2013 6:47 AM, Joseph Rushton Wakeling wrote:
>>> [...]
>>
>> Sounds like we have a new champion! Thanks, Joseph!
>
> I feel more like a cheerleader than a champion -- David did all the hard work! ;-)
Slightly bad news -- today I slipped and fell quite heavily on my right shoulder. The hospital tells me there's nothing wrong that a couple of days' ice + painkillers won't fix, but proper two-handed typing is a bit painful in the meantime, so it'll probably be a few days before I get onto this.
I wish I could say that I fell while doing cheerleading somersaults, but alas it was nothing so cool -- a wet paving-stone on a rainy day ... :-P
|
September 29, 2013 Re: std.rational? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Joseph Rushton Wakeling | On 9/28/2013 4:11 AM, Joseph Rushton Wakeling wrote:
> On 27/09/13 20:20, Walter Bright wrote:
>> On 9/27/2013 6:47 AM, Joseph Rushton Wakeling wrote:
>>> [...]
>>
>> Sounds like we have a new champion! Thanks, Joseph!
>
> I feel more like a cheerleader than a champion -- David did all the hard work! ;-)
The champion isn't always the same as the person who does the hardest work on it.
|
Copyright © 1999-2021 by the D Language Foundation