fix: Define M_PI, M_PI_2, and M_1_PI.#393
Merged
spe-ciellt merged 1 commit intogerbv:developfrom Mar 8, 2026
Merged
Conversation
They are non-standard and not necessarily defined already. This fixes gerbv#392.
rampageservices
approved these changes
Mar 8, 2026
Contributor
rampageservices
left a comment
There was a problem hiding this comment.
LGTM. Values match glibc and MSVC's _USE_MATH_DEFINES definitions exactly:
| Constant | PR value | MSVC/glibc |
|---|---|---|
M_PI |
3.14159265358979323846 | 3.14159265358979323846 |
M_PI_2 |
1.57079632679489661923 | 1.57079632679489661923 |
M_1_PI |
0.31830988618379067154 | 0.318309886183790671538 |
M_1_PI differs only in trailing precision (20 vs 21 digits) — both well beyond double range (~15–16 significant digits), so no practical difference.
#ifndef guards are the standard pattern. Placement in gerbv.h ensures coverage for the DEG2RAD/RAD2DEG macros defined just below, plus all transitive includers.
Closed
Contributor
|
Looks simple enough, I merge it. |
rampageservices
added a commit
to SourceParts/gerbv
that referenced
this pull request
Mar 8, 2026
3 tasks
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
They are non-standard and not necessarily defined already.
This fixes #392.