Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove dependency to the math library. #103

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

per-ok
Copy link
Contributor

@per-ok per-ok commented Aug 3, 2021

Introducing json_pow10(), a fast power of 10 calculator, which suits JSON perfectly. (Named json_pow10 to avoid conflict with gcc builtin functions.)

Copy link
Member

@LB-- LB-- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a compile option, as people who are already linking the math library anyway might want the reduced code size of using the existing pow function, or they may even wish to provide their own version of the function. Having the ability to not need the math library is appreciated though!

@per-ok
Copy link
Contributor Author

per-ok commented Aug 11, 2021

I will add compilation directives for this. How about using JSON_INTERNAL_MATH to actively remove the dependency?

New headline should possibly "add option to remove dependency to math.h" or similar?

@LB--
Copy link
Member

LB-- commented Aug 14, 2021

That sounds like a good plan to me!

@LB-- LB-- added this to the v1.2.0 milestone Aug 14, 2021
@per-ok
Copy link
Contributor Author

per-ok commented Oct 30, 2023

I thought I should complete what I started (and left unfinished) about 2 years ago. I see there is a build error in the verification process "CI / build-msvs (amd64_x86) (pull_request)" that is related to command line options:

cl : Command line error D8016 : '/std:c11' and '/Za' command-line options are incompatible

I cannot see how I can fix this.

@ghost
Copy link

ghost commented Nov 1, 2023

I cannot see how I can fix this.

I don't have visual studio, so can't say for sure, but I suppose Za involves C++98, which would indeed be incompatible with C++11, as the language changed so much that I consider C++11 a different (much better) lang.

@per-ok
Copy link
Contributor Author

per-ok commented Nov 9, 2023

This paragraph indicates that the /Za option applies to C89/90, only, and possibly does not apply to the /std:c11 and /std:c17 options.

@LB--
Copy link
Member

LB-- commented Apr 6, 2024

Apologies for the delay, I've fixed the CI - try rebasing and it should work properly now. Thanks to @per-ok for the hint.

Per Olav Kroka and others added 4 commits April 9, 2024 08:22
Introducing json_pow10(), a fast power of 10 calculator,
which suits JSON perfectly. (Named json_pow10 to avoid
conflict with gcc builtin functions.)
This make use of the math library the default.
This adds the -DJSON_INTERNAL_MATH on the compiler command line by which
the dependency to the math library is removed and internal functionality
is used instead.
@per-ok per-ok force-pushed the remove-dependency-to-the-math-lib branch from 9507a88 to f508768 Compare April 17, 2024 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants