My JavaScript (ExtJs 4.1.0) code is:
Ext.getCmp('amount').setValue(Ext.num(Ext.getCmp('unite_price').getValue()) * Ext.num(this.getValue()));
It multiplies 3 with 0.048, and the result is 0.14400000000000002 instead of 0.144.
Why?
My JavaScript (ExtJs 4.1.0) code is:
Ext.getCmp('amount').setValue(Ext.num(Ext.getCmp('unite_price').getValue()) * Ext.num(this.getValue()));
It multiplies 3 with 0.048, and the result is 0.14400000000000002 instead of 0.144.
Why?
Because of a rounding error in floating point numbers. This is a rather common phenomenon.
If you want 3 decimal points try to round to 3 decimal places.
var result = 3 * 0.048;
var roundedResult = Math.round(result * 1000) / 1000;