octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Help with format long


From: José Luis García Pallero
Subject: Re: Help with format long
Date: Fri, 16 Feb 2018 15:45:05 +0100

2018-02-16 15:41 GMT+01:00 Rik <address@hidden>:
> 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
address@hidden
(o<
/ / \
V_/_
Use Debian GNU/Linux and enjoy!
*****************************************



reply via email to

[Prev in Thread] Current Thread [Next in Thread]