Opened 6 years ago

Closed 6 years ago

#12525 closed Feature Requests (fixed)

cpp_bin_float: Anal fixation. Part 2. Sign of trunc(x) for x in range (-1..0)

Reported by: Michael Shatz Owned by: John Maddock
Milestone: Boost 1.63.0 Component: multiprecision
Version: Boost 1.62.0 Severity: Cosmetic
Keywords: Cc:

Description

trunc(x) for x in range (-1..0).

I have no idea what IEEE-754 says about it, but I see that in practice all sane implementations return -0.

Except for boost::cpp_bin_float.

Attachments (1)

af_p2.cpp​ (542 bytes ) - added by Michael Shatz 6 years ago.
demonstrates unexpected sign of zero as result of trunc()

Download all attachments as: .zip

Change History (2)

by Michael Shatz, 6 years ago

Attachment: af_p2.cpp​ added

demonstrates unexpected sign of zero as result of trunc()

comment:1 by John Maddock, 6 years ago

Milestone: To Be Determined → Boost 1.63.0
Resolution: → fixed
Status: new → closed

Thanks, this also effects round and ceil as well as trunc. Fixed in ​https://github.com/boostorg/multiprecision/commit/ed43204e925aa604061b33315fa7db7002689fdc.

Note: See TracTickets for help on using tickets.