mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-11 12:37:32 +03:00
Issue #256 The interpreter should use integer division (Haskell quot
) when dealing with integers in order to match the behaviour of the compiler
This commit is contained in:
parent
e00bdd1df0
commit
42ec03a293
@ -661,6 +661,8 @@ commandMinus [a, b] =
|
||||
commandDiv :: CommandCallback
|
||||
commandDiv [a, b] =
|
||||
return $ case (a, b) of
|
||||
(XObj (Num IntTy aNum) _ _, XObj (Num IntTy bNum) _ _) ->
|
||||
Right (XObj (Num IntTy (fromIntegral (quot (round aNum ::Int) (round bNum :: Int)))) (Just dummyInfo) (Just IntTy))
|
||||
(XObj (Num aty aNum) _ _, XObj (Num bty bNum) _ _) ->
|
||||
if aty == bty
|
||||
then Right (XObj (Num aty (aNum / bNum)) (Just dummyInfo) (Just aty))
|
||||
|
Loading…
Reference in New Issue
Block a user