question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Positive infinity being returned for Arb.negativeFloat() and vice versa

See original GitHub issue

I’m using io.kotest:kotest-property:5.0.2 on jvm

Maybe this isn’t a bug but it is unexpected. It appears that both positive and negative infinity are being returned in each of the Arb.negativeFloat() etc generators.

When I run:

println("positiveFloat: ${Arb.positiveFloat().edgecases(10_000)}")
println("negativeFloat: ${Arb.negativeFloat().edgecases(10_000)}")
println("positiveDouble: ${Arb.positiveDouble().edgecases(10_000)}")
println("negativeDouble: ${Arb.negativeDouble().edgecases(10_000)}")

This is what I get:

positiveFloat: [3.4028235E38, Infinity, 1.0, NaN, 1.4E-45, -Infinity]
negativeFloat: [-3.4028235E38, -1.0, -Infinity, -1.4E-45, NaN, Infinity]
positiveDouble: [Infinity, 1.7976931348623157E308, NaN, 4.9E-324, 1.0, -Infinity]
negativeDouble: [NaN, Infinity, -1.7976931348623157E308, -4.9E-324, -1.0, -Infinity]

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
myuwonocommented, Mar 15, 2022

@sksamuel I’ll look into this today

0reactions
sksamuelcommented, Mar 15, 2022

Will fix for 5.2.2

Read more comments on GitHub >

github_iconTop Results From Across the Web

Testing for positive infinity, or negative infinity, individually in ...
What's the pythonic way to test for them distinctly? Ways to test for positive infinity: x == float('+inf'); math.isinf(x) and x > 0....
Read more >
std::numeric_limits<T>::infinity - cppreference.com
std::numeric_limits<T>::infinity ... Returns the special value "positive infinity", as represented by the floating-point type T . Only meaningful ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found