Are there any platform independent trigonometric functions availabe in qt/qtopia? Basicaly I need sinus and cosinus.
Are there any platform independent trigonometric functions availabe in qt/qtopia? Basicaly I need sinus and cosinus.
Last edited by MarkoSan; 1st December 2007 at 19:55.
Qt 5.3 Opensource & Creator 3.1.2
ittod (14th August 2013)
I am thinking about it, but will then the project be able to be compiled as qtopia application?
Qt 5.3 Opensource & Creator 3.1.2
Hmm... the math library is in glibc, so... unless you strip glibc out of sin() and cos() they'll be there.
So, wysotta, you meant stdmath is in glibc?
I've checked now include files from installed mingw, I haven't found stdmath.h, but I've found math.h. Is this math.h also linked into glibc?
Last edited by MarkoSan; 1st December 2007 at 22:58.
Qt 5.3 Opensource & Creator 3.1.2
Look at the include file of what you were given...
http://www.cppreference.com/stdmath/sin.html
I know what sin() is, but what I wanted to know, are stdmath and math.h SAME headers? Are both linked in glibc?
Qt 5.3 Opensource & Creator 3.1.2
In C++ programs you would include <cmath>, which is the C++ version of the standard library header. Its contents are (mostly) the same as <math.h>, but it uses the std namespace.
J-P Nurmi
If you look at the code in the link, you'll see it includes <math.h> - sin(), cos(), etc. are just C functions, you can use them in C++ apps as well. <cmath> just embedds the function names into the std namespace (as J-P already explained) to avoid potential name clash.
Ok, I know that, but, once more:
Are they any troubles to be expected when porting existing qt application that uses mentioned trigonometric functions to device, which will use embedded linux (qnx rtos) and qtopia? Does anyone have experience with this?
Qt 5.3 Opensource & Creator 3.1.2
No, you won't get any troubles, provided that the device has a glibc implementation that contains sin() and cos(). As glibc is open source I can't guarantee that every possible implementation of glibc has it. It probably does though.
MarkoSan (2nd December 2007)
So, wysotta, glibc then is part of os? I need to contact the manufacturer of qnx rtos and they will provide me with needed info? In worst case scenario I will be forced to write a custom code that will compute sinus and cosinus with help of Taylor series.
Qt 5.3 Opensource & Creator 3.1.2
Just use those functions. If your code doesn't link, you'll be worrying. I don't see why someone would want to strip out sin and cos out of glibc, so there is a 99% chance it will work. But sometimes one needs to strip out as much as possible to fit some code onto a limited storage or working space, so I guess someone could actually think "hey, I don't need trygonometric functions on my PDA, let's cut them out to save some RAM".
MarkoSan (2nd December 2007)
Ok , you've just made my day better. Thanks, but still i will leave a comment in a code as POSSIBLE TODO. Now this post can be closed.
Qt 5.3 Opensource & Creator 3.1.2
Bookmarks