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/double-bits/double.js

101 lines
2.5 KiB

var hasTypedArrays = false
if(typeof Float64Array !== "undefined") {
var DOUBLE_VIEW = new Float64Array(1)
, UINT_VIEW = new Uint32Array(DOUBLE_VIEW.buffer)
DOUBLE_VIEW[0] = 1.0
hasTypedArrays = true
if(UINT_VIEW[1] === 0x3ff00000) {
//Use little endian
module.exports = function doubleBitsLE(n) {
DOUBLE_VIEW[0] = n
return [ UINT_VIEW[0], UINT_VIEW[1] ]
}
function toDoubleLE(lo, hi) {
UINT_VIEW[0] = lo
UINT_VIEW[1] = hi
return DOUBLE_VIEW[0]
}
module.exports.pack = toDoubleLE
function lowUintLE(n) {
DOUBLE_VIEW[0] = n
return UINT_VIEW[0]
}
module.exports.lo = lowUintLE
function highUintLE(n) {
DOUBLE_VIEW[0] = n
return UINT_VIEW[1]
}
module.exports.hi = highUintLE
} else if(UINT_VIEW[0] === 0x3ff00000) {
//Use big endian
module.exports = function doubleBitsBE(n) {
DOUBLE_VIEW[0] = n
return [ UINT_VIEW[1], UINT_VIEW[0] ]
}
function toDoubleBE(lo, hi) {
UINT_VIEW[1] = lo
UINT_VIEW[0] = hi
return DOUBLE_VIEW[0]
}
module.exports.pack = toDoubleBE
function lowUintBE(n) {
DOUBLE_VIEW[0] = n
return UINT_VIEW[1]
}
module.exports.lo = lowUintBE
function highUintBE(n) {
DOUBLE_VIEW[0] = n
return UINT_VIEW[0]
}
module.exports.hi = highUintBE
} else {
hasTypedArrays = false
}
}
if(!hasTypedArrays) {
var buffer = new Buffer(8)
module.exports = function doubleBits(n) {
buffer.writeDoubleLE(n, 0, true)
return [ buffer.readUInt32LE(0, true), buffer.readUInt32LE(4, true) ]
}
function toDouble(lo, hi) {
buffer.writeUInt32LE(lo, 0, true)
buffer.writeUInt32LE(hi, 4, true)
return buffer.readDoubleLE(0, true)
}
module.exports.pack = toDouble
function lowUint(n) {
buffer.writeDoubleLE(n, 0, true)
return buffer.readUInt32LE(0, true)
}
module.exports.lo = lowUint
function highUint(n) {
buffer.writeDoubleLE(n, 0, true)
return buffer.readUInt32LE(4, true)
}
module.exports.hi = highUint
}
module.exports.sign = function(n) {
return module.exports.hi(n) >>> 31
}
module.exports.exponent = function(n) {
var b = module.exports.hi(n)
return ((b<<1) >>> 21) - 1023
}
module.exports.fraction = function(n) {
var lo = module.exports.lo(n)
var hi = module.exports.hi(n)
var b = hi & ((1<<20) - 1)
if(hi & 0x7ff00000) {
b += (1<<20)
}
return [lo, b]
}
module.exports.denormalized = function(n) {
var hi = module.exports.hi(n)
return !(hi & 0x7ff00000)
}