I
Imre Ament
Hi,
I have to test double and float values before write it to a database.
I found the '_fpclass' function and consider its return value:
parameter was an owerflowed (wrong) double
_FPCLASS_SNAN /* signaling NaN */
_FPCLASS_QNAN /* quiet NaN */
_FPCLASS_NINF /* negative infinity */
_FPCLASS_PINF /* positive infinity */
parameter was a valid (x >= DBL_MIN and x <= DBL_MAX) number
_FPCLASS_NN /* negative normal */
_FPCLASS_ND /* negative denormal */
_FPCLASS_NZ /* -0 */
_FPCLASS_PZ /* +0 */
_FPCLASS_PD /* positive denormal */
_FPCLASS_PN /* positive normal */
1. I am right?
2. How can I manage this test on a 'float' number?
('_fpclass' has type of 'double' parameter and I mean to call it with a
'float' does not a good practise,
because casting a wrong float to a double may results a valid number)
Regards,
Imre
I have to test double and float values before write it to a database.
I found the '_fpclass' function and consider its return value:
parameter was an owerflowed (wrong) double
_FPCLASS_SNAN /* signaling NaN */
_FPCLASS_QNAN /* quiet NaN */
_FPCLASS_NINF /* negative infinity */
_FPCLASS_PINF /* positive infinity */
parameter was a valid (x >= DBL_MIN and x <= DBL_MAX) number
_FPCLASS_NN /* negative normal */
_FPCLASS_ND /* negative denormal */
_FPCLASS_NZ /* -0 */
_FPCLASS_PZ /* +0 */
_FPCLASS_PD /* positive denormal */
_FPCLASS_PN /* positive normal */
1. I am right?
2. How can I manage this test on a 'float' number?
('_fpclass' has type of 'double' parameter and I mean to call it with a
'float' does not a good practise,
because casting a wrong float to a double may results a valid number)
Regards,
Imre