What is the accuracy of log() and other functions?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
What is the accuracy of log()? IEEE 754-2008 recommends log() to be "correctly rounded". However, if I run the following:
single(log(single(0.5423648357391357421875)))
single(log(double(single(0.5423648357391357421875))))
single(log(vpa(0.54236483573913574218751,100)))
There appears to be a >0.5ULP difference for the single precision version of log vs the double/variable versions:
-0.6118164
-0.6118163
-0.6118163
Does MatLab just call the OS's C libraries log/logf function? If that is the case, on Linux, for glibc, errors are specified here: http://www.gnu.org/software/libc/manual/html_node/Errors-in-Math-Functions.html#Errors-in-Math-Functions and logf has 1ULP error, whereas log should have none. But what about on Windows?
0 comentarios
Respuesta aceptada
Jan
el 8 de Feb. de 2018
Editada: Jan
el 8 de Feb. de 2018
In the documentation of older Matlab version you found that e.g. acos was calculated using FDLIBM, see: http://www.netlib.org . There is an excellent discussion about the implementation of log10 in Matlab up to 6.5, see https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT. Interesting, but does not solve your question. But Kahan said (about a very old Matlab version!):
According to my tests, MATLAB's LOG(x) errs by at worst about
0.8 ulp over the interval 1/4 <= x <= 4
At least I can say, that the problem does not concern the conversion from double to single:
a = 0.5423648357391357421875
b = single(a)
c = double(b)
isequal(a, c) % TRUE
Which library function is used for log is not documented in public. Therefore you have to ask TMW directly. Use the "Contact Us" link on this page.
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Data Type Conversion en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!