-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide a fallback for M_PI and M_PI_2 (#412)
As C standards does not define M_PI_2 provide a fallback and factor out common definitions to math_utils.h
- Loading branch information
Showing
4 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Tlf - contest logging program for amateur radio operators | ||
* Copyright (C) 2023 Thomas Beierlein <[email protected]> | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation; either version 2 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program; if not, write to the Free Software | ||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
*/ | ||
|
||
|
||
#ifndef MATH_UTILS_H | ||
#define MATH_UTILS_H | ||
|
||
/* Make sure math.h is included before the following definitions */ | ||
#ifndef MATH_H | ||
#include <math.h> | ||
#endif | ||
|
||
/* provide a fallback for M_PI_2 as C standard does not guarantee the definition | ||
of these constant */ | ||
#ifndef M_PI_2 | ||
# define M_PI_2 1.57079632679489661923 /* pi/2 */ | ||
#endif | ||
|
||
#define RADIAN (90.0 / M_PI_2) | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters