Difference between revisions of "Matlab/Octave finty"

From RoboWiki
Jump to: navigation, search
(New page: Niektoré zaujímavé konštrukcie a postupy '''How to find square root of 2 in 15 significant figures''' octave:1> format long octave:2> sqrt(2) ans = 1.41421356237310 Alebo iný...)
(No difference)

Revision as of 12:30, 17 February 2012

Niektoré zaujímavé konštrukcie a postupy

How to find square root of 2 in 15 significant figures

octave:1> format long
octave:2> sqrt(2)
ans =  1.41421356237310

Alebo iný postup

   x = 1.5;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   x = (x + 2/x) / 2;
   fprintf('%18.15f\n', x)