nswamy commented on a change in pull request #11377: [MXNET-564] Fix the Flaky
test on arange
URL: https://github.com/apache/incubator-mxnet/pull/11377#discussion_r198749531
##########
File path:
scala-package/core/src/test/scala/org/apache/mxnet/OperatorSuite.scala
##########
@@ -233,8 +233,13 @@ class OperatorSuite extends FunSuite with
BeforeAndAfterAll
val start = scala.util.Random.nextFloat() * 5
Review comment:
This is good find @lanking520 @andrewfayres, the precision is lost on the
decimal part when it overflows with float. Declaring start, stop, step as
doubles would just solve the problem. I would use just a double here instead of
bigdecimal since its slow and unnecessary and this code pattern would soon
start trickling to other tests. See the example that Andrew showed me with
floats that doesn't work and max is very very close to upper bound with
doubles.
```
scala> ( 3.969419d until 96.70541d by
.00005197525d).flatMap(x=>Array.fill[Double](1)(x)).last
res3: Double = 96.70537523623696
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services