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.
40 lines
985 B
40 lines
985 B
var test = require('tape')
|
|
var bn = require('bn.js')
|
|
var toFloat = require('../lib/bn-to-num')
|
|
|
|
test('single word', function (t) {
|
|
t.equal(toFloat(new bn(-1234567)), -1234567, 'negative')
|
|
t.equal(toFloat(new bn(1234567)), 1234567, 'positive')
|
|
t.end()
|
|
})
|
|
|
|
test('two words', function (t) {
|
|
var v = 12345671234567
|
|
t.equal(toFloat(new bn(v)), v, 'positive')
|
|
t.equal(toFloat(new bn(-v)), -v, 'negative')
|
|
t.end()
|
|
})
|
|
|
|
test('more words (positive)', function (t) {
|
|
var n = new bn('1234567123456712345671234567', 10)
|
|
var v = toFloat(n)
|
|
t.equal(v, +n.toString(), 'positive')
|
|
t.end()
|
|
})
|
|
|
|
test('more words (negative)', function (t) {
|
|
var n = new bn('-1234567123456712345671234567', 10)
|
|
var v = toFloat(n)
|
|
t.equal(v, +n.toString(), 'negative')
|
|
t.end()
|
|
})
|
|
|
|
test('powers of 2', function (t) {
|
|
for (var i = 0; i < 1024; ++i) {
|
|
var x = Math.pow(2, i)
|
|
var y = (new bn(1)).ushln(i)
|
|
t.same(toFloat(y), x, x)
|
|
t.same(toFloat(y.neg()), -x, -x)
|
|
}
|
|
t.end()
|
|
})
|
|
|