Skip to main content

float_to_255

Converts a float value between 0 and 1 (inclusive) to an integer between 0 and 255 (inclusive).

def float_to_255(
c: float
) - > int

Converts a float value between 0 and 1 (inclusive) to an integer between 0 and 255 (inclusive).

Parameters

NameTypeDescription
cfloatThe float value to be converted. Must be between 0 and 1 (inclusive).

Returns

TypeDescription
intThe integer equivalent of the given float value rounded to the nearest whole number.