[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## Re: Support of log10?

**From**: |
Peng Yu |

**Subject**: |
Re: Support of log10? |

**Date**: |
Wed, 23 Jun 2021 20:30:48 -0500 |

>* | 16.3 Arbitrary-Precision Arithmetic Features in gawk*
>
>* | By default, gawk uses the double-precision*
>* | floating-point values [...] However, if it was*
>* | compiled to do so, and the -M command-line*
>* | option is supplied, gawk uses the GNU MPFR and*
>* | GNU MP (GMP) libraries*
The above sentence is not clear. What is the difference between MPFR
and GMP? Why both of them need to be used?
>* for arbitrary-precision*
>* | arithmetic on numbers.*
>
>* > echo 3 | gawk -M -v 'OFS=\t' -v OFMT=%.20g \*
>* -e 'function log10(x) { return log(x)/log(10); } \*
>* { print "log10(" 10^$1 ")", log10(10^$1) }'*
>
>* log10(1000) 3*
The drawback of -M is that it can be many times slow? In this sense
float log10 function may still be useful?
time gawk -e 'function log10(x) { return log(x)/log(10); } {
for(i=1;i<=1000000;++i) log10(10^$1) }' <<< 3
real 0m0.180s
user 0m0.176s
sys 0m0.002s
time gawk -M -e 'function log10(x) { return log(x)/log(10); } {
for(i=1;i<=1000000;++i) log10(10^$1) }' <<< 3
real 0m2.842s
user 0m2.838s
sys 0m0.003s
>* See also footnote 98 and its referencing text.*
Where is footnote 98?
--
Regards,
Peng

**Support of log10?**, *Peng Yu*, `2021/06/23`
**Re: Support of log10?**, *Neil R. Ormos*, `2021/06/23`
**Re: Support of log10?**,
*Peng Yu* **<=**
**Re: Support of log10?**, *Eli Zaretskii*, `2021/06/24`
**Re: Support of log10?**, *Peng Yu*, `2021/06/24`
**Re: Support of log10?**, *Ed Morton*, `2021/06/24`
**Re: Support of log10?**, *Eli Zaretskii*, `2021/06/24`
**Re: Support of log10?**, *Peng Yu*, `2021/06/24`

**Re: Support of log10?**, *Nelson H. F. Beebe*, `2021/06/23`
**Re: Support of log10?**, *arnold*, `2021/06/24`