Github user sameeragarwal commented on a diff in the pull request:
https://github.com/apache/spark/pull/11894#discussion_r57088641
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala
---
@@ -748,7 +748,7 @@ case class Round(child: Expression, scale: Expression)
if (f.isNaN || f.isInfinite) {
f
} else {
- BigDecimal(f).setScale(_scale, HALF_UP).toFloat
+ BigDecimal(f.toDouble).setScale(_scale, HALF_UP).toFloat
--- End diff --
might be nice to use `.toString` here:
```scala
scala> System.out.println(BigDecimal(1.745f.toDouble))
1.7450000047683716
scala> System.out.println(BigDecimal(1.745f.toString))
1.745
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]