# [Boost-bugs] [Boost C++ Libraries] #8809: pow(cpp_dec_float_type(-1), cpp_dec_float_type(n)) != (+-)1 for n >= 0x8000000000000000u

Subject: [Boost-bugs] [Boost C++ Libraries] #8809: pow(cpp_dec_float_type(-1), cpp_dec_float_type(n)) != (+-)1 for n >= 0x8000000000000000u
Date: 2013-07-10 12:05:08

#8809: pow(cpp_dec_float_type(-1), cpp_dec_float_type(n)) != (+-)1 for n >=
0x8000000000000000u
-------------------------------------+----------------------------
Reporter: Jan Bouwer <JBouwer@â€¦> | Owner: johnmaddock
Type: Bugs | Status: new
Milestone: To Be Determined | Component: multiprecision
Version: Boost Development Trunk | Severity: Problem
Keywords: |
-------------------------------------+----------------------------
Function ''pow(const number-or-expression-template-type&, const number-or-
expression-template-type&)'' for ''cpp_dec_float'' backend gives wrong
answer when used with base -1 and a positive exponent equivalent to a type
(unsigned 64bit on my platform) with the high bit set;
i.e. an exponent >= 0x8000000000000000u.

The answers suggest that the exponent may be interpreted as its 2's
complement-negative value (not confirmed) - see sample output below.
This may be related to #8711 & #8798.

Output from attached code:
{{{
pow(-1, 9.22337e+18) = -0.00127263
pow(-1, 9.22337e+18) = -0.00127263
pow(-1, 1.84467e+19) = 0
pow(-1, 1.84467e+19) = 0
pow(-1, 9.22337e+18) = -0.00127263
pow(-1, 9.22337e+18) = -0.00127263
pow(-1, 1.84467e+19) = 0
pow(-1, 1.84467e+19) = 0
}}}

Tested against trunk rev 8490 with clang (Apple LLVM version 4.2
(clang-425.0.28) (based on LLVM 3.2svn)) target: x86_64-apple-darwin12.4.0
with: -std=c++11 -stdlib=libc++.

```--
Ticket URL: <https://svn.boost.org/trac/boost/ticket/8809>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.
```

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:13 UTC