[Flashcoders] math simple operation

2007-01-27 Thread ntasky

Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread Hans Wichman

Hi,
multiply everything with 1000 before, and divide by 1000 after?:)
greetz
JC


On 1/27/07, ntasky [EMAIL PROTECTED] wrote:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread Zeh Fernando

 I'm kind of disapointed :
 trace (1.3-1) // traces:0.3
 but :
 trace (9.3-9) // traces: 0.301
 trace (100.3-100) //traces: 0.297
 ...
 is there a way that it can traces always 0.3 has it should be normal ?

http://chattyfig.figleaf.com/mailman/htdig/flashcoders/2002-October/049213.html
http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems

Short answer: that's expected, happens with every language, use rounding 
if you need, etc.



Zeh
___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread eka

hello :)

the float number are a problem in Actionscript :)

you can read this article
http://en.wikipedia.org/wiki/Floating-point_numberabout this problem.

If you want fixed this problem you can use the NumberUtil class of my
openSource framework VEGAS :

1 - the page of the project to download the AS2 : framework
http://vegas.riaforge.org/

2 - Use  a Subversion(SVN) client to download the framework or download the
zip

3 - install the classpath ol vegas in your flash IDE in the preference -
ActionScript2 preference ... add the AS2/trunk/src directory

4 - Use the NumberUtil class, example :

import vegas.util.NumberUtil ;

var result = Number(NumberUtil.toFixed(9.3 - 9, 1)) ;
trace(result) ; // 0.3

var result = Number(NumberUtil.toFixed(100.3-100, 1)) ;
trace(result) ; // 0.3

EKA+ :)


2007/1/27, ntasky [EMAIL PROTECTED]:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Re: [Flashcoders] math simple operation

2007-01-27 Thread ntasky

hi,
well I'm trying to do a financial application, so it's going to be too heavy 
to do additionnal operation


N.
--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

- Original Message - 
From: Hans Wichman [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 8:22 AM
Subject: Re: [Flashcoders] math simple operation


Hi,
multiply everything with 1000 before, and divide by 1000 after?:)
greetz
JC


On 1/27/07, ntasky [EMAIL PROTECTED] wrote:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread ntasky

thx to all of you guys. Going to read all of that :)

N.

- Original Message - 
From: eka [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 8:27 AM
Subject: Re: [Flashcoders] math simple operation



hello :)

the float number are a problem in Actionscript :)

you can read this article
http://en.wikipedia.org/wiki/Floating-point_numberabout this problem.

If you want fixed this problem you can use the NumberUtil class of my
openSource framework VEGAS :

1 - the page of the project to download the AS2 : framework
http://vegas.riaforge.org/

2 - Use  a Subversion(SVN) client to download the framework or download 
the

zip

3 - install the classpath ol vegas in your flash IDE in the preference -
ActionScript2 preference ... add the AS2/trunk/src directory

4 - Use the NumberUtil class, example :

import vegas.util.NumberUtil ;

var result = Number(NumberUtil.toFixed(9.3 - 9, 1)) ;
trace(result) ; // 0.3

var result = Number(NumberUtil.toFixed(100.3-100, 1)) ;
trace(result) ; // 0.3

EKA+ :)


2007/1/27, ntasky [EMAIL PROTECTED]:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com










___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread Paul Andrews
If you're doing a financial application, it's important that you address
this correctly: fast but giving the wrong answer isn't an option.

I have worked on some systems where the front end gave one figure, but the
back end reporting function gave another because this wasn't properly
addressed..

As a financial application developer, it's surprising you weren't already
aware of the inaccuracy of floating point.

- Original Message - 
From: ntasky [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 1:40 PM
Subject: Re: [Flashcoders] math simple operation


 hi,
 well I'm trying to do a financial application, so it's going to be too
heavy
 to do additionnal operation

 N.
 -- 
 Nicolas TASKY
 conseil, analyse et développement multimédia
 ntasky.com - (514) 839-6426

 - Original Message - 
 From: Hans Wichman [EMAIL PROTECTED]
 To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
 Sent: Saturday, January 27, 2007 8:22 AM
 Subject: Re: [Flashcoders] math simple operation


 Hi,
 multiply everything with 1000 before, and divide by 1000 after?:)
 greetz
 JC


 On 1/27/07, ntasky [EMAIL PROTECTED] wrote:
 
  Hi,
 
  I'm kind of disapointed :
  trace (1.3-1) // traces:0.3
  but :
  trace (9.3-9) // traces: 0.301
  trace (100.3-100) //traces: 0.297
  ...
  is there a way that it can traces always 0.3 has it should be normal ?
 
  thx
 
  N.
 
  --
  Nicolas TASKY
  conseil, analyse et développement multimédia
  ntasky.com - (514) 839-6426
 
  ___
  Flashcoders@chattyfig.figleaf.com
  To change your subscription options or search the archive:
  http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
 
  Brought to you by Fig Leaf Software
  Premier Authorized Adobe Consulting and Training
  http://www.figleaf.com
  http://training.figleaf.com
 
 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com

 ___
 Flashcoders@chattyfig.figleaf.com
 To change your subscription options or search the archive:
 http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

 Brought to you by Fig Leaf Software
 Premier Authorized Adobe Consulting and Training
 http://www.figleaf.com
 http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread Ron Wheeler
Knowledge of arithmetic would seem to be the sort of thing one would 
expect in a financial expert. :-)


Although to be fair, this does crop up about once a quarter in the forum 
as a new person discovers one of the hidden joys of using a computer 
that does not have 10 fingers to work with.


Ron


Paul Andrews wrote:

If you're doing a financial application, it's important that you address
this correctly: fast but giving the wrong answer isn't an option.

I have worked on some systems where the front end gave one figure, but the
back end reporting function gave another because this wasn't properly
addressed..

As a financial application developer, it's surprising you weren't already
aware of the inaccuracy of floating point.

- Original Message - 
From: ntasky [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 1:40 PM
Subject: Re: [Flashcoders] math simple operation


  

hi,
well I'm trying to do a financial application, so it's going to be too


heavy
  

to do additionnal operation

N.
--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

- Original Message - 
From: Hans Wichman [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 8:22 AM
Subject: Re: [Flashcoders] math simple operation


Hi,
multiply everything with 1000 before, and divide by 1000 after?:)
greetz
JC


On 1/27/07, ntasky [EMAIL PROTECTED] wrote:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


  

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread ntasky
I'm far far away from being a financial expert (never told i was one), and 
what i'm developping right now is just for my personnal stuff. It is how I 
learn about new stuff. So thx again for your advices


N.
- Original Message - 
From: Ron Wheeler [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 9:29 AM
Subject: Re: [Flashcoders] math simple operation


Knowledge of arithmetic would seem to be the sort of thing one would 
expect in a financial expert. :-)


Although to be fair, this does crop up about once a quarter in the forum 
as a new person discovers one of the hidden joys of using a computer that 
does not have 10 fingers to work with.


Ron


Paul Andrews wrote:

If you're doing a financial application, it's important that you address
this correctly: fast but giving the wrong answer isn't an option.

I have worked on some systems where the front end gave one figure, but 
the

back end reporting function gave another because this wasn't properly
addressed..

As a financial application developer, it's surprising you weren't already
aware of the inaccuracy of floating point.

- Original Message - 
From: ntasky [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 1:40 PM
Subject: Re: [Flashcoders] math simple operation




hi,
well I'm trying to do a financial application, so it's going to be too


heavy


to do additionnal operation

N.
--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

- Original Message - 
From: Hans Wichman [EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 8:22 AM
Subject: Re: [Flashcoders] math simple operation


Hi,
multiply everything with 1000 before, and divide by 1000 after?:)
greetz
JC


On 1/27/07, ntasky [EMAIL PROTECTED] wrote:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be normal ?

thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com


Re: [Flashcoders] math simple operation

2007-01-27 Thread Ron Wheeler

Don't worry.
We are all happy to show off what we know. Keep the questions coming.

You are not the first or the last person to hit this.

You will have to pay a bit of an extra price on each computation to be 
sure that you have guarded enough of the precision of the numbers 
during calculation so that when you round down to 2 (or however many 
digits your currency requires) digits after the decimal, you get the 
same answer that a person would get doing it in base10 using integer 
arithmetic.

No choice.

Ron

ntasky wrote:
I'm far far away from being a financial expert (never told i was one), 
and what i'm developping right now is just for my personnal stuff. It 
is how I learn about new stuff. So thx again for your advices


N.
- Original Message - From: Ron Wheeler 
[EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 9:29 AM
Subject: Re: [Flashcoders] math simple operation


Knowledge of arithmetic would seem to be the sort of thing one would 
expect in a financial expert. :-)


Although to be fair, this does crop up about once a quarter in the 
forum as a new person discovers one of the hidden joys of using a 
computer that does not have 10 fingers to work with.


Ron


Paul Andrews wrote:
If you're doing a financial application, it's important that you 
address

this correctly: fast but giving the wrong answer isn't an option.

I have worked on some systems where the front end gave one figure, 
but the

back end reporting function gave another because this wasn't properly
addressed..

As a financial application developer, it's surprising you weren't 
already

aware of the inaccuracy of floating point.

- Original Message - From: ntasky [EMAIL PROTECTED]
To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 1:40 PM
Subject: Re: [Flashcoders] math simple operation




hi,
well I'm trying to do a financial application, so it's going to be too


heavy


to do additionnal operation

N.
--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

- Original Message - From: Hans Wichman 
[EMAIL PROTECTED]

To: Flashcoders mailing list flashcoders@chattyfig.figleaf.com
Sent: Saturday, January 27, 2007 8:22 AM
Subject: Re: [Flashcoders] math simple operation


Hi,
multiply everything with 1000 before, and divide by 1000 after?:)
greetz
JC


On 1/27/07, ntasky [EMAIL PROTECTED] wrote:


Hi,

I'm kind of disapointed :
trace (1.3-1) // traces:0.3
but :
trace (9.3-9) // traces: 0.301
trace (100.3-100) //traces: 0.297
...
is there a way that it can traces always 0.3 has it should be 
normal ?


thx

N.

--
Nicolas TASKY
conseil, analyse et développement multimédia
ntasky.com - (514) 839-6426

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com





___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com




___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com 


___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



___
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http