Arbitrary-precision integers (included): Difference between revisions
Arbitrary-precision integers (included) (view source)
Revision as of 22:35, 12 April 2024
, 1 month ago→{{header|langur}}
(adding lambdatalk) |
Langurmonkey (talk | contribs) |
||
(15 intermediate revisions by 6 users not shown) | |||
Line 1,025:
=={{header|Fōrmulæ}}==
{{FormulaeEntry|page=https://formulae.org/?script=examples/Arbitrary-precision_integers_%28included%29}}
'''Solution'''
In the following script, the result is converted to a string, in order to calculate its size, and its first/last digits.
[[File:Fōrmulæ - Arbitrary-precision integers (included) 01.png]]
[[File:Fōrmulæ - Arbitrary-precision integers (included) 02.png]]
=={{header|GAP}}==
Line 1,196 ⟶ 1,200:
"62060698786608744707"
julia> bigstr[end-
"
=={{header|Klong}}==
Line 1,233 ⟶ 1,237:
=={{header|langur}}==
Arbitrary precision is native in langur.
<syntaxhighlight lang="langur">val .
val .xs = toString .x▼
writeln .len, " digits"
s2s(.xs, .len-19 .. .len) == "92256259918212890625" {
if .first20 == "62060698786608744707" and .last20 == "92256259918212890625" {▼
writeln "SUCCESS"
}
</syntaxhighlight>
Line 1,968 ⟶ 1,967:
{{works with|Rakudo|2022.07}}
<syntaxhighlight lang="raku" line>
given [**] 5, 4, 3, 2 {
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,168 ⟶ 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,500 ⟶ 2,504:
{{libheader|Wren-fmt}}
{{libheader|Wren-big}}
<syntaxhighlight lang="
import "./big" for BigInt
var p = BigInt.three.pow(BigInt.two)
|