Skip to content
Snippets Groups Projects
Unverified Commit af6cbeb8 authored by Chris Truter's avatar Chris Truter Committed by GitHub
Browse files

Preserve sign on parenthesized zero floats when parsing (#40309)

parent 18701ae3
No related branches found
No related tags found
No related merge requests found
......@@ -153,7 +153,8 @@
:parsed-string (.substring deparenthesized-s 0 parsed-idx)
:ignored-string (.substring deparenthesized-s parsed-idx)}))))
(if has-parens?
(- parsed-number)
;; By casting to double we ensure that the sign is preserved for 0.0
(- (double parsed-number))
parsed-number))))
(defn- parse-number
......
......@@ -123,11 +123,11 @@
["-0,0" -0.0 float-or-int-type ",."]
["-0,0" -0.0 float-or-int-type ", "]
["-0.0" -0.0 float-or-int-type ".’"]
["(0.0)" 0 float-or-int-type "."] ;; These values should also be parsed as -0.0
["(0.0)" 0 float-or-int-type ".,"] ;; TODO: Fix this subtle bug in our parser 🥴
["(0,0)" 0 float-or-int-type ",."]
["(0,0)" 0 float-or-int-type ", "]
["(0.0)" 0 float-or-int-type ".’"]
["(0.0)" -0.0 float-or-int-type "."]
["(0.0)" -0.0 float-or-int-type ".,"]
["(0,0)" -0.0 float-or-int-type ",."]
["(0,0)" -0.0 float-or-int-type ", "]
["(0.0)" -0.0 float-or-int-type ".’"]
["-4300.00€" -4300 float-or-int-type ".,"]
["£1,000.00" 1000 float-or-int-type]
["£1,000.00" 1000 float-or-int-type "."]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment