StackGenVis: Alignment of Data, Algorithms, and Models for Stacking Ensemble Learning Using Performance Metrics https://doi.org/10.1109/TVCG.2020.3030352
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
StackGenVis/frontend/node_modules/big-rat/test/to-float.js

51 lines
857 B

4 years ago
'use strict'
var rat = require('../index')
var toFloat = require('../to-float')
var tape = require('tape')
function verify(t, x) {
t.equals(toFloat(rat(x)), x, 'to-float: ' + x)
}
tape('to-float: small integers', function(t) {
for(var i=-1000; i<1000; ++i) {
verify(t, i)
}
t.end()
})
tape('to-float: selected cases', function(t) {
verify(t, 0)
verify(t, 0.1)
verify(t, 0.2)
verify(t, 0.3)
verify(t, 1/3)
verify(t, 0.5)
verify(t, 0.25)
verify(t, 0.9)
verify(t, 11111.11111)
verify(t, -155.87571739999998)
t.end()
})
tape('to-float: powers of 2', function(t) {
for(var i=-1075; i<1024; ++i) {
verify(t, Math.pow(2, i))
}
t.end()
})
tape('to-float: fuzz', function(t) {
for(var i=-1075; i<1023; ++i) {
for(var j=0; j<50; ++j) {
verify(t, Math.random() * Math.pow(2, i))
}
}
t.end()
})