Skip to content

Commit

Permalink
#37 Fixed up precision
Browse files Browse the repository at this point in the history
  • Loading branch information
mdedetrich committed Jul 26, 2017
1 parent fcaa8d1 commit a6f610b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion shared/src/main/scala-2.10/scalajson.ast/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ package object ast {
private[ast] def toDouble(value: String): Option[Double] = {
try {
val asDouble = value.toDouble
if (BigDecimal(value) == BigDecimal(asDouble))
if (BigDecimal(value, MathContext.UNLIMITED) == BigDecimal(asDouble, MathContext.UNLIMITED))
Some(asDouble)
else
None
Expand Down
2 changes: 1 addition & 1 deletion shared/src/main/scala/scalajson/ast/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ package object ast {
private[ast] def toDouble(value: String): Option[Double] = {
try {
val asDouble = value.toDouble
if (BigDecimal(value) == BigDecimal(asDouble))
if (BigDecimal(value, MathContext.UNLIMITED) == BigDecimal(asDouble, MathContext.UNLIMITED))
Some(asDouble)
else
None
Expand Down

0 comments on commit a6f610b

Please sign in to comment.