Permit half overflow within allowable ULP (#600)

* Permit half overflow within allowable ULP

Modify the algorithm for calculating half precision ULP error so
that it duplicates the behaviour of the single precision ULP algorithm,
in regards to allowing overflow within the defined ULP error.

In the case where the test value is infinity, but the reference is
finite, pretend the test value is 63336.0 and calculate the ULP error
against that.

Encountered this while testing half precision `hypot()` in PR !529,
for inputs `hypot(-48864.0, 43648.0)` which has reference
`65519.755799`. With RTE rounding this only just rounds to `65504` as half,
and returning INF is currently infinite ULP error. Using the leniency
introduced by this change however the error is `~0.5` within the `2` ULP
bounds defined by the spec.

* Run clang-format over changes

Code now conforms to style guidelines and allows `check-format.sh` to pass.
This commit is contained in:
Ewan Crawford
2020-10-28 10:13:40 +00:00
committed by GitHub
parent f162c8b5ef
commit 55976fad35
3 changed files with 17 additions and 58 deletions

View File

@@ -95,7 +95,6 @@ extern cl_device_fp_config gDoubleCapabilities;
float Abs_Error( float test, double reference );
float Ulp_Error( float test, double reference );
//float Ulp_Error_Half( float test, double reference );
float Bruteforce_Ulp_Error_Double( double test, long double reference );
uint64_t GetTime( void );