Comments (1)
/**
* Sign: 1
* Exponent: 5, offset 15
* Mantissa: 10
*/
function readFloat16LE(bytes) {
var bits = (bytes[1] << 8) | bytes[0];
var sign = bits >>> 15 === 0 ? 1.0 : -1.0;
var e = (bits >>> 10) & 0x1f;
var m = e === 0 ? (bits & 0x3ff) << 1 : (bits & 0x3ff) | 0x400;
var f = sign * m * Math.pow(2, e - 25);
return f;
}
/**
* Sign: 1
* Exponent: 8, offset 127
* Mantissa: 23
*/
function readFloat32LE(bytes) {
var bits = (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0];
var sign = bits >>> 31 === 0 ? 1.0 : -1.0;
var e = (bits >>> 23) & 0xff;
var m = e === 0 ? (bits & 0x7fffff) << 1 : (bits & 0x7fffff) | 0x800000;
var f = sign * m * Math.pow(2, e - 150);
return f;
}
/**
* Sign: 1
* Exponent: 11, offset 1023
* Mantissa: 52
*/
function readFloat64LE(bytes) {
var lowBits = (bytes[3] << 24) | (bytes[2] << 16) | (bytes[1] << 8) | bytes[0];
var highBits = (bytes[7] << 24) | (bytes[6] << 16) | (bytes[5] << 8) | bytes[4];
var sign = highBits >>> 31 === 0 ? 1.0 : -1.0;
var e = (highBits >>> 20) & 0x7ff;
var m = e === 0 ?
(highBits & 0xfffff) * Math.pow(2, 32) + lowBits :
(highBits & 0xfffff) * Math.pow(2, 32) + lowBits + Math.pow(2, 52);
var f = sign * m * Math.pow(2, e - 1075);
return f;
}
from sensordecoders.
Related Issues (20)
- UC511-DI-868M Battery Levels HOT 1
- README documentation for Milesight V121 is not correct
- UC51x decoder doesn't correctly handle unknown/new data items HOT 5
- Actility UC300 Payload decoder HOT 1
- EM300 with hourly measurements keeps sending empty payload. HOT 1
- AT101 payload and decoder incorrectly uses positive longitude for West HOT 12
- WT201 Decoder HOT 2
- How do you handle the negative coordinates (south or west) HOT 1
- Why are there separate Chirpstack (v3) and ChirpStack v4 decoders? Single decoder works HOT 4
- Encoder for WT201 HOT 2
- Encoder for WT101 HOT 2
- TS30X Payload Definition doesnt fit with decoder HOT 2
- get devEUI inside the decoder HOT 1
- Problem decoding up messages in EM300DI HOT 4
- UC50x decoder doesn't work in ChripStack v4 HOT 3
- Set via Lorawan HOT 2
- decoder for helium console HOT 1
- Template Literal (`) not supported in The Things Stack
- WS202 decoder for helium network and datacake integration HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sensordecoders.