drivers: sensors: improve range check in `sensor_value_from_float/double`
Avoid undefined behavior caused by casting floating-point values outside
the int32_t range. The updated implementation explicitly validates input
bounds before performing conversions, ensuring consistent behavior across
platforms.
Added test cases to cover edge conditions near float rounding limits
and INT32 range boundaries.
Signed-off-by:
Pisit Sawangvonganan <pisit@ndrsolution.com>
Loading
Please sign in to comment