Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.forth > #135578
| Date | 2026-09-06 12:40 +1000 |
|---|---|
| Subject | Re: Getting the exponent of an x87 float |
| Newsgroups | comp.lang.forth |
| References | (19 earlier) <117f3th$tbos$1@dont-email.me> <6a9b7cf3$1@news.ausics.net> <117h78t$1hpi9$2@dont-email.me> <6a9c4832$1@news.ausics.net> <117i84b$1tflm$1@dont-email.me> |
| From | dxf <dxforth@gmail.com> |
| Message-ID | <6a9cd297$1@news.ausics.net> (permalink) |
| Organization | Ausics - https://newsgroups.ausics.net |
On 6/09/2026 9:20 am, Krishna Myneni wrote: > On 9/5/26 11:49, dxf wrote: >> On 5/09/2026 11:59 pm, Krishna Myneni wrote: >>> On 9/4/26 21:22, dxf wrote: >>>> On 5/09/2026 4:50 am, Krishna Myneni wrote: >>>>> On 9/3/26 8:31 PM, dxf wrote: >>>>>> On 4/09/2026 12:02 am, Krishna Myneni wrote: >>>>>>> On 9/3/26 07:56, dxf wrote: >>>>>>>> On 3/09/2026 9:49 pm, Krishna Myneni wrote: >>>>>>>>> On 9/2/26 19:56, dxf wrote: >>>>>>>>>> ... >>>>>>>>>> More problematic was mantissa digits extraction that could result >>>>>>>>>> in junk output: >>>>>>>>>> >>>>>>>>>> s" 9.9999999999999999999999999999999dd" >dd CR DDFS. >>>>>>>>>> +1.0000000000000000000000000000000 dd 1 ok >>>>>>>>>> >>>>>>>>>> s" 9.999999999999dd" >dd CR DDFS. >>>>>>>>>> +0.0000000000007777777777600000000 dd 0 ok >>>>>>>>>> >>>>>>>>>> It seems this was never corrected. >>>>>>>>>> >>>>>>>>> >>>>>>>>> If the fpu is not configured for double precision and round to nearest mode, the double double words will likely fail. They rely on rounding to double-precision. >>>>>>>> >>>>>>>> Tested on Win32Forth (8 byte floats) and GForth. >>>>>>>> >>>>>>> >>>>>>> Please try the kForth implementation on any of kForth-32/64/Win-32. >>>>>> >>>>>> That seems worse ;) >>>>>> >>>>>> kForth-Win32 v 2.5.5 (Build: 2026-07-18) >>>>>> >>>>>> Ready! >>>>>> include ans-words >>>>>> include ddarith >>>>>> >>>>>> FPU base = 2 FPU precision = 53 >>>>>> ok >>>>>> include dd_io >>>>>> >>>>>> precision . >>>>>> 32 ok >>>>>> s" 9.9999999999999999999999999999999dd" >dd CR DDFS. >>>>>> >>>>>> +0.0000000000000000000000000000000 dd -314 ok >>>>>> >>>>>> s" 9.999999999999dd" >dd CR DDFS. >>>>>> BUF->DD: Float conversion failed >>>>>> Line 7: VM Error(-56): >>>>>> s" 9.999999999999dd" >dd CR DDFS. >>>>>> >>>>>> >>>>> >>>>> These examples fail under kForth-Win32 and kForth-32 in the same way. >>>>> >>>>> Under kForth-64, the first example gives >>>>> >>>>> precision . >>>>> 32 ok >>>>> s" 9.9999999999999999999999999999999dd" >dd ddfs. >>>>> +1.0000000000000000000000000000005 dd 1 ok >>>>> >>>>> The second example gives, >>>>> >>>>> s" 9.999999999999dd" >dd DDFS. >>>>> BUF->DD: Float conversion failed >>>>> Line 402: VM Error(-56): >>>>> >>>>> Clearly there is a problem with the >DD conversion of a decimal string to double-double precision. >>>> >>>> Trawling through my files I discovered I'd developed a solution to the >>>> general issue of DDFS. back in 2012 but had totally forgotten about. It >>>> seems that peeling off the mantissa digits can result in negative values >>>> which then have to be corrected. It puzzled me other users of JVN's package >>>> hadn't encountered the same. That JVN never fixed it might be explained >>>> by his passing. >>>> >>>> The string to float parser seemed complicated so I replaced it. FWIW >>>> here's my 2012 version cleaned up, including mods for KForth. >>>> >>>> https://pastebin.com/1UMmpkf6 >>>> >>> >>> Are you sure DDFS. is the problem. In my case, I think the problem is with the decimal string to double double number conversion i.e., the problem lies in >DD and not in DDFS. >> >> The original 'initialize' wasn't ANS compliant could fail. The fix is: >> >> : initialize >> hi# init_buffer \ buffers >> lo# init_buffer >> lo# [CHAR] 0 +char \ ** add ** >> lo# [CHAR] . +char >> 0 TO pre_dp 0 TO post_dp \ counts >> 0 >state ( <<hi/lo>>) \ fsm >> ; >> >> Your >DD should then work, after which you can test DDFS. >> > > That didn't work. But it fixed the error msg on input conversion from dd-io.4th - no? > But I ran your version of ddarith/dd_io from pastebin under kForth-32 (2.8.0). Below are the results: > > === begin output === > include ans-words > > /home/krishna/kforth/ans-words.4th > ok > include dxforth-dd \ code from pastebin (unchanged) > SYSTEM is redefined > > Double-Double Precision FP > > Testing > > -1.1111222223333344444555556666600E-44 > +-11.1112222233333444445555566666d-45 failed > +11.1112222.233333444445555566666d-45 failed > 1.1111222223333344444555556666599E46 > 1.1111222223333344444555556666599E1 > 1.1111222223333344444555556666599E1 > 1.1111222223333344444555556666599E1 > 1.1111222223330000000000000000000E6 > > 0.0000000000000000000000000000000E0 > 6.6666666666666666666666666666666E-1 > 9.9999999999999999999999987654324E0 > -9.9999999999999900000000123456788E0 > -9.9999999999990000000000000000000E0 ok > > === end output === > > This is encouraging! Tests 2 and 3 failed as they should. > > Per JVN's notes, Test 5 was supposed to fail and output > > +0.0000000000000000000000000000000 dd 0 > > due to a lack of exponent in the input string. > > Your own tests are the last 5 above. I recommend sticking with the "dd" exponent indicator, otherwise you won't be able to differentiate double precision output from double double output. Perhaps. Other than adding a routine to handle DD input, I didn't feel the need to depart from convention. Besides which the package was limited to the basic four functions and there's only so much one can do with that. I didn't have the expertise or particular interest to expand it further.
Back to comp.lang.forth | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-16 09:42 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-17 15:11 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-18 03:47 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-17 21:18 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-18 12:15 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-18 09:01 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-18 20:04 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-19 02:30 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-18 09:16 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-23 06:06 -0500
Re: Getting the exponent of an x87 float antispam@fricas.org (Waldek Hebisch) - 2026-08-18 17:55 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-19 13:48 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-19 17:14 +1000
Re: Getting the exponent of an x87 float peter <peter.noreply@tin.it> - 2026-08-19 09:58 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-19 19:14 +1000
Re: Getting the exponent of an x87 float peter <peter.noreply@tin.it> - 2026-08-19 15:36 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-20 12:36 +1000
Floating point (was: Getting the exponent of an x87 float) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-19 08:38 +0000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-19 18:44 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-20 12:35 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-20 03:40 -0500
Re: Getting the exponent of an x87 float albert@spenarnc.xs4all.nl - 2026-08-22 18:43 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-23 18:47 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-23 14:34 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-24 11:42 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-23 22:11 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-24 14:37 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-24 06:42 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-26 01:56 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-25 16:24 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-26 13:24 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-25 23:26 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-26 18:57 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-27 09:24 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-28 11:14 +1000
Re: Getting the exponent of an x87 float Stephen Pelc <stephen@vfxforth.com> - 2026-08-28 10:23 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-28 21:28 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 09:04 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 09:10 -0500
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-28 14:17 +0000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 09:41 -0500
Re: Getting the exponent of an x87 float albert@spenarnc.xs4all.nl - 2026-08-28 19:40 +0200
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 14:00 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 14:25 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 14:40 -0500
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-08-29 12:17 +0200
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-29 10:35 +0000
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-08-29 15:02 +0200
Re: Getting the exponent of an x87 float albert@spenarnc.xs4all.nl - 2026-08-29 15:51 +0200
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-29 14:45 +0000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-29 14:50 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-29 15:01 -0500
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-08-29 23:26 +0200
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-29 17:16 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-03 10:56 +1000
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-09-03 11:52 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-03 21:00 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-03 06:49 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-03 22:56 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-03 09:02 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-04 11:31 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-04 13:50 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-05 12:22 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-05 08:59 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-06 02:49 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-05 18:20 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-06 12:40 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-06 18:57 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-06 07:36 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-06 07:42 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-07 11:00 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-06 21:16 -0500
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-09-07 08:45 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-07 21:11 +1000
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-09-07 21:30 +0200
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-07 19:09 -0500
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-09-08 14:06 +0200
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-08 12:14 -0500
Re: Getting the exponent of an x87 float marcel hendrix <mhx@iae.nl> - 2026-09-09 02:15 +0200
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-08 14:41 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-08 19:31 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-08 05:30 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-08 05:44 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-08 23:10 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-09 01:03 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-08 20:49 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-09 13:31 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-09 20:02 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-09-10 12:46 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-07 17:21 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-07 22:13 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-05 21:27 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-09-05 21:55 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-29 07:38 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-30 11:12 +1000
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-29 13:18 -0500
Re: Getting the exponent of an x87 float Krishna Myneni <krishna.myneni@ccreweb.org> - 2026-08-28 07:25 -0500
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-28 23:43 +1000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-28 23:56 +1000
Re: Getting the exponent of an x87 float albert@spenarnc.xs4all.nl - 2026-08-27 12:38 +0200
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-26 10:55 +0000
Re: Getting the exponent of an x87 float dxf <dxforth@gmail.com> - 2026-08-26 22:55 +1000
Re: Getting the exponent of an x87 float anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2026-08-26 14:29 +0000
csiph-web