Commit 68ed5ef5 authored by Thomas Kabelmann's avatar Thomas Kabelmann
Browse files

Use sincos() instead of sin() and cos() separate in dms::SinCos().

svn path=/trunk/kdeedu/kstars/; revision=178910
parent 2a61b968
......@@ -15,6 +15,8 @@
* *
***************************************************************************/
// needed for sincos() in math.h
#define _GNU_SOURCE
#include <stdlib.h>
#include <qstring.h>
......@@ -103,9 +105,18 @@ dms dms::operator- (dms angle)
//---------------------------------------------------------------------------
void dms::SinCos( double &sina, double &cosa ) {
// This is the old implementation of sincos which is standard C compliant
/*
register double rad = radians();
sina = sin( rad );
cosa = cos( rad );
*/
/**The sincos function computes sin and cos at once (hardware accelareted / fsincos in assembler).
*It's ~33% faster than computing sin and cos separate. But sincos() is not a standard C/C++
*function and requires #define _GNU_SOURCE. It's defined in math.h.
*/
sincos(radians(), &sina, &cosa);
}
//---------------------------------------------------------------------------
......@@ -154,4 +165,6 @@ QString dms::toHMSString() const {
//---------------------------------------------------------------------------
const double dms::PI = acos(-1.0);
// const double dms::PI = acos(-1.0);
// M_PI is defined in math.h
const double dms::PI = M_PI;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment