float-array-to-string
v1.0.4
Published
convert/encode a float array as a hex string and back again.
Downloads
3
Maintainers
Readme
float-array-to-string
convert/encode a float array to a hex string and back again.
based on a stackoverflow post.
Installation
npm i float-array-to-string
Usage
var floatArray2Str = require('float-array-to-string');
var myFloats = [0.00001,2.123123213,3.14159265] ;
//note - encoder will cast array to a Float32Array if it is not already
var str = floatArray2Str.encodeFloatArr(myFloats);
console.log(str);
//acc5273740e10740db0f4940
console.log(floatArray2Str.decodeFloatArr(str));
// Float32Array(3) [
// 0.000009999999747378752, //notice the small error
// 2.1231231689453125,
// 3.1415927410125732
// ]
See Also
- int-compress-string - (de)compresses integer list to string