[Top][All Lists]

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

Re: Support of log10?

From: Eli Zaretskii
Subject: Re: Support of log10?
Date: Thu, 24 Jun 2021 17:15:52 +0300

> From: Peng Yu <pengyu.ut@gmail.com>
> Date: Thu, 24 Jun 2021 09:01:47 -0500
> Cc: ormos-gnulists17@ormos.org, bug-gawk@gnu.org
> > 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.

But there's no guarantee the function log10 of any particular C
library will give you that exact result.  You just expect that, but
there's no guarantee.

> > 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?

Because we don't want to bloat Gawk unnecessarily.  (And no, it is not

> > 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.

Only integral powers of 10 will have an exact result from log10.

reply via email to

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