Article View: comp.lang.forth
Article #47Re: F.N floating point format word
From: dxf
Date: Fri, 09 Oct 2026 09:54
Date: Fri, 09 Oct 2026 09:54
36 lines
2757 bytes
2757 bytes
On 8/10/2026 9:13 pm, peter wrote:
> On Thu, 8 Oct 2026 13:34:33 +1100
> dxf <dxforth@gmail.com> wrote:
>
>> On 8/10/2026 7:35 am, peter wrote:
>>> ...
>>> There were no real reason. The result at fpad is used only for
>>> INF and NAN. I also wanted a number larger then 17, 32 looked like
>>> a good round number. The importance of the first call to represent
>>> is to get a correct exp to use in the following calculations.
>>> The second time represent is called it will be with u=exp+n to get
>>> the correct rounding.
>>
>> Are you sure it's necessary? Your tests appear to work with it set at 5.
>>
>
> You might be right!
> My first concern was for number like
> 9.9999999995e that will round up all the way and get a exp+1
> But it looks like the code handles that also.
> ...
I had a closer look using my own routines as a test bed. Using low values
e.g. u=1 resulted in a few tests from your latest list failing to round.
So anything less than u=17 (or whatever digits your REPRESENT can resolve)
might well create rounding issues. It's similar to what I found when #EXP
('Getting the exponent of an x87 float') used an 80-bit FLOG with the last
bits rounded off. Digits that otherwise displayed in the 18th position of
an F. etc for certain numbers (e.g circa 1E-3) were lost!
TL;DR AFAICS if one wants accurate rounding to 17 digits (or 700 digits)
from F.N then that's the value of u that needs to be passed when asking
for the exponent. It's hardly onerous since the buffer has be at least
that. Whether asking REPRESENT for more digits than this gains one
anything, I'd be less confident about. If the arithmetic inside REPRESENT
was only good to 17 digits...
Technical Details
Message-ID:
<6ac8b9f0$1@news.ausics.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mailReferences:
<119oin2$26n99$1@dont-email.me> <11a01mr$sqrm$1@dont-email.me> <20261005150222.00006cf5@tin.it> <11a16nc$1camn$1@dont-email.me> <20261006080347.00002cdf@tin.it> <11a4tj5$2ku7v$1@dont-email.me> <20261007223526.000065ab@tin.it> <6ac7013a$1@news.ausics.net> <20261008121302.00007412@tin.it>Show Full Headers
Complete Article Headers
Date: Fri, 9 Oct 2026 20:54:57 +1100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: F.N floating point format word Newsgroups: comp.lang.forth References: <119oin2$26n99$1@dont-email.me> <11a01mr$sqrm$1@dont-email.me> <20261005150222.00006cf5@tin.it> <11a16nc$1camn$1@dont-email.me> <20261006080347.00002cdf@tin.it> <11a4tj5$2ku7v$1@dont-email.me> <20261007223526.000065ab@tin.it> <6ac7013a$1@news.ausics.net> <20261008121302.00007412@tin.it> Content-Language: en-GB From: dxf <dxforth@gmail.com> In-Reply-To: <20261008121302.00007412@tin.it> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit NNTP-Posting-Host: news.ausics.net Message-ID: <6ac8b9f0$1@news.ausics.net> Organization: Ausics - https://newsgroups.ausics.net Lines: 36 X-Complaints: abuse@ausics.net Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!news.ausics.net!not-for-mail