Open Search
    Compare/Check/Repair Float

    Functions

    Bool CompareFloatTolerant (Float32 a, Float32 b)
     
    Bool CompareFloatTolerant (Float64 a, Float64 b)
     
    Bool CheckFloat (Float32 r)
     
    Bool CheckFloat (Float64 r)
     
    Float32 RepairFloat (Float32 r)
     
    Float64 RepairFloat (Float64 r)
     

    Detailed Description

    Function Documentation

    ◆ CompareFloatTolerant() [1/2]

    Bool cineware::CompareFloatTolerant ( Float32  a,
    Float32  b 
    )

    Checks if two floats are close to each other on a bit basis (rather than a fixed epsilon).
    Single precision version.

    Parameters
    [in]aA float value.
    [in]bA float value.
    Returns
    true if a and b are sufficiently close to each other, otherwise false.

    ◆ CompareFloatTolerant() [2/2]

    Bool cineware::CompareFloatTolerant ( Float64  a,
    Float64  b 
    )

    Checks if two floats are close to each other on a bit basis (rather than a fixed epsilon).
    Double precision version.

    Parameters
    [in]aA float value.
    [in]bA float value.
    Returns
    true if a and b are sufficiently close to each other, otherwise false.

    ◆ CheckFloat() [1/2]

    Bool cineware::CheckFloat ( Float32  r)

    Checks if r is a valid floating point number. Single precision version.

    Parameters
    [in]rThe value to check.
    Returns
    true if r is a valid floating point number, otherwise false.
    true for FP_NORMAL, FP_SUBNORMAL and FP_ZERO.
    false for FP_NAN, FP_INFINITE.

    ◆ CheckFloat() [2/2]

    Bool cineware::CheckFloat ( Float64  r)

    Checks if r is a valid floating point number.
    Double precision version.

    Parameters
    [in]rThe value to check.
    Returns
    true if r is a valid floating point number, otherwise false.
    true for FP_NORMAL, FP_SUBNORMAL and FP_ZERO.
    false for FP_NAN, FP_INFINITE.

    ◆ RepairFloat() [1/2]

    Float32 cineware::RepairFloat ( Float32  r)

    Repairs floating point values.
    Single precision version.

    Warning
    Only NaNs and Infinity are corrected. Denormalized numbers are not.
    Note
    Useful when importing other formats where the floating point data is not always valid.
    Parameters
    [in]rThe float value to repair.
    Returns
    The repaired value.

    ◆ RepairFloat() [2/2]

    Float64 cineware::RepairFloat ( Float64  r)

    Repairs floating point values.
    Double precision version.

    Warning
    Only NaNs and Infinity are corrected. Denormalized numbers are not.
    Note
    Useful when importing other formats where the floating point data is not always valid.
    Parameters
    [in]rThe float value to repair.
    Returns
    The repaired value.