- Регистрация
- 29.03.2011
- Сообщения
- 221
- Благодарностей
- 30
- Баллы
- 0
When I want to calculate some numbers, I get weird results:
e.g.
{-JS.Execute-|-
var res=0;
var thisres=parseFloat("{-FieldData.FieldData-|-block-|-parseRes-}");
if (thisres>=res){rep=thisres} else res=0;
res;
-}
that {-FieldData.FieldData-|-block-|-parseRes-} usually holds numbers like 20.00 or NaN that's why I do this JS, so in our example 'res' gets the value 20 assigned
When I do:
{-JS.Execute-|-
{-FieldData.FieldData-|-block-|-parsePr-}-{-FieldData.FieldData-|-block-|-calcRes-};
-}
It's getting funny: the first value is e.g. 79.99, the second is 20 ('res' from the JS above)
79.99-20=59.989999999999995
Why is that happening?
I expected 59.99.
e.g.
{-JS.Execute-|-
var res=0;
var thisres=parseFloat("{-FieldData.FieldData-|-block-|-parseRes-}");
if (thisres>=res){rep=thisres} else res=0;
res;
-}
that {-FieldData.FieldData-|-block-|-parseRes-} usually holds numbers like 20.00 or NaN that's why I do this JS, so in our example 'res' gets the value 20 assigned
When I do:
{-JS.Execute-|-
{-FieldData.FieldData-|-block-|-parsePr-}-{-FieldData.FieldData-|-block-|-calcRes-};
-}
It's getting funny: the first value is e.g. 79.99, the second is 20 ('res' from the JS above)
79.99-20=59.989999999999995
Why is that happening?
I expected 59.99.