nextfloat

nextfloat(f)

Get the next floating point number in lexicographic order

Examples

julia> nextfloat(1.0)
1.0000000000000002

julia> nextfloat(3.14)
3.1400000000000006

julia> nextfloat(2.0)
2.0000000000000004

This function returns the next floating-point number in lexicographic order relative to the input f. It is useful for iterating over floating-point numbers or performing computations involving floating-point numbers.

Common mistake example:

julia> nextfloat(Inf)
Inf

In this example, calling nextfloat on infinity returns infinity itself. It's important to note that nextfloat operates within the finite range of representable floating-point numbers and cannot generate numbers beyond that range.

See Also

cmp, float, get_bigfloat_precision, get_rounding, get_zero_subnormals, isapprox, maxintfloat, mod2pi, nextfloat, precision, prevfloat, rationalize, round, set_bigfloat_precision, set_rounding, set_zero_subnormals, significand, with_bigfloat_precision, with_rounding,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field
Details

Checking you are not a robot: