PDA

View Full Version : Mathematical Functions



krishbhala
11th January 2008, 07:20
can we use mathematical functions such as sin(), cos(), sqrt(), pow(), etc in Qt? If it is possible What is the header for that functions?

jpn
11th January 2008, 08:46
http://www.cplusplus.com/reference/clibrary/cmath/

krishbhala
11th January 2008, 09:40
hi JPN

Thanks for uour reply.
Few of unix flavors does not support math.h, any thoughts?

Those functions are available ECMAScript Reference in Qt but am failed to insert the header QtScript, am using Qt 4.3.2 Open Source Edition.

http://doc.trolltech.com/4.3/ecmascript.html

Thank You.

pdolbey
11th January 2008, 13:55
Try using "#include <cmath>" and either explicitly using "std::cos", "std::sin" etc, or putting in a "using namespace std;" line. Using the explicit form works for me on Win32 and Linux platforms.

Pete