diff --git a/TODO.md b/TODO.md index 0b52d1b..a0f0d4d 100644 --- a/TODO.md +++ b/TODO.md @@ -6,8 +6,6 @@ - explicit examples support (based on `refDraws` shrink test machinery) - explicit settings support (to not depend on global environment) - [go-fuzz](https://github.com/golang/proposal/blob/master/design/draft-fuzzing.md) integration -- decide what to do with FP NaNs etc. -- document every exported symbol? ## Generators diff --git a/floats.go b/floats.go index 351963c..d3c33c3 100644 --- a/floats.go +++ b/floats.go @@ -23,18 +23,23 @@ const ( floatSignifLabel = "floatsignif" ) +// Float32 is a shorthand for Float32Range(-[math.MaxFloat32], [math.MaxFloat32]). func Float32() *Generator[float32] { return Float32Range(-math.MaxFloat32, math.MaxFloat32) } +// Float32Min is a shorthand for Float32Range(min, [math.MaxFloat32]). func Float32Min(min float32) *Generator[float32] { return Float32Range(min, math.MaxFloat32) } +// Float32Max is a shorthand for Float32Range(-[math.MaxFloat32], max). func Float32Max(max float32) *Generator[float32] { return Float32Range(-math.MaxFloat32, max) } +// Float32Range returns a generator of 32-bit floating-point numbers in range [min, max]. +// Both min and max can be infinite. func Float32Range(min float32, max float32) *Generator[float32] { assertf(min == min, "min should not be a NaN") assertf(max == max, "max should not be a NaN") @@ -50,18 +55,23 @@ func Float32Range(min float32, max float32) *Generator[float32] { }) } +// Float64 is a shorthand for Float64Range(-[math.MaxFloat64], [math.MaxFloat64]). func Float64() *Generator[float64] { return Float64Range(-math.MaxFloat64, math.MaxFloat64) } +// Float64Min is a shorthand for Float64Range(min, [math.MaxFloat64]). func Float64Min(min float64) *Generator[float64] { return Float64Range(min, math.MaxFloat64) } +// Float64Max is a shorthand for Float64Range(-[math.MaxFloat64], max). func Float64Max(max float64) *Generator[float64] { return Float64Range(-math.MaxFloat64, max) } +// Float64Range returns a generator of 64-bit floating-point numbers in range [min, max]. +// Both min and max can be infinite. func Float64Range(min float64, max float64) *Generator[float64] { assertf(min == min, "min should not be a NaN") assertf(max == max, "max should not be a NaN")