Tuesday 15 May 2012

math - C++ std::complex data type test for NAN, INF (non-convergence) -



math - C++ std::complex<> data type test for NAN, INF (non-convergence) -

i wish test whether operation on complex number (std::complex) results in +/- inf or nan result. (non-convergent result.)

for illustration under mapping z -> z * z + c.

for float or double info types, believe 1 can utilize x != x test nan. not sure if works +/- inf.

use std::isfinite. function returns true if input neither nan nor inf. can utilize std::isnan , std::isinf check particular properties.

edit : std::complex, can apply same checks on real , imag parts. apply on abs of std::complex object.

c++ math double nan inf

No comments:

Post a Comment