Sha256: 537672bef8aaf43d7788f672f86a670d6cc594b6f5001d5e3c179b97bda7896f

Contents?: true

Size: 460 Bytes

Versions: 63

Compression:

Stored size: 460 Bytes

Contents

var ieee754 = require('../')
var test = require('tape')

var EPSILON = 0.00001

test('read float', function (t) {
  var buf = new Buffer(4)
  buf.writeFloatLE(42.42, 0)
  var num = ieee754.read(buf, 0, true, 23, 4)
  t.ok(Math.abs(num - 42.42) < EPSILON)

  t.end()
})

test('write float', function (t) {
  var buf = new Buffer(4)
  ieee754.write(buf, 42.42, 0, true, 23, 4)

  var num = buf.readFloatLE(0)
  t.ok(Math.abs(num - 42.42) < EPSILON)

  t.end()
})

Version data entries

63 entries across 63 versions & 2 rubygems

Version Path
smock-0.1.268 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.267 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.266 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.265 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.264 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.263 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.262 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.261 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.260 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.259 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.258 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.256 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.255 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.254 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.253 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.252 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.251 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.250 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.249 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js
smock-0.1.247 node_modules/webpack/node_modules/node-libs-browser/node_modules/buffer/node_modules/ieee754/test/basic.js