```zsh-users
help / color / mirror / code / Atom feed```
```* loooong number
@ 2022-07-05 15:19 Ray Andrews
2022-07-05 15:27 ` Dominik Vogt
0 siblings, 1 reply; 4+ messages in thread
From: Ray Andrews @ 2022-07-05 15:19 UTC (permalink / raw)
To: Zsh Users

Gentlemen:

I don't think zsh can do this but she does amaze very often so I'll ask:

My sister is memorizing Euler's number, she's at 200 digits and
climbing.  She wants me to print it off in blocks of four digits. I
can't find exactly that format online.  Now, the formula for the number
is easy but the output of course is going to be a floating point number
of 200 and counting digits which of course zsh can't handle.  But it
occurred to me that if the digits could be computed one at a time (as we
can do for pi), then the output could be treated as a simple string to
which digits are added indefinitely.  I guess this is really a
mathematical question, strictly speaking, but somebody might know.

^ permalink raw reply	[flat|nested] 4+ messages in thread```

```* Re: loooong number
2022-07-05 15:19 loooong number Ray Andrews
@ 2022-07-05 15:27 ` Dominik Vogt
2022-07-05 15:37   ` Dominik Vogt
2022-07-05 15:37   ` Ray Andrews
0 siblings, 2 replies; 4+ messages in thread
From: Dominik Vogt @ 2022-07-05 15:27 UTC (permalink / raw)
To: zsh-users

On Tue, Jul 05, 2022 at 08:19:21AM -0700, Ray Andrews wrote:
> Now, the formula for the number is easy but the output
> of course is going to be a floating point number of 200 and counting digits
> which of course zsh can't handle.  But it occurred to me that if the digits
> could be computed one at a time (as we can do for pi), then the output could
> be treated as a simple string to which digits are added indefinitely.  I
> guess this is really a mathematical question, strictly speaking, but
> somebody might know.

"bc" can do calculations in arbitrary precision:

-- snip --
\$ bc -l
bc 1.07.1
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006, 2008, 2012-2017 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
scale=5
e(1)
2.71828
scale=200
e(1)
2.718281828459045235360287471352662497757247093699959574966967627724\
07663035354759457138217852516642742746639193200305992181741359662904\
357290033429526059563073813232862794349076323382988075319525101901
-- snip --

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt

^ permalink raw reply	[flat|nested] 4+ messages in thread```

```* Re: loooong number
2022-07-05 15:27 ` Dominik Vogt
@ 2022-07-05 15:37   ` Dominik Vogt
2022-07-05 15:37   ` Ray Andrews
1 sibling, 0 replies; 4+ messages in thread
From: Dominik Vogt @ 2022-07-05 15:37 UTC (permalink / raw)
To: zsh-users

On Tue, Jul 05, 2022 at 04:27:52PM +0100, Dominik Vogt wrote:
> On Tue, Jul 05, 2022 at 08:19:21AM -0700, Ray Andrews wrote:
> > Now, the formula for the number is easy but the output
> > of course is going to be a floating point number of 200 and counting digits
> > which of course zsh can't handle.  But it occurred to me that if the digits
> > could be computed one at a time (as we can do for pi), then the output could
> > be treated as a simple string to which digits are added indefinitely.  I
> > guess this is really a mathematical question, strictly speaking, but
> > somebody might know.
>
> "bc" can do calculations in arbitrary precision:

\$ export BC_LINE_LENGTH=0
\$ echo "scale=200;e(1)"| bc -l | sed -e "s/\([0-9][0-9][0-9][0-9]\)/\1 /g"
2.7182 8182 8459 0452 3536 0287 4713 5266 2497 7572 4709 3699 9595 7496 6967 6277 2407 6630 3535 4759 4571 3821 7852 5166 4274 2746 6391 9320 0305 9921 8174 1359 6629 0435 7290 0334 2952 6059 5630 7381 3232 8627 9434 9076 3233 8298 8075 3195 2510 1901

Ciao

Dominik ^_^  ^_^

--

Dominik Vogt

^ permalink raw reply	[flat|nested] 4+ messages in thread```

```* Re: loooong number
2022-07-05 15:27 ` Dominik Vogt
2022-07-05 15:37   ` Dominik Vogt
@ 2022-07-05 15:37   ` Ray Andrews
1 sibling, 0 replies; 4+ messages in thread
From: Ray Andrews @ 2022-07-05 15:37 UTC (permalink / raw)
To: zsh-users

On 2022-07-05 08:27, Dominik Vogt wrote:
> "bc" can do calculations in arbitrary precision:
...
> scale=200
> e(1)
> 2.718281828459045235360287471352662497757247093699959574966967627724\
> 07663035354759457138217852516642742746639193200305992181741359662904\
> 357290033429526059563073813232862794349076323382988075319525101901
> -- snip --
>
> Ciao
>
> Dominik ^_^  ^_^
>
> --
>
> Dominik Vogt
>
That is so fantastic that I almost passed out when I saw it.  As easy as
that??
I am in your debt good sir.

^ permalink raw reply	[flat|nested] 4+ messages in thread```

```end of thread, other threads:[~2022-07-05 15:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-05 15:19 loooong number Ray Andrews
2022-07-05 15:27 ` Dominik Vogt
2022-07-05 15:37   ` Dominik Vogt
2022-07-05 15:37   ` Ray Andrews
```

```Code repositories for project(s) associated with this public inbox

https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).```