In order to find the predecessor of a floating-point number, we use the prev_float
method.
float_value.prev_float
float_value
: This is the float value whose predecessor value we want to find.
The predecessor of float_value
is returned.
# create some float valuesf1 = 2.3f2 = -1.0f3 = 0.1111111f4 = 200.00# get previous values# and print resultsputs f1.prev_floatputs f2.prev_floatputs f3.prev_floatputs f4.prev_float
f1
, f2
, f3
, and f4
.prev_float
method on the float values and print the results to the console.