| 123456789101112131415161718192021222324252627 | 
							- /**
 
-  * Created by Tony on 2017/3/28.
 
-  */
 
- var test = require('tape');
 
- test('test javascript rounding: ', function (t) {
 
-     var f1 = 2.35, f2 = 2.45, f3 = 2.449999999999999995, f4 = 2.44999999999999995;
 
-     t.equal(Math.round(f1*10), 24);
 
-     t.equal(Math.round(f2*10), 25);
 
-     t.equal(Math.round(f3*10), 25);
 
-     t.equal(Math.round(f4*10), 25);
 
-     t.end();
 
- });
 
- test('test javascript fixed rounding: ', function (t) {
 
-     var f1 = 2.35, f2 = 2.45, f3 = 2.449995;
 
-     t.equal(f1.toFixed(1), '2.4');
 
-     t.equal(f2.toFixed(1), '2.5');
 
-     t.equal(f3.toFixed(1), '2.5');
 
-     t.end();
 
- });
 
- //test('test javascript decimal: ', function (t) {
 
- //    var x = new Decimal(0.1), y = new Decimal(0.2);
 
- //    t.equal(x + y, 0.3);
 
- //    t.end();
 
- //});
 
 
  |