Deutsch English Français Italiano |
<v6e8vu$bdbc$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.misty.com!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Gerry Jackson <do-not-use@swldwa.uk> Newsgroups: comp.lang.forth Subject: Re: exercise in double number arithmetic Date: Sun, 7 Jul 2024 15:33:37 +0100 Organization: A noiseless patient Spider Lines: 39 Message-ID: <v6e8vu$bdbc$1@dont-email.me> References: <v6c8v0$3usoe$1@dont-email.me> <9c8e8993d3413e65caf355ecc6ceea31@www.novabbs.com> <v6cl84$obt$2@dont-email.me> <5027ddf17f1061435c0ef1df0c5a2061@www.novabbs.com> <v6e4gn$bjep$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Sun, 07 Jul 2024 16:33:34 +0200 (CEST) Injection-Info: dont-email.me; posting-host="dc2b2cdc9c10d028c511bb5024759f23"; logging-data="374124"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18EQnXZK97EInY2GQgEtRh4n5pBGuhp06o=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:cU1btq3Awzzz9tFXVQ6ryYjRPoQ= In-Reply-To: <v6e4gn$bjep$1@dont-email.me> Content-Language: en-GB Bytes: 2202 On 07/07/2024 14:17, Krishna Myneni wrote: > On 7/7/24 00:48, Ahmed wrote: >> On Sat, 6 Jul 2024 23:50:28 (UTC), Krishna Myneni wrote: >> >>> On 7/6/24 16:59, Ahmed wrote: >> ... >>> : solution ( -- d) >>> 1 s>d 43 22 do i 1 m*/ loop d>f >>> 21 dup s>d rot 2 do I 1 m*/ loop d>f >>> f/ fround f>d ; >>> >> ... >>> Krishna >> >> >> You have not to use fround. (42!/21!) is an integer and is multiple of >> 21!. >> in other words 42! is multiple of (21!)^2. >> > > The FROUND is necessary because 42!/21! is too large of an integer to be > exactly represented by double-precision fp (IEEE format) and F>D is a > truncating operation, not rounding. > > The whole D>F and floating point operations can be dispensed with if we > have D/MOD -- a double length version /MOD. > > -- > Krishna > > There is a +D/MOD in this link http://www3.cs.stonybrook.edu/~algorith/implement/random-number/distrib/r250.seq -- Gerry