Bug 17562 – Tangent function returns NaN for abs(input) >= 2^63

Status
RESOLVED
Resolution
FIXED
Severity
minor
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
x86
OS
All
Creation time
2017-06-27T10:59:43Z
Last change time
2018-01-05T13:29:36Z
Keywords
pull
Assigned to
Sophie
Creator
Sophie

Comments

Comment #0 by meapineapple — 2017-06-27T10:59:43Z
Comment #1 by github-bugzilla — 2017-06-27T21:38:35Z
Commit pushed to master at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/0fb66f092b897b55318509c6582008b3f912311a Fix issue 17562 - tan returning -nan for inputs where abs(x) >= 2^63 The fptan instruction pushes a 1.0 onto the FPU register stack after a successful operation, but when abs(input) >= 2^63 the C2 flag is set to indicate that the input was out of bounds, and it doesn't push the 1.0. Prior to this PR, the top value of the FPU stack was popped irrespective of whether C2 was set, which in the case of an out-of-bounds input caused the input to be removed from the stack and ultimately resulted in an incorrect return value of -nan. This PR changes this behavior, only popping after fptan when C2 was not set. See: http://x86.renejeschke.de/html/file_module_x86_id_109.html * Added unit tests for handling out-of-range inputs of fptan
Comment #2 by github-bugzilla — 2017-08-16T13:23:09Z
Commit pushed to stable at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/0fb66f092b897b55318509c6582008b3f912311a Fix issue 17562 - tan returning -nan for inputs where abs(x) >= 2^63
Comment #3 by github-bugzilla — 2018-01-05T13:29:36Z
Commit pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/0fb66f092b897b55318509c6582008b3f912311a Fix issue 17562 - tan returning -nan for inputs where abs(x) >= 2^63