RE: Hugs Humor

2003-07-17 Thread Simon Marlow
Jerzy Karczmarczuk writes: > I am abhorred by the fact that adding ... :: Rational > changes the lexical meaning of a literal. It doesn't. A literal with a decimal point always means (fromRational (X%Y)) for some appropriate X and Y. Adding a type signature changes the dynamic meaning of the

Re: Hugs Humor

2003-07-08 Thread Andrew J Bromage
G'day all. On Tue, Jul 08, 2003 at 01:06:23PM +0100, Jon Fairbairn wrote: > Unfortunately we don't have Real (in > libraries as far as I remember -- if you have a continued > fraction implementation of it, it ought to go to the > libraries list). Not one, but TWO implementations! One using cont

Re: Hugs Humor

2003-07-08 Thread Derek Elkins
On Tue, 08 Jul 2003 13:06:23 +0100 Jon Fairbairn <[EMAIL PROTECTED]> wrote: > On 2003-07-08 at 10:15+0200 Jerzy Karczmarczuk wrote: > > > If it's a _Rational_, surely you want it to be exactly the > > > same as you get for 31415926536%100? > > > > No. If 'you' means concretely me, then

Re: Hugs Humor

2003-07-08 Thread Jon Fairbairn
On 2003-07-08 at 10:15+0200 Jerzy Karczmarczuk wrote: > > If it's a _Rational_, surely you want it to be exactly the > > same as you get for 31415926536%100? > > No. If 'you' means concretely me, then no. Simply no. > Writing > pi = 3.1415926536 :: Rational > > and expecting to continue

Re: Hugs Humor

2003-07-08 Thread Jerzy Karczmarczuk
Andrew J Bromage wrote: On Mon, Jul 07, 2003 at 12:01:09PM +0200, Jerzy Karczmarczuk wrote: I don't understand the remark that the internal arithmetic is binary. Sure, it is, so what? The reason is that you can get the Rational representation even faster than using continued fractions. :-)

Re: Hugs Humor

2003-07-07 Thread Andrew J Bromage
G'day all. On Mon, Jul 07, 2003 at 12:01:09PM +0200, Jerzy Karczmarczuk wrote: > I don't understand the remark that the internal arithmetic is > binary. Sure, it is, so what? The reason is that you can get the Rational representation even faster than using continued fractions. :-) toFrac ::

Re: Hugs Humor

2003-07-07 Thread Jon Fairbairn
On 2003-07-07 at 13:40+0200 Jerzy Karczmarczuk wrote: > [...] I believe (still naïvely??) that those socio-psycho-pragmatisms > which played some role in the definition of the language should > be better tuned. If I were to write > > pi = 3.1415926536 :: Rational > > I suppose that I would like t

Re: Hugs Humor

2003-07-07 Thread Jerzy Karczmarczuk
Ross Paterson wrote: In the case of 0.1::Rational, it shouldn't be using floating point. The Report says this means fromRational (1%10), i.e. 1%10. Aha. Now I have a little chance to die less naïve. All my conversion proposals are simply out of place, since there should be nothing to convert. An

Re: Hugs Humor

2003-07-07 Thread Ross Paterson
On Mon, Jul 07, 2003 at 01:09:53PM +0200, Wolfgang Jeltsch wrote: > On Monday, 2003-07-07, 13:05, CEST, Ross Paterson wrote: > > In the case of 0.1::Rational, it shouldn't be using floating point. The > > Report says this means fromRational (1%10), i.e. 1%10. > > In which paragraph of the report i

Re: Hugs Humor

2003-07-07 Thread Wolfgang Jeltsch
On Monday, 2003-07-07, 13:05, CEST, Ross Paterson wrote: > [...] > In the case of 0.1::Rational, it shouldn't be using floating point. The > Report says this means fromRational (1%10), i.e. 1%10. In which paragraph of the report is this specified? > [...] Wolfgang _

Re: Hugs Humor

2003-07-07 Thread Ross Paterson
On Mon, Jul 07, 2003 at 12:01:09PM +0200, Jerzy Karczmarczuk wrote: > This is less a bug than a Nessie monster which haunts Hugs > some centuries already, and on Internet the issue has been > discussed at least 4 times. The old, experimental Gofer > Prelude numeric functions were sometimes abominab

Re: Hugs Humor

2003-07-07 Thread Jon Fairbairn
On 2003-07-07 at 12:01+0200 Jerzy Karczmarczuk wrote: > Jon Fairbairn comments //Steffen Mazanek//: > > >>Prelude> 0.1::Rational > >>13421773 % 134217728 > >>Prelude> 13421773/134217728 > >>0.1 > >> > >>I do not know how this fraction is calculated, but > >>it does not fit my expectations :-) > >

Re: Hugs Humor

2003-07-07 Thread Wolfgang Jeltsch
On Monday, 2003-07-07, 01:37, CEST, Andrew J Bromage wrote: > [...] > On Sat, Jul 05, 2003 at 07:43:18PM +0200, Steffen Mazanek wrote: > > Prelude> 0.1::Rational > > 13421773 % 134217728 > > That's allowed. The Rational only has to be correct to the limit of machine > precision. (Incidentally, i

Re: Hugs Humor

2003-07-07 Thread Jerzy Karczmarczuk
Jon Fairbairn comments //Steffen Mazanek//: Prelude> 0.1::Rational 13421773 % 134217728 Prelude> 13421773/134217728 0.1 I do not know how this fraction is calculated, but it does not fit my expectations :-) Remember that internally arithmetic is binary, and that 0.1 can't be expressed exactly as

Re: Hugs Humor

2003-07-06 Thread Andrew J Bromage
G'day all. On Sat, Jul 05, 2003 at 07:43:18PM +0200, Steffen Mazanek wrote: > Prelude> 0.1::Rational > 13421773 % 134217728 That's allowed. The Rational only has to be correct to the limit of machine precision. (Incidentally, if it's any help in working out how this Rational was computed, the

Re: Hugs Humor

2003-07-05 Thread Ross Paterson
On Sat, Jul 05, 2003 at 08:24:32PM +0100, Jon Fairbairn wrote: > On 2003-07-05 at 19:43+0200 Steffen Mazanek wrote: > > a quit funny hugs session: > > > > Prelude> 0.5::Rational > > 1 % 2 > > Prelude> 0.1::Rational > > 13421773 % 134217728 > > Prelude> 13421773/134217728 > > 0.1 > > > > I do not

Re: Hugs Humor

2003-07-05 Thread Jon Fairbairn
On 2003-07-05 at 19:43+0200 Steffen Mazanek wrote: > Hello, > > a quit funny hugs session: > > Prelude> 0.5::Rational > 1 % 2 > Prelude> 0.1::Rational > 13421773 % 134217728 > Prelude> 13421773/134217728 > 0.1 > > I do not know how this fraction is calculated, but > it does not fit my expectatio