reference-en icon indicating copy to clipboard operation
reference-en copied to clipboard

Float documentation error

Open ThemoteoVarela opened this issue 5 years ago • 1 comments

There is an error in the float documentation. Instead of

"Floating-point numbers can be as large as 3.4028235E+38 and as low as -3.4028235E+38"

should be

"Floating-point numbers can be as large as 3.4028235E+38 and as low as 3.4028235E-38"

ThemoteoVarela avatar Jul 11 '20 18:07 ThemoteoVarela

Actually, the page is correct. I think ThemoteoVarela meant to write "as small as 3.4028235E-38". However the page is incorrect to say that float has a better resolution than integer types. For values in the range 2^24 to 2^32 a uint32_t has better resolution than float. I suggest:

  • "float can represent fractional numbers."
  • "float can represent very large numbers but may not be perfectly accurate."
  • "float arithmetic is slower than integer arithmetic unless the processor has a floating point unit. Few microcontrollers do."

MalcolmBoura avatar Aug 10 '20 17:08 MalcolmBoura