Closed phadej closed 2 years ago
Looks like at least a nice starting point. Cc @Bodigrim
Thx!
Does this code generate negative zero?
Does this code generate negative zero?
It doesn't. I'll add it.
I’d also advocate for plus and minus infinity. Since those sometimes have semantic meaning. Ish. And or the smallest and largest magnitude finite floats.
Nans don’t matter / should be runtime exceptions ;)
With infinities you easily get yourself into NaN-land, at which point almost every property is false. That feels like arbitrary choice, who's life you want to make easier/harder
Double
s in their business data types (who probably know less well, to not use Double
there).(1/0.0 :: Double) - (1/0.0 :: Double)
NaN
Touche. Either way nontrivial chance of zeros or duplicates will go a long way!
For a lotta applied math codes, random all distinct numbers in floating point guarantees the code will work almost too well. :)
On Sat, May 16, 2020 at 4:11 PM Oleg Grenrus notifications@github.com wrote:
With infinities you easily get yourself into NaN-land, at which point almost every property is false. That feels like arbitrary choice, who's life you want to make easier/harder
- People testing numeric code (who probably know what they are doing)
- People with some Doubles in their business data types (who probably know less well, to not use Double there).
(1/0.0 :: Double) - (1/0.0 :: Double)NaN
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nick8325/quickcheck/pull/297#issuecomment-629699926, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAABBQVALCS7RF3DTFVSOK3RR3XODANCNFSM4NDA2HAQ .
i emphatically support this change, it seems like it will help MANY people
Resolved conflict.
@nick8325 ping
Sorry for my extremely slow response to this patch - it looks really useful! Merged now.
Tries to address comments in https://github.com/nick8325/quickcheck/issues/295 and https://github.com/nick8325/quickcheck/pull/296
Doesn't change how arbitrarySizedFractional works. Now it is only used for (Ratio a) instance.
Also two properties which should fail everytime: the Double generator has a chance of generating same values, and it also hits values which break addition associativity.
My take on #295