Uranium
Application Framework
Loading...
Searching...
No Matches
UM.Math.Float.Float Class Reference

Static Public Member Functions

bool fuzzyCompare (float f1, float f2, float tolerance=1e-8)
 
float clamp (float f1, float minimum, float maximum)
 

Detailed Description

Class containing helper functions for dealing with IEEE-754 floating point numbers.

Member Function Documentation

◆ clamp()

float UM.Math.Float.Float.clamp ( float f1,
float minimum,
float maximum )
static
Return the value clamped to a minimum and maximum value.

:param f1: :type{float} The value to clamp.
:param minimum: :type{float} The minimum value.
:param maximum: :type{float} The maximum value.

:return: :type{float} Minimum if f1 < minimum, maximum if f1 > maximum, else f1.

◆ fuzzyCompare()

bool UM.Math.Float.Float.fuzzyCompare ( float f1,
float f2,
float tolerance = 1e-8 )
static
Compare two floats to check if they are equal with a tolerance value.

This method will compare two floats and check whether they are equal to
within a certain tolerance value.

:param f1: :type{float} The first value to compare.
:param f2: :type{float} The second value to compare.
:param tolerance: The amount of tolerance used to consider the two numbers "equal".

:return: True if the two numbers are considered equal, False if not.

The documentation for this class was generated from the following file: