Arithmetic/Integer: Difference between revisions

Content added Content deleted
(added ReScript)
m (→‎{{header|ALGOL 68}}: changed some wording)
Line 450: Line 450:
a UP b = a**b = a↑b = +1.499007808785573768814747570e+288
a UP b = a**b = a↑b = +1.499007808785573768814747570e+288
</pre>
</pre>
[[ALGOL 68R]] has the curious (and consequently non-standard) '/:=' operator. This operator
[[ALGOL 68R]] has a non-standard '/:=' operator. This operator
is equivalent to the OVERAB operator of the revised report, except it delivers the remainder as a result.
is equivalent to the OVERAB operator of the revised report, except it delivers the remainder as a result.
So a '/:=' b sets a to the quotient of a%b and returns the remainder of a%b as a result.
So a '/:=' b sets a to the quotient of a%b and returns the remainder of a%b as a result (Note "%" is the division operator in Algol 68, not the modulo operator - it can also be written as OVER).
Note that it must be "stropped" i.e. enclosed in single quotes. eg.
This operator must be "stropped" i.e. enclosed in single quotes. eg.
INT quotient:=355, remainder;
INT quotient:=355, remainder;
remainder := quotient '/:=' 113;
remainder := quotient '/:=' 113;
Giving a quotient of 3, and a remainder of 16.
Sets quotient to 3, remainder to 16.


=={{header|ALGOL W}}==
=={{header|ALGOL W}}==