fix: negation on negative number
This commit is contained in:
parent
53fa9cfa26
commit
05f89b991d
@ -81,6 +81,7 @@ module Data.MathExpr
|
||||
-- negative numbers come in the form ["num", "-"]
|
||||
helper [] [o] = read o
|
||||
helper [n, "-"] [] = negate . read $ n
|
||||
helper ["-"] [n] = negate . read $ n
|
||||
helper (c:cs) os
|
||||
| c == "-" && length os < 2 =
|
||||
let result :: Double = negate . read . head $ cs
|
||||
|
Loading…
Reference in New Issue
Block a user