Skip to content

Commit 133503b

Browse files
authored
Unify Fast Math ULP Tables (#598)
* add tanh and atanh to the fast math table for OpenCL C * restrict the range for fast math cosh and sinh to [-88,88] * add ULP bounds for non-derived implementations
1 parent 22ea113 commit 133503b

2 files changed

Lines changed: 19 additions & 15 deletions

File tree

OpenCL_C.txt

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11653,6 +11653,7 @@ requires>> support for OpenCL C 2.0 or newer.
1165311653

1165411654
| *acosh*(_x_)
1165511655
| Derived implementations may implement as *log*(_x_ + *sqrt*(_x_ * _x_ - 1)).
11656+
For non-derived implementations, the error is {leq} 8192 ulp.
1165611657

1165711658
| *acospi*(_x_)
1165811659
| Derived implementations may implement as *acos*(_x_) * `M_PI_F`.
@@ -11663,6 +11664,7 @@ requires>> support for OpenCL C 2.0 or newer.
1166311664

1166411665
| *asinh*(_x_)
1166511666
| Derived implementations may implement as *log*(_x_ + *sqrt*(_x_ * _x_ + 1)).
11667+
For non-derived implementations, the error is {leq} 8192 ulp.
1166611668

1166711669
| *asinpi*(_x_)
1166811670
| Derived implementations may implement as *asin*(_x_) * `M_PI_F`.
@@ -11671,12 +11673,12 @@ requires>> support for OpenCL C 2.0 or newer.
1167111673
| *atan*(_x_)
1167211674
| {leq} 4096 ulp
1167311675

11674-
//| *atanh*(_x_)
11675-
// | Defined for _x_ in the domain (-1, 1).
11676-
// For _x_ in [-2^-10^, 2^-10^], derived implementations may implement as _x_.
11677-
// For _x_ outside of [-2^-10^, 2^-10^], derived implementations may implement as
11678-
// 0.5f * *log*((1.0f + _x_) / (1.0f - _x_)).
11679-
// For non-derived implementations, the error is {leq} 8192 ulp.
11676+
| *atanh*(_x_)
11677+
| Defined for _x_ in the domain (-1, 1).
11678+
For _x_ in [-2^-10^, 2^-10^], derived implementations may implement as _x_.
11679+
For _x_ outside of [-2^-10^, 2^-10^], derived implementations may implement as
11680+
0.5f * *log*((1.0f + _x_) / (1.0f - _x_)).
11681+
For non-derived implementations, the error is {leq} 8192 ulp.
1168011682

1168111683
| *atanpi*(_x_)
1168211684
| Derived implementations may implement as *atan*(_x_) * `M_1_PI_F`.
@@ -11803,13 +11805,13 @@ requires>> support for OpenCL C 2.0 or newer.
1180311805
*sin*(_x_) * (1.0f / *cos*(_x_)).
1180411806
For non-derived implementations, the error is {leq} 8192 ulp.
1180511807

11806-
//| *tanh*(_x_)
11807-
// | Defined for _x_ in the domain [-{inf}, {inf}].
11808-
// For _x_ in [-2^-10^, 2^-10^], derived implementations
11809-
// may implement as _x_.
11810-
// For _x_ outside of [-2^-10^, 2^-10^], derived implementations
11811-
// may implement as (*exp*(_x_) - *exp*(-_x_)) / (*exp*(_x_) + *exp*(-_x_)).
11812-
// For non-derived implementations, the error is {leq} 8192 ULP.
11808+
| *tanh*(_x_)
11809+
| Defined for _x_ in the domain [-{inf}, {inf}].
11810+
For _x_ in [-2^-10^, 2^-10^], derived implementations
11811+
may implement as _x_.
11812+
For _x_ outside of [-2^-10^, 2^-10^], derived implementations
11813+
may implement as (*exp*(_x_) - *exp*(-_x_)) / (*exp*(_x_) + *exp*(-_x_)).
11814+
For non-derived implementations, the error is {leq} 8192 ULP.
1181311815

1181411816
| *tanpi*(_x_)
1181511817
| Derived implementations may implement as *tan*(_x_ * `M_PI_F`).

env/numerical_compliance.asciidoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ profile.
13781378

13791379
| *OpExtInst* *acosh*
13801380
| Derived implementations may implement as *log*(_x_ + *sqrt*(_x_ * _x_ - 1)).
1381+
For non-derived implementations, the error is {leq} 8192 ulp.
13811382

13821383
| *OpExtInst* *acospi*
13831384
| Derived implementations may implement as *acos*(_x_) * `M_PI_F`.
@@ -1388,6 +1389,7 @@ profile.
13881389

13891390
| *OpExtInst* *asinh*
13901391
| Derived implementations may implement as *log*(_x_ + *sqrt*(_x_ * _x_ + 1)).
1392+
For non-derived implementations, the error is {leq} 8192 ulp.
13911393

13921394
| *OpExtInst* *asinpi*
13931395
| Derived implementations may implement as *asin*(_x_) * `M_PI_F`.
@@ -1425,7 +1427,7 @@ profile.
14251427
is {leq} 2^-11^ and larger otherwise.
14261428

14271429
| *OpExtInst* *cosh*
1428-
| Defined for _x_ in the domain [-{inf}, {inf}].
1430+
| Defined for _x_ in the domain [-88, 88].
14291431
Derived implementations may implement as 0.5f * (*exp*(_x_) + *exp*(-_x_)).
14301432
For non-derived implementations, the error is {leq} 8192 ulp.
14311433

@@ -1517,7 +1519,7 @@ profile.
15171519
| ulp values as defined for *sin*(_x_) and *cos*(_x_).
15181520

15191521
| *OpExtInst* *sinh*
1520-
| Defined for _x_ in the domain [-{inf}, {inf}].
1522+
| Defined for _x_ in the domain [-88, 88].
15211523
For _x_ in [-2^-10^, 2^-10^], derived implementations
15221524
may implement as _x_.
15231525
For _x_ outside of [-2^-10^, 2^-10^], derived implementations

0 commit comments

Comments
 (0)