Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

There are always alternatives. -- Spock, "The Galileo Seven", stardate 2822.3


devel / comp.lang.scheme / Re: (expt 9.5 400) and (expt 9.4721 400)

SubjectAuthor
* (expt 9.5 400) and (expt 9.4721 400)Hen Hanna
+* Re: (expt 9.5 400) and (expt 9.4721 400)Hen Hanna
|`- Re: (expt 9.5 400) and (expt 9.4721 400)James Cloos
`- Re: (expt 9.5 400) and (expt 9.4721 400)Paul Rubin

1
(expt 9.5 400) and (expt 9.4721 400)

<387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=143&group=comp.lang.scheme#143

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:a05:600c:4e88:b0:39c:7c53:d7ff with SMTP id f8-20020a05600c4e8800b0039c7c53d7ffmr27398606wmq.176.1655567558894;
Sat, 18 Jun 2022 08:52:38 -0700 (PDT)
X-Received: by 2002:a25:bac8:0:b0:668:d194:3700 with SMTP id
a8-20020a25bac8000000b00668d1943700mr3380072ybk.151.1655567558266; Sat, 18
Jun 2022 08:52:38 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Sat, 18 Jun 2022 08:52:37 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=2601:648:8600:d320:0:0:0:4941;
posting-account=YjTkGAoAAAA4_fbAISfvtIqrYbghMeBx
NNTP-Posting-Host: 2601:648:8600:d320:0:0:0:4941
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>
Subject: (expt 9.5 400) and (expt 9.4721 400)
From: henhanna@gmail.com (Hen Hanna)
Injection-Date: Sat, 18 Jun 2022 15:52:38 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Hen Hanna - Sat, 18 Jun 2022 15:52 UTC

here using Gauche implementation of Scheme (Lisp)
_________________________

gosh> (expt 2 10)
1024

gosh> (expt 95 400)
122868941115179737710771763422406480301757540139859458808109124467070985446636432601124226198138372384827136835747639824957217872566284270584970573806709719276387720717338491937768940125341858818232921546470367105745159050900738732857641177973934199359975283304040662214527892754581251472028550573377465974149524776907053647487276218630915991403393175918807721542352052061931828388937244412868178358157101355186823815679746336760233122803664930597166935876581382936048661922495177503814998271180126016615741029048421718399550885061036453398850989384221230496760667725343755621356110646439201800024101683783925799569271375473948166129904365762856539506504738909912793972528107696543949955683957699890196644331714953888959611025828637994242150674323852711788962466243901872076094150543212890625

gosh> (expt 9.5 300) --> 2.075303347768084e293

gosh> (expt 9.5 400) --> +inf.0

SO... With ( 9.5 ^ 400) i can get the exact value, but
what i want to do is to get an approx. value of

( A ^ 400 ) where

A is 9.47213595499958
or
A is (+ 5 (* 2 (sqrt 5)))

is there a way to do this?

Re: (expt 9.5 400) and (expt 9.4721 400)

<ca1d5b49-df83-4a4b-b80b-c69044db48bfn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=144&group=comp.lang.scheme#144

  copy link   Newsgroups: comp.lang.scheme
X-Received: by 2002:adf:d1ea:0:b0:210:3e22:51b0 with SMTP id g10-20020adfd1ea000000b002103e2251b0mr14283769wrd.72.1655568213353;
Sat, 18 Jun 2022 09:03:33 -0700 (PDT)
X-Received: by 2002:a25:e655:0:b0:668:b086:ef03 with SMTP id
d82-20020a25e655000000b00668b086ef03mr10654302ybh.173.1655568212789; Sat, 18
Jun 2022 09:03:32 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.scheme
Date: Sat, 18 Jun 2022 09:03:32 -0700 (PDT)
In-Reply-To: <387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2601:648:8600:d320:0:0:0:4941;
posting-account=YjTkGAoAAAA4_fbAISfvtIqrYbghMeBx
NNTP-Posting-Host: 2601:648:8600:d320:0:0:0:4941
References: <387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ca1d5b49-df83-4a4b-b80b-c69044db48bfn@googlegroups.com>
Subject: Re: (expt 9.5 400) and (expt 9.4721 400)
From: henhanna@gmail.com (Hen Hanna)
Injection-Date: Sat, 18 Jun 2022 16:03:33 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Hen Hanna - Sat, 18 Jun 2022 16:03 UTC

On Saturday, June 18, 2022 at 8:52:41 AM UTC-7, Hen Hanna wrote:
> here using Gauche implementation of Scheme (Lisp)
> _________________________
>
> gosh> (expt 2 10)
> 1024
>
> gosh> (expt 95 400)
> 122868941115179737710771763422406480301757540139859458808109124467070985446636432601124226198138372384827136835747639824957217872566284270584970573806709719276387720717338491937768940125341858818232921546470367105745159050900738732857641177973934199359975283304040662214527892754581251472028550573377465974149524776907053647487276218630915991403393175918807721542352052061931828388937244412868178358157101355186823815679746336760233122803664930597166935876581382936048661922495177503814998271180126016615741029048421718399550885061036453398850989384221230496760667725343755621356110646439201800024101683783925799569271375473948166129904365762856539506504738909912793972528107696543949955683957699890196644331714953888959611025828637994242150674323852711788962466243901872076094150543212890625
>
> gosh> (expt 9.5 300) --> 2.075303347768084e293
>
> gosh> (expt 9.5 400) --> +inf.0
>
>
> SO... With ( 9.5 ^ 400) i can get the exact value, but
> what i want to do is to get an approx. value of
>
> ( A ^ 400 ) where
>
> A is 9.47213595499958
> or
> A is (+ 5 (* 2 (sqrt 5)))
>
>
>
> is there a way to do this?

(expt 947213595499958 400) gives me an approx value,
but i guess i'm asking for 1000 or million times as many digits.

so it seems far beyond what my cheap PC can do.

Re: (expt 9.5 400) and (expt 9.4721 400)

<m3edzl61zi.fsf@carbon.jhcloos.org>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=145&group=comp.lang.scheme#145

  copy link   Newsgroups: comp.lang.scheme
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: cloos@jhcloos.com (James Cloos)
Newsgroups: comp.lang.scheme
Subject: Re: (expt 9.5 400) and (expt 9.4721 400)
Date: Sat, 18 Jun 2022 18:28:01 -0400
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <m3edzl61zi.fsf@carbon.jhcloos.org>
References: <387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>
<ca1d5b49-df83-4a4b-b80b-c69044db48bfn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
Injection-Info: reader02.eternal-september.org; posting-host="22f73033aef46ddeb2fc486ee5b24679";
logging-data="28555"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX180XBoYL5WnCZRvcSddcDDq"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)
Cancel-Lock: sha1:3RU9VxFZMDLwfqGwjSDw3FC6ILk=
sha1:M+c/j8Q11ZHk1ui6r2YdKXhsHz4=
Face: iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAgMAAABinRfyAAAACVBMVEX///8ZGXBQKKnCrDQ3
AAAAJElEQVQImWNgQAAXzwQg4SKASgAlXIEEiwsSIYBEcLaAtMEAADJnB+kKcKioAAAAAElFTkSu
QmCC
Copyright: Copyright 2022 James Cloos
OpenPGP-Fingerprint: E9E9 F828 61A4 6EA9 0F2B 63E7 997A 9F17 ED7D AEA6
OpenPGP: 0x997A9F17ED7DAEA6; url=https://jhcloos.com/public_key/0x997A9F17ED7DAEA6.asc
 by: James Cloos - Sat, 18 Jun 2022 22:28 UTC

i’m not up on scheme’s details, but with common lisp those floats
default to single-float, which is usually implemente these days with
a 32-bit ieee float.

using l as the delimiter between the significand and the exponent
will generate a long-float, with more resolution.

on an arm64 sbc, and using ecl, i get:

> (expt (+ 5l0 (* 2l0 (sqrt 5l0))) 400)

3.7946276521800698015l390

for more digits one’d need to use multi-precision floats.

i have no idea whether any scheme implementations include any mp float
support as is, but they should let you use an extertnal library such as
mpfr for that.

your pc is certainly good enough; you just need the right software.

(they do not make any these dayswhich are not good enough; not even at
the sub-$30 price point.)

In maxima:

(%i3) (2b0*sqrt(5b0)+5b0)^400b0,fpprec:999;
(%o3) 3.7946276521800697305666550087536192992115769295190551691665658622025488\
195527774282584577158133760363054128087496967891514764773751875434079622491760\
760697880911146535967511959796900645429566665476227663091405183155412705120528\
107603481804507230138239252996700097573900617537077884807268892365403939464952\
884993314087737184104485796978046070820564123621254637441779777873307466506958\
007812499999999999999999999999999999999999999999999999999999999999999999999999\
999999999999999999999999999999999999999989794540413933744145337696735909814614\
790479700848425376607266434711262904353407710432649693087316786760610501184349\
347109985584947803067028202580520987298601120677255115594828007214424540451843\
222471830925057425575004834959741740703164533089752802924419634880343840285041\
613337373169098123721455216932346242326642176737006286464924950409814547065789\
596130406436031620557787620213303967542302476673429612247644081703293433164688\
6414110731231241578737816677781912052635857679622387021664384404205661b390

(the b means bfloat, fpprec is the bfloat precision.)

-JimC
--
James Cloos <cloos@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6

Re: (expt 9.5 400) and (expt 9.4721 400)

<87bkupob5s.fsf@nightsong.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=146&group=comp.lang.scheme#146

  copy link   Newsgroups: comp.lang.scheme
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: no.email@nospam.invalid (Paul Rubin)
Newsgroups: comp.lang.scheme
Subject: Re: (expt 9.5 400) and (expt 9.4721 400)
Date: Sat, 18 Jun 2022 15:32:31 -0700
Organization: A noiseless patient Spider
Lines: 19
Message-ID: <87bkupob5s.fsf@nightsong.com>
References: <387f41b0-a309-491b-b4ce-3497d2c50772n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: reader02.eternal-september.org; posting-host="c3bc43b87f7e12045c10ff09e459e8ad";
logging-data="17184"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Sq4tOQM2xw9LQA3EH8WKA"
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux)
Cancel-Lock: sha1:tJr0N5bneNC8s7znCvDBErQA62o=
sha1:0vSGrjz/2w0DifwNVtXrj+l3Usc=
 by: Paul Rubin - Sat, 18 Jun 2022 22:32 UTC

Hen Hanna <henhanna@gmail.com> writes:
> is there a way to do this?

The issue is that 9.5**400 is around 1e390 which is larger than the ieee
fp64 maximum value of around 1e308. While there is an extended format
with a wider range, it is probably simplest to use logarithms:

(define (log10 x) (/ (log x) (log 10.0)))

(define x0 (+ 5 (* 2 (sqrt 5)))) ; 9.472...

(define y0 (* 400.0 (log10 x0))) ; log10(x0**400)

(let* ((y1 (floor y0))
(y2 (- y0 y1)))
(display `(,(expt 10 y2) "* 10**" ,y1)))
(newline)

prints (3.794627652179525 * 10** 390.0) when I try it in Guile.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor