why does realmax('single') display 8 digits?
7 views (last 30 days)
Ameer Hamza on 17 Dec 2020
Edited: Ameer Hamza on 17 Dec 2020
"most texts agree that IEEE-754 sinlge persision has 7 signicant digits and double percision has 15"
But they don't. More precisely, they have 24 and 53 significant binary digits, respectively. Both are capable of representing 2^24 and 2^53 consecutive integers without any loss of precision. MATLAB just returns these values.
Note that it is still possible to represent even bigger integers with full precision, but the only issue is that the number adjacent to them cannot be represented precisely.
Read here: https://en.wikipedia.org/wiki/IEEE_754#Basic_and_interchange_formats. They are capable of representing ~7.22 and ~15.96 decimal digits respectively.
Walter Roberson on 17 Dec 2020
You get 7 full digits, up to 9999999 . And there is some spare room beyond that, but not enough for a full digit. It is about 7.22 digits.