Message from discussion
itoc function - can it be simplified?
Received: by 10.68.129.169 with SMTP id nx9mr2967716pbb.2.1333847614836;
Sat, 07 Apr 2012 18:13:34 -0700 (PDT)
MIME-Version: 1.0
Path: r9ni30966pbh.0!nntp.google.com!news2.google.com!goblin3!goblin2!goblin.stu.neva.ru!aioe.org!.POSTED!not-for-mail
From: glen herrmannsfeldt <g...@ugcs.caltech.edu>
Newsgroups: comp.lang.fortran
Subject: Re: itoc function - can it be simplified?
Date: Sun, 8 Apr 2012 01:13:29 +0000 (UTC)
Organization: Aioe.org NNTP Server
Lines: 26
Message-ID: <jlqonp$qfv$1@speranza.aioe.org>
References: <9to08uFt8aU1@mid.individual.net> <UyRfr.5460$%E2.2538@viwinnwfe01.internal.bigpond.com> <c7fb0465-0fe7-4484-b0c8-2434b7984b50@tb10g2000pbc.googlegroups.com>
NNTP-Posting-Host: H0vc4U5LIRkRHNPyGCs2dA.user.speranza.aioe.org
X-Complaints-To: abuse@aioe.org
User-Agent: tin/1.9.6-20100522 ("Lochruan") (UNIX) (Linux/2.6.32-5-amd64 (x86_64))
X-Notice: Filtered by postfilter v. 0.8.2
robert.corb...@oracle.com wrote:
(snip)
> The OP was concerned with conversion integer values, not
> floating-point.
> I have seen the function you describe referred to as logd,
> I assume in analogy to the IEEE function logb. The analogy
> is not exact. I have seen such functions used in the
> implementation of the G edit descriptor, where it almost
> always causes trouble. The problem is that it does not
> take rounding into account.
I have seen many times the suggestiong of using LOG10(FLOAT(n))
to find the appropriate power of 10 for integers. I suspect that
rounding could cause problems there, though I don't know of
any actual implementations.
> I know of one implementation
> that would print a field of asterisks for values close to
> but less than powers of ten, because it did not account for
> rounding.
Oops.
-- glen