Exponentiation order: Difference between revisions

m
→‎{{header|Wren}}: Changed to Wren S/H
imported>KayproKid
m (Fixed ALGOL-M header)
m (→‎{{header|Wren}}: Changed to Wren S/H)
 
(One intermediate revision by one other user not shown)
Line 1,274:
(5**3)**2 = 15625
5**(3**2) = 1953125
</pre>
 
=={{header|S-BASIC}}==
The exponentiation operator ^ works on both integer and real operands. Numeric constants in expressions are taken to be of type real, which is useful here, because the third result exceeds S-BASIC's manximum integer value of 32767.
<syntaxhighlight lang = "BASIC">
print "5^3^2 : "; 5 ^ 3 ^ 2
print "(5^3)^2 : "; (5 ^ 3) ^ 2
print "5^(3^2) : "; 5 ^ (3 ^ 2)
 
end
</syntaxhighlight>
{{out}}
<pre>
5^3^2 : 15625
(5^3)^2 : 15625
5^(3^2) : 1.95312E+6
</pre>
 
Line 1,469 ⟶ 1,485:
{{libheader|Wren-fmt}}
Wren doesn't have an exponentiation operator as such but the Num class has a ''pow'' method which does the same thing.
<syntaxhighlight lang="ecmascriptwren">import "./fmt" for Fmt
 
var ops = [ "5**3**2", "(5**3)**2", "5**(3**2)" ]
9,485

edits