Article View: comp.lang.forth
Article #98Re: FCONSTANT specification
From: Krishna Myneni
Date: Fri, 16 Oct 2026 20:44
Date: Fri, 16 Oct 2026 20:44
77 lines
5043 bytes
5043 bytes
On 10/16/26 2:55 PM, marcel hendrix wrote: > On 10/16/2026 6:02 PM, Krishna Myneni wrote: >> On 10/16/26 10:36, marcel hendrix wrote: >>> On 10/16/2026 5:58 AM, Krishna Myneni wrote: >>> >>> > extended precision (p = 64 bits) >>> > double double precision (p = 106 bits) >>> > quad precision (p = 113 bits) >>> > double extended precision (p = 128 bits) >>> > double quad precision (p = 226 bits) >>> > >>> > Then M = 70, and H >= 73 significant digits. >>> >>> Which implies H >= 83 for quad double extended precision, >>> meaning the available QD* in that library is not sufficient. >>> Although only QDNEGATE , qd=10 QD* , qd=10 QD/ , and QDF+ are needed, >>> one can't get by with a bit shift routine and a simple QQDF+, as +/- >>> INF, NAN and subnormals must be handled. >>> >>> Or give up in disgust and link to an external library. >>> >>> Either that or go for II.2. >>> >>> -marcel >> >> >> Yes, I expect QD* which I assume is quad double mulitply is probably >> not sufficient to handle quad extended requirements. One point I >> forgot to mention is that the Forth standard for REPRESENT requires >> rounding to nearest, in which case H_min = M (not M+3). There's no way >> I can see to avoid using big number arithmetic for the quad extended >> precision case. > > An iForth QD library will have a quad double extended multiply QD* for > 256 bits. Then -256e F2^x gives 8.6e-78 ~> 77 usable decimals. > Your `2e FLOG 256e F* FCEIL F1+` formula (even rounding) gives M = 79, > and unfortunately, QD* does not suffice. > >> It's not hopeless. We have big number arithmetic library code in Forth >> with which to learn how to deal with just about any case. The learning >> curve is there, of course. > > I don't know there is a Forth-based arbitrary *float* implementation, > but the MPFR was ported back in 2012. I am looking at it just now. The > Windows port suffered from a very immature MinGW64 and would need to be > revisited. > But why want QD, QX or QD when the mpfr gives arbitrary precision on its > own? The charm of QD is that is very small and simple, while MPFR is a > beast. It could be that it is much faster than QD/QX and QD though. > Maybe some tests could be done first. >> To handle +/-INF and NAN, isn't it sufficient to examine the bit >> pattern for the leading extended precision number in the quad extended >> precision set i.e. no arithmetic should be needed to handle +/-INF and >> NAN? I'm not sure if subnormals will be more difficult to handle than >> normal numbers -- their precision is always less than or equal to >> normal numbers. > I hope that is true, I don't particularly enjoy looking into the MPFR > again. > The use of MPFR seems like overkill, since we can just do all higher precision (any value of p) floating point calculations using the library. I had been working on writing REPRESENT using the FSL big.4th library, with my own extensions for necessary functions which were not in the original. I hope to get back to that after sorting out my own needs for floating point output formats. If we have working Forth implementations of REPRESENT for various values of p, it provides a reference for efficient implementation. The reason dtoa() is so complex is that it was designed to demonstrate high efficiency compared to just simply doing big number arithmetic for all cases. -- Krishna
Technical Details
Message-ID:
<11au2b6$3ks2f$1@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11aide4$1ibse$1@dont-email.me> <2026Oct12.203631@mips.complang.tuwien.ac.at> <11am4ae$fte4$1@dont-email.me> <nnd$6e3248f1$0599409a@3ae3c368d79558dd> <2026Oct14.102517@mips.complang.tuwien.ac.at> <6ad02ef0$1@news.ausics.net> <11as7ct$2voh4$1@dont-email.me> <11atg9c$1t6lk$1@dont-email.me> <11athqh$3e3iv$1@dont-email.me> <11atves$k2t8$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: Krishna Myneni <krishna.myneni@ccreweb.org> Newsgroups: comp.lang.forth Subject: Re: FCONSTANT specification Date: Fri, 16 Oct 2026 15:44:22 -0500 Organization: A noiseless patient Spider Lines: 77 Message-ID: <11au2b6$3ks2f$1@dont-email.me> References: <11aide4$1ibse$1@dont-email.me> <2026Oct12.203631@mips.complang.tuwien.ac.at> <11am4ae$fte4$1@dont-email.me> <nnd$6e3248f1$0599409a@3ae3c368d79558dd> <2026Oct14.102517@mips.complang.tuwien.ac.at> <6ad02ef0$1@news.ausics.net> <11as7ct$2voh4$1@dont-email.me> <11atg9c$1t6lk$1@dont-email.me> <11athqh$3e3iv$1@dont-email.me> <11atves$k2t8$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Fri, 16 Oct 2026 20:44:24 +0000 (UTC) Injection-Info: dont-email.me; logging-data="3829839"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NyyykbzkhMIs0Ig1EmmKS"; posting-host="6424a14b30c7c4c7012a370c8d7efbd9" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:Kw34HMAXl3j4sNkh/NKuYma023c= sha256:OTwQBaqDmlbOhB9JJPUiM+Ks+b0WSFNRF0fhFQiMeG0= sha1:6Iik9JthqlttxS23Ih3JYosTjtM= sha256:VZAWa+o9mgSXGufXXicQBc3VASmaJnETY1VivdST18M= Content-Language: en-US In-Reply-To: <11atves$k2t8$1@dont-email.me>