Could someone try the following code in Matlab? The documentation says
they keep 15 digits after the decimal point for the long format, but frankly that would be misleading to the programmer. IEEE-854 has 15-17 significant figures when represented in base 10, and there is no reason to attempt to show more precision if it does not actually exists, as would be the case if some of the significant digits occur before the decimal point. Code: format long x = pi; y = [x; x*10; x*100; x*1000] single (y) Thanks, Rik ----------------------------------------- Join us March 12-15 at CERN near Geneva Switzerland for OctConf 2018. More info: https://wiki.octave.org/OctConf_2018 ----------------------------------------- |
2018-02-16 15:41 GMT+01:00 Rik <[hidden email]>:
> Could someone try the following code in Matlab? The documentation says > they keep 15 digits after the decimal point for the long format, but > frankly that would be misleading to the programmer. IEEE-854 has 15-17 > significant figures when represented in base 10, and there is no reason to > attempt to show more precision if it does not actually exists, as would be > the case if some of the significant digits occur before the decimal point. > > Code: > > format long > x = pi; > y = [x; x*10; x*100; x*1000] > single (y) y = 1.0e+03 * 0.003141592653590 0.031415926535898 0.314159265358979 3.141592653589793 ans = 4×1 single column vector 1.0e+03 * 0.0031416 0.0314159 0.3141593 3.1415928 Matlab 9.2.0.538062 (R2017a) in Debian Sid > > Thanks, > Rik > > > ----------------------------------------- > Join us March 12-15 at CERN near Geneva > Switzerland for OctConf 2018. More info: > https://wiki.octave.org/OctConf_2018 > ----------------------------------------- -- ***************************************** José Luis García Pallero [hidden email] (o< / / \ V_/_ Use Debian GNU/Linux and enjoy! ***************************************** ----------------------------------------- Join us March 12-15 at CERN near Geneva Switzerland for OctConf 2018. More info: https://wiki.octave.org/OctConf_2018 ----------------------------------------- |
In reply to this post by Rik-4
On 02/16/2018 03:41 PM, Rik wrote:
> Could someone try the following code in Matlab? The documentation says > they keep 15 digits after the decimal point for the long format, but > frankly that would be misleading to the programmer. IEEE-854 has 15-17 > significant figures when represented in base 10, and there is no reason to > attempt to show more precision if it does not actually exists, as would be > the case if some of the significant digits occur before the decimal point. > > Code: > > format long > x = pi; > y = [x; x*10; x*100; x*1000] > single (y) > > Thanks, > Rik > > > ----------------------------------------- > Join us March 12-15 at CERN near Geneva > Switzerland for OctConf 2018. More info: > https://wiki.octave.org/OctConf_2018 > ----------------------------------------- Dear Rik, Matlab2017b gives y = 1.0e+03 * 0.003141592653590 0.031415926535898 0.314159265358979 3.141592653589793 ans = 4×1 single column vector 1.0e+03 * 0.0031416 0.0314159 0.3141593 3.1415928 -- Michele Ginesi ----------------------------------------- Join us March 12-15 at CERN near Geneva Switzerland for OctConf 2018. More info: https://wiki.octave.org/OctConf_2018 ----------------------------------------- |
Free forum by Nabble | Edit this page |