Inconsistency with gnuplot format specifiers %t and %T?

杀马特。学长 韩版系。学妹 提交于 2019-11-29 12:15:14

Actually, besides gprintf("%t",95) and gprintf("%T",95) not showing the expected mantissa and power, also the formula floor(log10(n)) sometimes does not show the correct power of n. (see here: gnuplot: how to get correct order of magnitude?)

Suggestion for workaround: the following formulas make a detour via string formatting, but at least they should always give the correct mantissa and power.

Mantissa(n) = real(sprintf("%.15e",n)[1:strstrt(sprintf("%.15e",n),"e")-1])

Power(n) = int(sprintf("%.15e",n)[strstrt(sprintf("%.15e",n),"e")+1:])

In the longterm, the functions gprintf("%t",...), gprintf("%T",...) should be fixed in the gnuplot source code.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!