Arbitrary-precision integers (included): Difference between revisions
Arbitrary-precision integers (included) (view source)
Revision as of 05:40, 10 May 2024
, 19 days ago→{{header|langur}}
Langurmonkey (talk | contribs) |
|||
(6 intermediate revisions by 4 users not shown) | |||
Line 1,237:
=={{header|langur}}==
Arbitrary precision is native in langur.
<syntaxhighlight lang="langur">val .xs =
▲writeln .len, " digits"
▲if .len > 39 and s2s(.xs, 1..20) == "62060698786608744707" and
▲ s2s(.xs, .len-19 .. .len) == "92256259918212890625" {
writeln "SUCCESS"
}
Line 1,966 ⟶ 1,967:
{{works with|Rakudo|2022.07}}
<syntaxhighlight lang="raku" line>
given [**] 5, 4, 3, 2 {
ok ~([**] 5, 4, 3, 2) ~~ /^ '62060698786608744707' <digit>* '92256259918212890625' $/,▼
use Test;
'5**4**3**2 has expected first and last twenty digits';</syntaxhighlight>▼
printf 'This number has %d digits', .chars;
}</syntaxhighlight>
{{out}}
<pre>ok 1 - 5**4**3**2 has expected first and last twenty digits
This number has 183231 digits</pre>
=={{header|REXX}}==
Line 2,166 ⟶ 2,172:
=={{header|Sidef}}==
<syntaxhighlight lang="ruby">var x = 5**(4**(3**2))
var y = x.to_s
printf("5**4**3**2 =
{{out}}
<pre>
Line 2,498 ⟶ 2,504:
{{libheader|Wren-fmt}}
{{libheader|Wren-big}}
<syntaxhighlight lang="
import "./big" for BigInt
var p = BigInt.three.pow(BigInt.two)
|