Skip to content
This repository has been archived by the owner on Aug 24, 2021. It is now read-only.

Verify nonZeroDouble generator #231

Closed
jcornaz opened this issue Oct 26, 2020 · 1 comment
Closed

Verify nonZeroDouble generator #231

jcornaz opened this issue Oct 26, 2020 · 1 comment
Assignees

Comments

@jcornaz
Copy link
Owner

jcornaz commented Oct 26, 2020

The current implementation looks suspicious:

fun Generator.Companion.nonZeroDoubles(
    min: Double = -Double.MAX_VALUE,
    max: Double = Double.MAX_VALUE
): Generator<Double> =
    negativeDoubles(min) + doubles(Double.MIN_VALUE, max)

Verify that it is properly tested, and works correctly.

@jcornaz jcornaz self-assigned this Oct 26, 2020
@jcornaz
Copy link
Owner Author

jcornaz commented Oct 26, 2020

Actually the implementation is correct.

And tested:

I got confused because of Double.MIN_VALUE having a very different semantic than Int.MIN_VALUE.

  • Int.MIN_VALUE returns the smallest possible int (which is negative).
  • Double.MIN_VALUE returns the smallest, non-zero, positive value.

@jcornaz jcornaz closed this as completed Oct 26, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant