Google: (-.5)^(1/3)=
Output: -.5^(1 / 3) = -0.793700526
Mathomatic: (-.5)^(1/3)
Output: answer = -0.793700525984
Maxima: bfloat((-.5)^(1/3))
Output: -7.93700525984099737375852819636154130195746663949926504904142880912608252812109586636772106631[...]B-1
C++: std::pow(-0.5, 1.0/3.0)
Output: nan
It would appear that 3 other sources are calling C++ a dirty liar.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
The problem is that there is 3 possible solutions; one is real and two are imaginary. C++ is using one of the imaginary solutions.
std::pow(std::complex<double>(-0.5), std::complex<double>(1.0/3.0)) gives me 0.39685+0.687365i.
I wanted the real one, that seemed like the obvious one to pick.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
I guess the best solution would be to check if the base is negative, and if it is use -((-base)^(1/3)) instead, which seems to give the (or one of the) right answer(s).
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.