How to use isless() function to check whether floating point x is less than floating point y in C++

1 Answer

0 votes
#include <iostream>
#include <cmath>

using namespace std;

int main()
{
	if (isless(0.0003, 0.0003))
		cout << "true" << endl;
	else
		cout << "false" << endl;

	if (isless(0.0002, 0.0003))
		cout << "true" << endl;
	else
		cout << "false" << endl;

	if (isless(0.0003, 0.0002))
		cout << "true" << endl;
	else
		cout << "false" << endl;

	return 0;
}

/*
run:

false
true
false

*/

 



answered Mar 22, 2016 by avibootz
edited Mar 22, 2016 by avibootz
...