TMath::Sign, Negative Zero, and Signum

Hi, I noticed today that using TMath::Sign with the second argument a negative float or double zero does not copy the negative sign to the first argument. I understand that this is the same way that “copysignf” in the C math library does it, but it’s not correct.

Though you can use TMath::Sign and tricks to emulate it, I also think it would be useful to have a true Signum function in TMath. A function that returns +/-1 for finite values with that sign, and 0 for actual zero values (positive or negative zeros!).

I guess this is a pretty minor issue, so it’s unlikely to get much attention, but a copysign function that doesn’t copy the sign for negative zero is irksome, and a true Signum function would be useful.

Jean-François