C++ Poco::Util::Units::tan()














































C++ Poco::Util::Units::tan()



Poco::Util::Units::tan(value)

 

DESCRIPTION:

Poco has a general utility namespace called Poco::Util::Units

tan(value) is a math-function present in the Poco::Util::Units namespace. It calculates the tangent of an angle given in either in radians or degrees (according to the given parameter). i.e., it takes a parameter angle (a variable of type 'degree' or 'rad' or 'degree_second' or 'degree_minute').

 

Parameter Type:

It takes a parameter of type 'rad' or 'degree' or 'degree_minute' or 'degree_second'

 

Return Type:

It returns a value of type 'double'.


 

Program:


 //HEADERS

#include "Poco/Util/Units.h" #include <iostream> #include <typeinfo> //NAMESPACES using namespace std; using namespace Poco::Util::Units; using namespace Poco::Util::Units::Values; using namespace Poco::Util::Units::Constants; int main() { degree theta1 = degree(45); //degree is a variable type in Poco::Util::Units for creating angles of type degree. rad theta2 = pi / 6; //rad is a variable type in Poco::Util::Units for creating angles utang radians. //Here pi is a constant in Poco::Util::Units::Constants degree_minute theta3_minutes = degree_minute(90); degree theta3_degrees = theta3_minutes; //degree_minute is also a type in Poco::Util::Units. //theta3_degrees is of type degree, so, the initialised value gets converted to degrees //NOTE: (1 degree = 60 degree_minute) degree theta4 = degree_second(1800); //degree_minute is alao a type in Poco::Util::Units. //You also can give parameter of this degree_minute //NOTE: (1 degree_minute = 60 degree_second) cout << "tan(" << theta1 << ") = " << tan(theta1) << endl; cout << "tan(" << theta2 << ") = " << tan(theta2) << endl; cout << "tan(" << theta3_degrees << ") = " << tan(theta3_degrees) << endl; cout << "tan(" << theta4 << ") = " << tan(theta4) << endl; //Outputs the value of tan of the given angle cout << "tan method returnType: " << typeid(tan(theta1)).name() << endl;; //Return type of tan(value) is double return 0; }
OUTPUT:



Comments