-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When x is -0.0, modf will return 0.0 according to this formula: modf(x) = x - trunc(x) This leads to an addition of (-0.0) + 0.0 and our HW returns 0.0. According to SPIR-V spec, the result has the same sign as that of the input. We must check this special case by doing this: modf(x) = copysign(modf(x), x) Also, according to C modf function, when x=+INF/-INF, the result is 0.0 but we have such computation (-INF) + INF or INF - INF. Our HW returns NaN so we must check this special case as well by do this: modf(x) = (x == INF) ? copysign(0.0, x) : modf(x)
- Loading branch information
Showing
1 changed file
with
27 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters