What is the range of a floating point value on the ESP32, using the Arduino IDE?
I get an overflow if I have a value below zero, which I do not get if I compile the same code for a Nano for example.
Negative Floating point overflow
Re: Negative Floating point overflow
That doesn't sound quite right. 32-bit floats on ESP32 are IEEE754 single-precision format, so should include a lot of values below zero (down to very large negative numbers.)
Can you please post some code which exhibits this problem on ESP32 and not on other platforms?
Can you please post some code which exhibits this problem on ESP32 and not on other platforms?
-
- Posts: 2
- Joined: Thu Feb 15, 2018 3:45 pm
Re: Negative Floating point overflow
I'm almost too embarrassed to reply, but, I was using a float which had a value assigned by a calculation which had an unsigned int as part of the equation. For some reason the Arduino Nano just dealt with this, but the ESP32 didn't.
Anyway, I've cast the unsigned int to a float in the calculation and it's fine now.
Silly mistake, it's the fact that it worked on the Nano that threw me.
Anyway, I've cast the unsigned int to a float in the calculation and it's fine now.
Silly mistake, it's the fact that it worked on the Nano that threw me.
-
- Posts: 90
- Joined: Sun Jul 02, 2017 3:38 am
Re: Negative Floating point overflow
I’d be curious to see the expression. Type conversion/promotion/coercion is handled in the compiler.
Who is online
Users browsing this forum: No registered users and 64 guests