llvm / llvm/llvm-project

[libc][math] Float16 functions are missing floating point exceptions and BFloat16 issues

Open
#186,483 4 comments 0 reactions 2 assignees Claimed by @AnonMiraj View on GitHub
libc
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The problem is reported by Paul Zimmermann from the CORE-MATH project:

```
log10p1f16:
Running exhaustive check in --rndn mode...
Missing underflow exception for x=0x1p-23 (y=0x1p-24)

atanpif16:
Running exhaustive check in --rndn mode...
Missing underflow exception for x=0x1p-23 (y=0x1p-24)

atan2f16:
Running exhaustive check in --rndn mode...
Spurious underflow exception for x,y=0x1.fp-14,0x1.fp+0 (z=0x1p-14)

erfcf16:
Running exhaustive check in --rndn mode...
Missing underflow exception for x=0x1.7p+2 (y=0x0p+0)
Missing underflow exception for x=0x1.68p+3 (y=0x0p+0)
```

For bfloat16:
```
$ CORE_MATH_STD_NAME=log10bf16 CORE_MATH_CHECK_STD=true LIBM=$L ./check.sh log10_bf16
```
where $L is the link to libllvmlibc.a
```
sinbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=-nan y=0x0p+0

tanbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=-nan y=0x0p+0

acosbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=-nan y=0x0p+0

asinbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=-nan y=0x0p+0

atanbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=0x1.92p+0 y=0x0p+0

hypotbf16:
Running exhaustive check in --rndn mode...
Error, for x,y=nan,0x1p-133, inexact exception set (z=0x0p+0)

cbrtbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=inf y=0x0p+0

log2bf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=inf y=0x0p+0

log10bf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=inf y=0x0p+0

expbf16:
Running exhaustive check in --rndn mode...
FAIL x=inf ref=inf y=0x0p+0
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.