groff
[Top][All Lists]

## Re: neatroff for Russian. (Was: Questions concerning hyphenation pattern

 From: Alejandro Colomar Subject: Re: neatroff for Russian. (Was: Questions concerning hyphenation patterns for non-Latin languages, e.g. Russian) Date: Fri, 28 Apr 2023 01:41:20 +0200 User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0

```Hi Branden,

On 4/27/23 05:07, G. Branden Robinson wrote:
> [0] If you're like me, the idea of a "20.1-bit" quantity sounds weird.
>     You can't encode a tenth of a bit in a single logic gate, or one
>     position in a machine register.  The key is to think in terms of
>     information theory, not digital logic.  Unicode has decided that its
>     range of valid code points is zero to 0x10FFFF.  That's 1114111
>     decimal.  That number (plus one for code point 0) is the number of
>     distinct characters encodable in Unicode.  The base 2 logarithm of
>     that is...
>
>     \$ python3 -c "import math; print(math.log(1114112, 2))"
>     20.087462841250343

You don't need python3 for that:

\$ echo 'l(1114112) / l(2)' | bc -l
20.08746284125033940845

You might notice there's a difference in the decimals.  bc(1) is the
more accurate, according to Wolfram Alpha.  (My physical calculator
doesn't have enough precision to contrast).  All digits provided by
bc(1) are correct, while python3 is printing more than it's capable
of.  I guess python3 is using a 'double', which usually has around 15
digits of precission.  bc(1) on the contrary, is likely to be using
'long double', for being able to provide so many digits.

Of course, bc(1) is way smaller:

\$ ls \$(which python3.11) -lh
-rwxr-xr-x 1 root root 6.6M Mar 13 13:18 /usr/bin/python3.11
\$ ls \$(which bc) -lh
-rwxr-xr-x 1 root root 95K Sep  5  2021 /usr/bin/bc

And of course it's faster:

\$ time echo 'l(1114112) / l(2)' | bc -l
20.08746284125033940845

real    0m0.003s
user    0m0.005s
sys     0m0.000s
\$ time python3 -c "import math; print(math.log(1114112, 2))"
20.087462841250343

real    0m0.015s
user    0m0.011s
sys     0m0.004s

Cheers,
Alex
--
<http://www.alejandro-colomar.es/>
GPG key fingerprint: A9348594CE31283A826FBDD8D57633D441E25BB5
```

OpenPGP_signature
Description: OpenPGP digital signature