ratio_greater() function in C++ Last Updated : 26 Jul, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The ratio_greater() is an inbuilt function in C++ which checks if the ratio R1 is greater than the ratio R2. It returns True if the ratio is greater than ratio 2, else it returns false. Syntax: template < class ratio1_name, class ratio2_name > ratio_greater Template Parameters The function accepts two template parameters ratio1 and ratio2 which are to be compared. Return value: The function returns a boolean value which is true if the ratio1 is greater than ratio2 otherwise it returns false. Below programs illustrates the above function: Program 1: CPP // C++ program to illustrate the // ratio_greater function #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<7, 7> ratio1; typedef ratio<4, 7> ratio2; // check if R1>R2 if (ratio_greater<ratio1, ratio2>::value) cout << "7/7 is more than 4/7"; else cout << "7/7 is not more than 4/7"; return 0; } Output: 7/7 is more than 4/7 Program 2: CPP // C++ program to illustrate the // ratio_greater function #include <iostream> #include <ratio> using namespace std; int main() { typedef ratio<1, 2> ratio1; typedef ratio<4, 7> ratio2; // check if R1>R2 if (ratio_greater<ratio1, ratio2>::value) cout << "1/2 is more than 4/7"; else cout << "1/2 is not more than 4/7"; return 0; } Output: 1/2 is not more than 4/7 Comment More infoAdvertise with us Next Article ratio_less_equal() function in C++ T Twinkl Bajaj Follow Improve Article Tags : Misc C++ STL CPP-Library CPP-Functions cpp-ratio +2 More Practice Tags : CPPMiscSTL Similar Reads ratio_greater_equal() function in C++ The ratio_greater_equal() is an inbuilt function in C++ which checks if the ratio R1 is greater than or equal to the ratio R2. It returns True if the ratio is greater than or equal to ratio 2, else it returns false. Syntax: template ratio_greater_equal Template Parameters The function accepts two te 2 min read ratio_less() function in C++ The ratio_less() is an inbuilt function in C++ which checks if the ratio R1 is less than the ratio R2. It returns True if the ratio is less than ratio 2, else it returns false. Syntax: template ratio_less Template Parameters: The function accepts two template parameters ratio1 and ratio2 which are t 2 min read log() Function in C++ The std::log() in C++ is a built-in function that is used to calculate the natural logarithm (base e) of a given number. The number can be of any data type i.e. int, double, float, long long. It is defined inside the <cmath> header file.In this article we will learn about how to use std::log() 1 min read ratio_less_equal() function in C++ The ratio_less_equal() is an inbuilt function in C++ which checks if the ratio R1 is less than or equal to the ratio R2. It returns True if the ratio is less than or equal to ratio 2, else it returns false. Syntax: template < class ratio1_name, class ratio2_name > ratio_less_equal Template Par 2 min read logb() function in C++ STL The logb() is a builtin function in C++ STL which returns the logarithm of |x|, using FLT_RADIX as base for the logarithm. In general, the value of FLT_RADIX is 2, so logb() is equivalent to log2()(for positive values only). Syntax: logb(val) Parameter: The function accepts a single mandatory parame 2 min read C++ 11 - <ratio> Header The header file, brought about by C++11, offers a class template for ratios and a collection of aliases to represent the same. The purpose of this is to enable the definition and manipulation of ratios while also providing a means to express the links between diverse units of measurement. Ratio Head 3 min read Like