Compare/Check/Repair Float 函数

详细描述

函数

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)

Function Documentation

◆  CompareFloatTolerant() [1/2]

Bool 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.

参数
[in] a A float value.
[in] b A float value.
返回
true if a and b are sufficiently close to each other, otherwise false .

◆  CompareFloatTolerant() [2/2]

Bool 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.

参数
[in] a A float value.
[in] b A float value.
返回
true if a and b are sufficiently close to each other, otherwise false .

◆  CheckFloat() [1/2]

Bool CheckFloat ( Float32   r )

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

参数
[in] r The value to check.
返回
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 CheckFloat ( Float64   r )

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

参数
[in] r The value to check.
返回
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 RepairFloat ( Float32   r )

Repairs floating point values.
Single precision version.

警告
Only NaN and Infinity are corrected. Denormalized numbers are not.
注意
Useful when importing other formats where the floating point data is not always valid.
参数
[in] r The float value to repair.
返回
The repaired value.

◆  RepairFloat() [2/2]

Float64 RepairFloat ( Float64   r )

Repairs floating point values.
Double precision version.

警告
Only NaNs and Infinity are corrected. Denormalized numbers are not.
注意
Useful when importing other formats where the floating point data is not always valid.
参数
[in] r The float value to repair.
返回
The repaired value.