Sha256: ea2206f7b48501320ba4c5b96e68f821dce3a4069601e0e1a76b692bc34faabd

Contents?: true

Size: 1.94 KB

Versions: 10

Compression:

Stored size: 1.94 KB

Contents

<p>Note: M[UMPS] has an operator called "modulo".
When both operands are positive numbers, "modulo" has a result that looks a lot like "remainder";
however, there is an important difference.</p>

<p>To better understand the intricacies of "modulo" and how it is
different from "remainder", see Donald Knuth's definition (Volume 1 of the "big books"), or
find out the beauty of cyclic algebra as formulated by Niels Henrik Abel (August 5, 1802 – April 6, 1829).</p>

Arith(first,second)	; Mathematical operators
	Write "Plus",?12,first,"+",second,?25," = ",first+second,!
	Write "Minus",?12,first,"-",second,?25," = ",first-second,!
	Write "Multiply",?12,first,"*",second,?25," = ",first*second,!
	Write "Divide",?12,first,"/",second,?25," = ",first/second,!
	Write "Int Divide",?12,first,"\",second,?25," = ",first\second,!
	Write "Power",?12,first,"**",second,?25," = ",first**second,!
	Write "Modulo",?12,first,"#",second,?25," = ",first#second,!
	Write "And",?12,first,"&amp;",second,?25," = ",first&amp;second,!
	Write "Or",?12,first,"!",second,?25," = ",first!second,!
	Quit

Do Arith(2,3)
Plus        2+3           = 5
Minus       2-3           = -1
Multiply    2*3           = 6
Divide      2/3           = .6666666666666666667
Int Divide  2\3           = 0
Power       2**3          = 8
Modulo      2#3           = 2
And         2&amp;3           = 1
Or          2!3           = 1
 
Do Arith(16,0.5)
Plus        16+.5         = 16.5
Minus       16-.5         = 15.5
Multiply    16*.5         = 8
Divide      16/.5         = 32
Int Divide  16\.5         = 32
Power       16**.5        = 4
Modulo      16#.5         = 0
And         16&amp;.5         = 1
Or          16!.5         = 1
 
Do Arith(0,2)
Plus        0+2           = 2
Minus       0-2           = -2
Multiply    0*2           = 0
Divide      0/2           = 0
Int Divide  0\2           = 0
Power       0**2          = 0
Modulo      0#2           = 0
And         0&amp;2           = 0
Or          0!2           = 1

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.6 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.6 files.zettacode2/arithmetic.integer/mumps.txt
zettacode-0.1.5 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.5 files.zettacode2/arithmetic.integer/mumps.txt
zettacode-0.1.4 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.4 files.zettacode2/arithmetic.integer/mumps.txt
zettacode-0.1.3 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.2 files.zettacode/arithmetic.integer/mumps.txt
zettacode-0.1.1 zettacode.files/arithmetic.integer/mumps.txt