Domanda

I've encountered a strange error trying to work with a floating point number. I'm attempting to calculate the log10 (in "math.h") of the following number:

-0.000000000000000000000000000000002584877722073    ==    -2.584877722073e-33

It keeps crashing. Is this a valid float? Granted I am dealing with manipulating the raw data of the float itself.

I have researched floats, and from my understanding this is not NaN, Inf, or a Denormal number. The binary doesn't seem to match anything invalid:

1 | 00010010 | 10101101011111001000100

Are there restrictions to numbers with this precision? What might be causing the issue?

È stato utile?

Soluzione

You can't compute the logarithm of a negative number and expect a real result. You should be getting a domain error.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top