scalatest / scalatest

A testing tool for Scala and Java developers
Apache License 2.0
1.15k stars 336 forks source link

Investigate Randomizer.nextFloat and nextDouble in light of nextFiniteDouble #1468

Open jducoeur opened 5 years ago

jducoeur commented 5 years ago

See the TODO on this line, which suggests that we aren't quite sure about the behavior at these extreme edge conditions, and somebody should investigate that.

bvenners commented 5 years ago

I think what happened is I took the algo for next double from ScalaCheck, without understanding it. I wanted to back later and understand it. So I will do that. Here's the one from ScalaCheck:

https://github.com/rickynils/scalacheck/blob/a10ce6d832ce20fa5bae0ffcdfa664c5b229c173/src/main/scala/org/scalacheck/Arbitrary.scala#L114

And here's ours:

https://github.com/scalatest/scalatest/blob/37cc3fd66e28b6b5e538586cb9cfcd343d4e54e8/scalatest/src/main/scala/org/scalatest/prop/Randomizer.scala#L75

They look pretty similar. I'll study up on IEEE 754 and document it.