What is the precision of floating point calculations in Scilab?

前端 未结 2 1974
离开以前
离开以前 2021-01-16 09:22

Note: I\'ve used the Matlab tag just in case they maintain the same precision. (From what I can tell both programs are very similar.)

As a follow-up to a pr

2条回答
  •  说谎
    说谎 (楼主)
    2021-01-16 09:54

    Re-posting comment as an answer:

    IEEE 754 double-precision floating point numbers are the standard representation in most common languages, like MATLAB, C++ and SciLab:

    https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0ahUKEwiajY7LzZbNAhWJix4KHcrEA1wQFgggMAA&url=http%3A%2F%2Fforge.scilab.org%2Findex.php%2Fp%2Fdocscifloat%2Fdownloads%2Fget%2Ffloatingpoint_v0.2.pdf&usg=AFQjCNFQiOVdgkjuxhFXhp1PwDFY-J-Qbg&sig2=vH0cpadZqi0bNqa9F0Gmig&cad=rja

    so I don't expect you would need to do anything special to represent the precision, other than using C++ doubles (unless your SciLab code is using high-precision floats).

    Note that the representations of two different IEEE 754 compliant implementations can differ after 16 significant digits:

    MATLAB:

    >> fprintf('%1.30f\n',1/2342317.0)
    0.000000426927695952341190000000
    

    Python:

    >> "%1.30f" % (1/2342317,)
    '0.000000426927695952341193713560'
    

提交回复
热议问题