bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support of log10?


From: Ed Morton
Subject: Re: Support of log10?
Date: Thu, 24 Jun 2021 09:14:08 -0500
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

Imagine how many such trivial things could be included in the awk language, most of which would be far more commonly useful than a log10 function. The awk language is tiny and powerful because there are only constructs to do things that aren't easy to do with other existing constructs. If you want a language with a million constructs to do every single thing you might want to do with the resulting language bloat and write-only code side-effects, there is another existing tool for you - see Arnolds earlier post.

    Ed.

On 6/24/2021 9:01 AM, Peng Yu wrote:
Who said you will always get exactly 3 if you have log10?
Because the number 1000 can be represent in float exactly, and the
answer 3 can be represent in float exactly. Therefore, the correct
result for log10(1000) must be exact 3 in float. Anything that
deviated from it, no matter how small, is not exactly correct.

And why are exact powers of 10 even interesting enough to justify yet
another built-in function?
I can ask the same question. Why it is justified not include it. Given
it is trivial to include it?

After all, if you are only interested in
exact powers of 10, you don't need a math function at all, you simply
count the zero digits in the string representation of the number.
No. 1000 is just an example that has an exact result in float. There
can be other examples that has exact answers in float.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]