RE: [flexcoders] Simple arithmetic - resolved

2005-04-19 Thread Gordon Smith

Math operations with normal numbers, such as 0/0 and Math.sqrt(-1), can also
produce NaN. 

According to the ECMA-262 spec, NaN is a Number, despite its name meaning
Not a Number:

4.3.20 Number Type
The type Number is a set of values representing numbers. In ECMAScript, the
set of values represents the double-precision 64-bit format IEEE 754 values
including the special Not-a-Number (NaN) values, positive infinity, and
negative infinity.

The concept of NaN dates back at least to the IEEE 754 specification for
binary floating-point arithmetic.

- Gordon


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 19, 2005 4:09 AM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Simple arithmetic - resolved



 Question - shouldn't this have thrown an error, since I was casting
the
 non-number variable as a number in the parameter statement, as 
 varX:Number?

Flash is not checking types runtime, only compile time. And compile time
everything is programmed right

trace(!isNaN(NaN));

NaN is kind of its own type and is usually the result of an equation
with a string or some other non-numeric type.


Greetz Erik


-Original Message-
From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of JesterXL
Sent: maandag 18 april 2005 21:53
To: flexcoders@yahoogroups.com
Subject: Re: [flexcoders] Simple arithmetic - resolved


A number is not a number?  wtf, lol!

trace(!isNaN(NaN)); // false

...crud, that means it is... but how can a number that's not a number be
a number?

I'm confused now...



 
Yahoo! Groups Links



 





 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Simple arithmetic - resolved

2005-04-18 Thread Tom Fitzpatrick

Solved - turns out I was applying a currency format to the variable before 
handing it to the function so it really was NaN.

Question - shouldn't this have thrown an error, since I was casting the 
non-number variable as a number in the parameter statement, as varX:Number?

- Tom

At 04:43 PM 4/17/2005, you wrote:
Manish and Abdul - Thanks. I'll keep looking...

- Tom

At 03:53 PM 4/17/2005, you wrote:
 I verified that the function returns correct values.  You have a
 problem somewhere else.






--
Yahoo! Groups Links
* To visit your group on the web, go to:
* 
 http://groups.yahoo.com/group/flexcoders/http://groups.yahoo.com/group/flexcoders/
  

*
* To unsubscribe from this group, send an email to:
* 
 mailto:[EMAIL PROTECTED][EMAIL PROTECTED] 

*
* Your use of Yahoo! Groups is subject to the 
 http://docs.yahoo.com/info/terms/Yahoo! Terms of Service.






 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Simple arithmetic - resolved

2005-04-18 Thread Manish Jethani

On 4/18/05, Tom Fitzpatrick [EMAIL PROTECTED] wrote:

 Solved - turns out I was applying a currency format to the variable before
 handing it to the function so it really was NaN.
 
 Question - shouldn't this have thrown an error, since I was casting the
 non-number variable as a number in the parameter statement, as varX:Number?

NaN is of type Number, AFAIK.

-- 
[EMAIL PROTECTED]
http://manish.revise.org/


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Simple arithmetic - resolved

2005-04-18 Thread JesterXL

A number is not a number?  wtf, lol!

trace(!isNaN(NaN)); // false

...crud, that means it is... but how can a number that's not a number be a 
number?

I'm confused now...

- Original Message - 
From: Manish Jethani [EMAIL PROTECTED]
To: flexcoders@yahoogroups.com
Sent: Monday, April 18, 2005 3:48 PM
Subject: Re: [flexcoders] Simple arithmetic - resolved



On 4/18/05, Tom Fitzpatrick [EMAIL PROTECTED] wrote:

 Solved - turns out I was applying a currency format to the variable before
 handing it to the function so it really was NaN.

 Question - shouldn't this have thrown an error, since I was casting the
 non-number variable as a number in the parameter statement, as 
 varX:Number?

NaN is of type Number, AFAIK.

-- 
[EMAIL PROTECTED]
http://manish.revise.org/



Yahoo! Groups Links








 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 





Re: [flexcoders] Simple arithmetic - resolved

2005-04-18 Thread Manish Jethani

On 4/19/05, JesterXL [EMAIL PROTECTED] wrote:

 A number is not a number?  wtf, lol!
 
 trace(!isNaN(NaN)); // false
 
 ...crud, that means it is... but how can a number that's not a number be a
 number?

Okay, I'll avoid getting into any language discussion by saying that I
really meant that NaN can be safely assigned to a Number reference
without a cast.

  var x:Number = NaN;

That may or may not mean that NaN is a Number.  Pick up a Colin Moock
book if you care to find out (I don't).  It can be said that NaN is to
Number as null is to Object (but I won't say it, because I already
did).

-- 
[EMAIL PROTECTED]
http://manish.revise.org/


 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/