Re: NaN semantics

2001-10-12 Thread Mark
Nicholas Clark <[EMAIL PROTECTED]> wrote: > I had a think about this a few days ago. I can't see how to do fractions > in Roman Numerals. > integers and exponents in E notation should all be easy, shouldn't they? No major problem for fractions. As for irrational numbers... Mark.

Re: NaN semantics

2001-10-11 Thread David Nicol
RaFaL Pocztarski wrote: > I haven't got any contact with NaN before, but when Tim pointed that > NaN!=NaN is true in IEEE I thought that it does make sense. I see pros > and cons and it's not so ugly and non-intuitive as it can look. When > comparing $a and $b as numbers there is no need for $a==

Re: NaN semantics

2001-10-11 Thread RaFaL Pocztarski
David Nicol wrote: > RaFaL Pocztarski wrote: > > Or maybe NaN evaluates to 'NaN' in string context and > > +$x eq 'NaN' (or +$x eq NaN) could be used? NaN==NaN being false is in > > fact very intuitive for me, as NaN is something without any numerical > > meaning, so numerically compared to anyt

RE: NaN semantics

2001-10-10 Thread David Whipp
> > > First this thread tells me that "123foo" will be 123 in numeric > > > context. Now I find myself wondering what "123indigo" evaluates > > > to! > > > > It would evaluate to 123. If "use complex" is in effect, it would > > evaluate to 123i. At least that's the position I'm taking at the > >

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Buddha Buck wrote: > As someone else pointed out, the "e" notation is good for powers of > 10. How about a corresponding "b" notation for binary > exponents? 4_294_967_296 == 4b30? I really like that idea, it makes the floating point (scientific?) notation symmetric and consistent with X/Xi SI

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
David Whipp wrote: > > So the imaginary numbers would be standard literals? Like > > > > $x=2+10i; > > > > Great idea, as well as sqrt(-1) returning 1i istead of raising the > > exception. BTW, I was thinking once that numeral literals > > like 4k or 10G > > (meaning 4*2**10, 10*2**30) would

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Jonathan Scott Duff wrote: > On Wed, Oct 10, 2001 at 10:21:38AM -0700, David Whipp wrote: > > First this thread tells me that "123foo" will be 123 in numeric > > context. Now I find myself wondering what "123indigo" evaluates > > to! > > It would evaluate to 123. If "use complex" is in effect, i

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Glenn Linderman wrote: > An excellant idea. I was unaware of that standard, but was trying to head that > direction in my last posting. > > Someone thought it wouldn't work with imaginary numbers, but there actually is > no ambiguity if the imaginary i must immediately follow the number, and the

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 10:21:38AM -0700, David Whipp wrote: > First this thread tells me that "123foo" will be 123 in numeric > context. Now I find myself wondering what "123indigo" evaluates > to! It would evaluate to 123. If "use complex" is in effect, it would evaluate to 123i. At least tha

Re: prefix-postfix [was Re: NaN semantics]

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 06:28:42PM +0200, raptorVD wrote: > U mean something like 'term' (or how this thing is called 'bareword' ? ) > So I can say : > # $x = 10k; > my sub operator:number is postfix(k) ($num) { > return $num * 1000 > } I think that would be sub operator:K is postfi

prefix-postfix [was Re: NaN semantics]

2001-10-10 Thread raptorVD
U mean something like 'term' (or how this thing is called 'bareword' ? ) So I can say : # $x = 10k; my sub operator:number is postfix(k) ($num) { return $num * 1000 } # $x = 10K; my sub operator:number is postfix(K) ($num) { return $num * 1024 } #u can say later print $x if $x?; :

RE: NaN semantics

2001-10-10 Thread David Whipp
> So the imaginary numbers would be standard literals? Like > > $x=2+10i; > > Great idea, as well as sqrt(-1) returning 1i istead of raising the > exception. BTW, I was thinking once that numeral literals > like 4k or 10G > (meaning 4*2**10, 10*2**30) would be very nice. What do you think?

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 07:01 PM 10/10/2001 +0200, Bart Lateur wrote: >On Wed, 10 Oct 2001 11:52:16 -0400, Dan Sugalski wrote: > > >>If people want base 10, let them use "e" syntax. > >> > >>1e3 = 1000 > >>1k = 1024 > > > >I'll leave that for Larry to decide. I'm just thinking of all the 60G hard > >drives I see at Be

Re: NaN semantics

2001-10-10 Thread Michel Rodriguez
On Wed, 2001-10-10 at 17:32, Dan Sugalski wrote: > At 05:12 PM 10/10/2001 +0200, RaFaL Pocztarski wrote: > > >BTW, I was thinking once that numeral literals like 4k or 10G > >(meaning 4*2**10, 10*2**30) would be very nice. What do you think? > > I think the meaning of the suffices are sufficient

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 06:38:05PM +0200, RaFaL Pocztarski wrote: > I prefer powers of 1024 because it help a lot more than powers of 1000. > But if you think that the ambiguity is the only problem then use kbin; / > use kdec; or use k1000; / use k1024; pragmas could solve it. $K = 2**10;

Re: NaN semantics

2001-10-10 Thread Bart Lateur
On Wed, 10 Oct 2001 11:52:16 -0400, Dan Sugalski wrote: >>If people want base 10, let them use "e" syntax. >> >>1e3 = 1000 >>1k = 1024 > >I'll leave that for Larry to decide. I'm just thinking of all the 60G hard >drives I see at Best Buy that are really 60e9 bytes, and the 1K ohm >resistors th

Re: NaN semantics

2001-10-10 Thread Glenn Linderman
Trond Michelsen wrote: > There's always the possibility of supporting SI's binary prefixes ;) > > http://physics.nist.gov/cuu/Units/binary.html An excellant idea. I was unaware of that standard, but was trying to head that direction in my last posting. Someone thought it wouldn't work with ima

Re: NaN semantics

2001-10-10 Thread Glenn Linderman
Dan Sugalski wrote: > At 04:42 PM 10/10/2001 +0100, Sam Vilain wrote: > >On Wed, 10 Oct 2001 11:32:02 -0400 > >Dan Sugalski <[EMAIL PROTECTED]> wrote: > > > > > >Great idea, as well as sqrt(-1) returning 1i istead of raising the > > > >exception. > > > If we do them, yep. Currently no promises th

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Dan Sugalski wrote: > I'll leave that for Larry to decide. I'm just thinking of all the 60G hard > drives I see at Best Buy that are really 60e9 bytes, and the 1K ohm > resistors that are really 1000 ohms. (Well, give or take a bit for ambient > temperature...) I prefer powers of 1024 because it

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Trond Michelsen wrote: > >> BTW, I was thinking once that numeral literals like 4k or 10G > >> (meaning 4*2**10, 10*2**30) would be very nice. What do you think? > > I think the meaning of the suffices are sufficiently vague as to make me > > uncomfortable supporting them. Is 1K 1024 or 1000? I c

Re: NaN semantics

2001-10-10 Thread Aaron Sherman
On Wed, Oct 10, 2001 at 06:20:31PM +0200, Trond Michelsen wrote: > >> BTW, I was thinking once that numeral literals like 4k or 10G > >> (meaning 4*2**10, 10*2**30) would be very nice. What do you think? > > I think the meaning of the suffices are sufficiently vague as to make me > > uncomfortabl

Re: NaN semantics

2001-10-10 Thread Jonathan Scott Duff
On Wed, Oct 10, 2001 at 05:21:02PM +0200, raptor wrote: > | So the imaginary numbers would be standard literals? Like > | > | $x=2+10i; > | > | Great idea, as well as sqrt(-1) returning 1i istead of raising the > | exception. BTW, I was thinking once that numeral literals like 4k or 10G > | (m

Re: NaN semantics

2001-10-10 Thread Trond Michelsen
>> BTW, I was thinking once that numeral literals like 4k or 10G >> (meaning 4*2**10, 10*2**30) would be very nice. What do you think? > I think the meaning of the suffices are sufficiently vague as to make me > uncomfortable supporting them. Is 1K 1024 or 1000? I can make a good case > for both

Re: NaN semantics

2001-10-10 Thread raptor
| So the imaginary numbers would be standard literals? Like | | $x=2+10i; | | Great idea, as well as sqrt(-1) returning 1i istead of raising the | exception. BTW, I was thinking once that numeral literals like 4k or 10G | (meaning 4*2**10, 10*2**30) would be very nice. What do you think? I li

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 04:42 PM 10/10/2001 +0100, Sam Vilain wrote: >On Wed, 10 Oct 2001 11:32:02 -0400 >Dan Sugalski <[EMAIL PROTECTED]> wrote: > > > >Great idea, as well as sqrt(-1) returning 1i istead of raising the > > >exception. > > If we do them, yep. Currently no promises there. > >If you do that, make sure i

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Dan Sugalski wrote: > At 05:12 PM 10/10/2001 +0200, RaFaL Pocztarski wrote: > > >BTW, I was thinking once that numeral literals like 4k or 10G > >(meaning 4*2**10, 10*2**30) would be very nice. What do you think? > > I think the meaning of the suffices are sufficiently vague as to make me > uncom

Re: NaN semantics

2001-10-10 Thread Sam Vilain
On Wed, 10 Oct 2001 11:32:02 -0400 Dan Sugalski <[EMAIL PROTECTED]> wrote: > >Great idea, as well as sqrt(-1) returning 1i istead of raising the > >exception. > If we do them, yep. Currently no promises there. If you do that, make sure it has to be enabled with a pragma. Having complex numbers

Re: NaN semantics

2001-10-10 Thread Dan Sugalski
At 05:12 PM 10/10/2001 +0200, RaFaL Pocztarski wrote: >Dan Sugalski wrote: > > > At 08:37 AM 10/9/2001 -0700, Brent Dax wrote: > > >For consistency, I'd prefer to use is: 3+(2 is i). > > > > Well, the convention is suffixing an imaginary number with an i. I don't > > think we'd be too well served

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
Dan Sugalski wrote: > At 08:37 AM 10/9/2001 -0700, Brent Dax wrote: > >For consistency, I'd prefer to use is: 3+(2 is i). > > Well, the convention is suffixing an imaginary number with an i. I don't > think we'd be too well served to go a different route. So the imaginary numbers would be standa

Re: NaN semantics

2001-10-10 Thread RaFaL Pocztarski
the lack of any numerical meaning. I don't think that the one idea is more correct than another, maybe that's the matter of taste, however they are mutually exclusive, so one of them has to be chosen. I joined this thread, because I thought that assuming that NaN!=NaN idea is just ugly

Re: NaN semantics

2001-10-09 Thread Damian Conway
Tim suggested: > How about punting by using nan (all lowercase) > as a boolean logic not-a-number, leaving NaN > for someone to (later) create an IEEE style > tristate not-a-number. Err, I think not. Having C and C that differ so markedly in behaviour is probably a Recipe For Disast

Re: NaN semantics

2001-10-09 Thread Damian Conway
Tim suggested: > I *like* the proposed Perl6 semantics; it's DWIMier. The problem is > just the name collision. Why not 'inval' (for invalid), or some > such (badval?). This would preserve NaN in its IEEE sense for the > numerical algorithm crew to use. And thus we circle back towa

RE: NaN semantics

2001-10-09 Thread Damian Conway
Dave observed: > > but I still have immense difficulty with the notion that: > > > > $x == NaN > > > > doesn't return true if $x contains NaN. > > Anyone with a hardware background should have no difficulty with > this concept. Yep. You, me, and the (comparati

Re: NaN semantics

2001-10-09 Thread Damian Conway
Nicholas wrote: > I had a think about this a few days ago. I can't see how to do fractions > in Roman Numerals. Take a look at how Lingua::Romana::Perligata (and, incidentally, the ancient Romans) did it. Damianus

Re: NaN semantics

2001-10-09 Thread Me
A quarter-baked idea: How about punting by using nan (all lowercase) as a boolean logic not-a-number, leaving NaN for someone to (later) create an IEEE style tristate not-a-number. Later: $foo == NaN; # NaN literal is not same as nan literal use NaN; NaN(expr);

Re: NaN semantics

2001-10-09 Thread Tim Conrow
Damian Conway wrote: > > Sigh. I *do* see your point of view (Laziness), but I still have immense > difficulty with the notion that: > > $x == NaN > > doesn't return true if $x contains NaN. I *like* the proposed Perl6 semantics; it's DWIMier. The problem is just the name collision. Wh

RE: NaN semantics

2001-10-09 Thread David Whipp
Damian Conway wrote: > but I still have immense difficulty with the notion that: > > $x == NaN > > doesn't return true if $x contains NaN. Anyone with a hardware background should have no difficulty with this concept. All common HDLs have multi-valued logic systems, including values li

RE: NaN semantics

2001-10-09 Thread Dan Sugalski
At 08:37 AM 10/9/2001 -0700, Brent Dax wrote: >Jonathan Scott Duff ># On Tue, Oct 09, 2001 at 10:17:26AM -0400, Dan Sugalski wrote: ># > Depending on what Larry's planning, we may weld in support ># for imaginary ># > numbers. While they're mind-warping, in some ways they're ># better than ># > ha

RE: NaN semantics

2001-10-09 Thread Brent Dax
Jonathan Scott Duff # On Tue, Oct 09, 2001 at 10:17:26AM -0400, Dan Sugalski wrote: # > Depending on what Larry's planning, we may weld in support # for imaginary # > numbers. While they're mind-warping, in some ways they're # better than # > having a line labeled "Beyond here be dragons" or somet

Re: NaN semantics

2001-10-09 Thread Dan Sugalski
At 09:33 AM 10/9/2001 -0500, Jonathan Scott Duff wrote: >On Tue, Oct 09, 2001 at 10:17:26AM -0400, Dan Sugalski wrote: > > Depending on what Larry's planning, we may weld in support for imaginary > > numbers. While they're mind-warping, in some ways they're better than > > having a line labeled "B

Re: NaN semantics

2001-10-09 Thread Jonathan Scott Duff
On Tue, Oct 09, 2001 at 10:17:26AM -0400, Dan Sugalski wrote: > Depending on what Larry's planning, we may weld in support for imaginary > numbers. While they're mind-warping, in some ways they're better than > having a line labeled "Beyond here be dragons" or something. Neat. It'd be nice to h

RE: NaN semantics

2001-10-09 Thread Dan Sugalski
At 05:29 AM 10/9/2001 -0500, [EMAIL PROTECTED] wrote: >Piers Cawley [mailto:[EMAIL PROTECTED]] on 9 October 2001 09:02 wrote: > > But there are going to be problems in some cases if we change the > > behaviour of NaN to the perl semantics. There are cases where the IEEE > > behaviour is *useful* d

Re: NaN semantics

2001-10-09 Thread Randal L. Schwartz
> "Damian" == Damian Conway <[EMAIL PROTECTED]> writes: Damian> Sigh. I *do* see your point of view (Laziness), but I still have immense Damian> difficulty with the notion that: Damian> $x == NaN Damian> doesn't return true if $x contains NaN. Just think of it as a quantum number t

Re: NaN semantics

2001-10-09 Thread Graham Barr
On Tue, Oct 09, 2001 at 04:39:47PM +1000, Damian Conway wrote: > Sigh. I *do* see your point of view (Laziness), but I still have immense > difficulty with the notion that: > > $x == NaN > > doesn't return true if $x contains NaN. I agree. The difficulty I have is that it is the compari

RE: NaN semantics

2001-10-09 Thread Richard_Cox
Piers Cawley [mailto:[EMAIL PROTECTED]] on 9 October 2001 09:02 wrote: > But there are going to be problems in some cases if we change the > behaviour of NaN to the perl semantics. There are cases where the IEEE > behaviour is *useful* dammit. Indeed, we certainly don't want sqrt(-1) == sqrt(-2)

Re: NaN semantics

2001-10-09 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > >> But I assume that == means numerically equal (and here I could be > >> wrong). If what I assume is true however, then anything which > doesn't > >> have any numerical meaning, numerically compared to anything > (even to > >> itse

Re: NaN semantics

2001-10-08 Thread Damian Conway
> But I assume that == means numerically equal (and here I could be > wrong). If what I assume is true however, then anything which doesn't > have any numerical meaning, numerically compared to anything (even to > itself) should not return the misleading result that the two compared

Re: NaN semantics

2001-10-08 Thread RaFaL Pocztarski
Dan Sugalski wrote: > At 09:07 AM 10/8/2001 +1000, Damian Conway wrote: > >I see your (and others') point here, but I view NaN as a *marker* indicating > >a non-numeric result. Markers should always compare equal to themselves. > >(Frankly, *everything* should compare equal to itself -- which is

Re: NaN semantics

2001-10-08 Thread Dan Sugalski
At 09:07 AM 10/8/2001 +1000, Damian Conway wrote: >I see your (and others') point here, but I view NaN as a *marker* indicating >a non-numeric result. Markers should always compare equal to themselves. >(Frankly, *everything* should compare equal to itself -- which is where >IEEE 754 goes horribly

Re: NaN semantics

2001-10-08 Thread RaFaL Pocztarski
Damian Conway wrote: > RaFaL asked: > >> So OK, tell me if I get it right, and how (and why) it will look in Perl >> 6. From Exegesis I see that NaN==NaN, but that's not stated in >> Apocalypse (or I just missed it). > > No, it's not stated there. But I hope that Perl 6 will follow th

Re: NaN semantics

2001-10-07 Thread Damian Conway
> > Let me make it clear: AFAIK Perl NaN's will not be IEEE 754 > > compliant. That was certainly my intention in suggesting them to > > Larry. I share the view of a number of other language designers that > > the non-self-identity of IEEE NaN is (to slightly misquote Tim) > > "ug

Re: NaN semantics

2001-10-07 Thread Damian Conway
RaFaL asked: > So OK, tell me if I get it right, and how (and why) it will look in Perl > 6. From Exegesis I see that NaN==NaN, but that's not stated in > Apocalypse (or I just missed it). No, it's not stated there. But I hope that Perl 6 will follow the lead of other high level langu

Re: NaN semantics

2001-10-07 Thread Damian Conway
Tim wrote: > > Err. Are you *sure*? That's an C, not a C, you realize? > > Yes. I had to use all my fingers and toes to keep everything straight, > but I think I did. :-) In the semantics you show (different from IEEE > semantics) "NaN==NaN" is true, so "NaN!=NaN" is false, whic

Re: NaN semantics

2001-10-07 Thread Piers Cawley
Damian Conway <[EMAIL PROTECTED]> writes: > >> His point was that the NaN IEEE came up with is defined to have >> NaN != NaN, and that it might be confusing if Perl's behavior >> wasn't consistent with that. Not that I think NaN != NaN is a >> particularly good idea, but consist

RE: NaN semantics

2001-10-07 Thread Damian Conway
> His point was that the NaN IEEE came up with is defined to have NaN != > NaN, and that it might be confusing if Perl's behavior wasn't consistent > with that. Not that I think NaN != NaN is a particularly good idea, but > consistency with other languages may be. If NaN != NaN, th

Re: NaN semantics

2001-10-07 Thread RaFaL Pocztarski
John Siracusa wrote: > On 10/7/01 4:19 PM, RaFaL Pocztarski wrote: > > I was very surprised when I saw the negative feedback on Slashdot > > Heh, did you just discover Slashdot recently? ;) Well, maybe I was so excited about everything I read about Perl 6 that I thought everyone will share my en

Re: NaN semantics

2001-10-07 Thread John Siracusa
On 10/7/01 4:19 PM, RaFaL Pocztarski wrote: > I was very surprised when I saw the negative feedback on Slashdot Heh, did you just discover Slashdot recently? ;) -John

Re: NaN semantics

2001-10-07 Thread RaFaL Pocztarski
Tim Conrow wrote: > Damian Conway said: >> > > print "Inflation rate: " and $inflation = +<> >> > > until $inflation != NaN; >> > >> > This requires that C be false, causing the loop to >> > continue until a valid numeric string is entered. >

Re: NaN semantics

2001-10-07 Thread Tim Conrow
Damian Conway said: > > > print "Inflation rate: " and $inflation = +<> > > > until $inflation != NaN; > > > > This requires that C be false, causing the loop to continue > > until a valid numeric string is entered. > Err. Are you *sure*? That's a

RE: NaN semantics

2001-10-07 Thread Brent Dax
Damian Conway: #> The example can be rewritten #> #>print "Inflation rate: " and $inflation = +<> #> while $inflation != $inflation; # # Err. No it can't. His point was that the NaN IEEE came up with is defined to have NaN != NaN, and that it m

Re: NaN semantics

2001-10-07 Thread Damian Conway
> Semantic confusion alert! Aroogha! Aroogha! All crew to clarification stations! > EX3 (great document!) Thank-you. > sez: > > > print "Inflation rate: " and $inflation = +<> > > until $inflation != NaN; > > This requires that

NaN semantics

2001-10-06 Thread Tim Conrow
Semantic confusion alert! EX3 (great document!) sez: > print "Inflation rate: " and $inflation = +<> > until $inflation != NaN; This requires that C be false, causing the loop to continue until a valid numeric string is entered. For I