1 #ifndef __APROX_EQUAL_H__
2 #define __APROX_EQUAL_H__
4 #include <cmath>
6 inline bool approx_equal(double const a, double const b)
7 {
8 return ( (a == b)
9 || ( fabs( a - b ) < 1e-2 )
10 || ( fabs( a / b - 1.0 ) < 1e-2 ) );
11 }
14 #endif /* !__APROX_EQUAL_H__ */
16 /*
17 Local Variables:
18 mode:c++
19 c-file-style:"stroustrup"
20 c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
21 indent-tabs-mode:nil
22 fill-column:99
23 End:
24 */
25 // vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :