In the latest C++ standard, I noticed the following macros :
bool isgreater(float x, float y);
bool isgreaterequal(float x, float y);
bool isless(float x, float y);
bool islessequal(float x, float y);
bool islessgreater(float x, float y);
bool isunordered(float x, float y);
These macros are from C (7.12.14 and 7.12.14).
So, why would someone use these macros, instead of operators? Is there anything special that these macros are doing (like checking for inf
), or are they the same as their corresponding operator?
C++ example :
#include <iostream>
#include <cmath>
int main()
{
float x=0.2;
float y=0.5;
std::cout << x << " < " << y << " : " << std::boolalpha << std::islessequal( x, y ) << std::endl;
std::cout << x << " < " << y << " : " << std::boolalpha << ( x <= y ) << std::endl;
}
See Question&Answers more detail:os