Path: csiph.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: peter Newsgroups: comp.lang.forth Subject: Re: Getting the exponent of an x87 float Date: Wed, 19 Aug 2026 09:58:09 +0200 Organization: A noiseless patient Spider Lines: 32 Message-ID: <20260819095809.000026dc@tin.it> References: <115qthh$3pnrg$1@dont-email.me> <2026Aug17.171145@mips.complang.tuwien.ac.at> <6a834928$1@news.ausics.net> <11626b8$v1c9$3@paganini.bofh.team> <6a852781$1@news.ausics.net> <6a8557d4$1@news.ausics.net> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Injection-Date: Wed, 19 Aug 2026 07:58:09 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2574013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18PihXCS3MBXnav+ttYsPzcJFSsZfaRqM0="; posting-host="0be0f770179c65807d530684cf27b862" Cancel-Lock: sha1:ud2hmj2PYFfOG9Toai12SgdzG1k= sha256:u2WAWl5BAWt8//LukdAgrmgEphxzxHhzbRe7lIfEHdo= sha1:MvL6gul1EmliG2OQuhnh8/jGNe4= sha256:Nny9OlooN/ouHXlOtedJig8hmhjgDGoRzYyh1MKrmX4= X-Newsreader: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Xref: csiph.com comp.lang.forth:135371 On Wed, 19 Aug 2026 17:14:28 +1000 dxf wrote: > On 19/08/2026 1:48 pm, dxf wrote: > > ... > > In my case > > I ... used REPRESENT to calculate the exponent of > > 1E-3. > > Hmm, testing shows REPRESENT to be way worse than an unpatched FLOG > for grabbing the exponent. If the following fails I give up! > > : (G.) ( F: r -- ) ( n -- c-addr u ) > >R FDUP FABS FDUP 1E-3 F< 0= >R 1E6 F< R> AND > R> SWAP IF (F.) ELSE (FS.) THEN ; > What does the n do. It looks like it just remains on the stack. I have : E. ( F: r -- ) fdup (e.) dup >r (es.) dup r> < if 2swap then 2drop type space ; to decide what output function to use. It works as (f.) (fs.) uses a circular buffer with 16 slots. (e.) (es.) are variants of (f.) (fs.) BR Peter