Files
Eric FELIXINE e30ae8ed09 feat(smart-app): implement complete mobile app MVP
- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
2026-06-01 18:00:35 -04:00

48 lines
1.2 KiB
JavaScript

'use strict';
var $pow = require('math-intrinsics/pow');
module.exports = function bytesAsFloat32(rawBytes) {
// return new $Float16Array(new $Uint8Array(rawBytes).buffer)[0];
/*
Let value be the byte elements of rawBytes concatenated and interpreted as a little-endian bit string encoding of an IEEE 754-2019 binary16 value.
If value is a NaN, return NaN.
Return the Number value that corresponds to value.
*/
var bits = (rawBytes[1] << 8) | rawBytes[0];
// extract sign, exponent, mantissa
var sign = bits & 0x8000 ? -1 : 1;
var exponent = (bits & 0x7C00) >> 10;
var mantissa = bits & 0x03FF;
// zero (±0)
if (exponent === 0 && mantissa === 0) {
return sign === 1 ? 0 : -0;
}
// infinities
if (exponent === 0x1F && mantissa === 0) {
return sign === 1 ? Infinity : -Infinity;
}
// NaN
if (exponent === 0x1F && mantissa !== 0) {
return NaN;
}
// remove bias (15)
exponent -= 15;
// subnormals
if (exponent === -15) {
// value = sign * (mantissa) * 2^(1-bias-10) = mantissa * 2^(-14-10)
return sign * mantissa * $pow(2, -24);
}
// normals
// value = sign * (1 + mantissa/2^10) * 2^exponent
return sign * (1 + (mantissa * $pow(2, -10))) * $pow(2, exponent);
};