Arithmetic/Integer: Difference between revisions

Content added Content deleted
(→‎{{header|Chef}}: fixed errors - works on ubuntu with acme::chef)
No edit summary
Line 424: Line 424:
putStrLn $ "a `div` b = " ++ show (a `div` b) -- truncates towards negative infinity
putStrLn $ "a `div` b = " ++ show (a `div` b) -- truncates towards negative infinity
putStrLn $ "a `mod` b = " ++ show (a `mod` b) -- same sign as second operand
putStrLn $ "a `mod` b = " ++ show (a `mod` b) -- same sign as second operand
putStrLn $ "a `divMod` b = " ++ show (a `divMod` b)
putStrLn $ "a `quot` b = " ++ show (a `quot` b) -- truncates towards 0
putStrLn $ "a `quot` b = " ++ show (a `quot` b) -- truncates towards 0
putStrLn $ "a `rem` b = " ++ show (a `rem` b) -- same sign as first operand</lang>
putStrLn $ "a `rem` b = " ++ show (a `rem` b) -- same sign as first operand
putStrLn $ "a `quotRem` b = " ++ show (a `quotRem` b)</lang>


=={{header|haXe}}==
=={{header|haXe}}==
Line 790: Line 792:
# truncates towards negative infinity
# truncates towards negative infinity
print "Remainder: %d" % (x % y) # same sign as second operand
print "Remainder: %d" % (x % y) # same sign as second operand
print "Quotient: %d with Remainder: %d" % divmod(x, y)


## Only used to keep the display up when the program ends
## Only used to keep the display up when the program ends