This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

USING math.h - MDK-ARM

I want to use math.h , library header file comes with mdk-arm.

option is to add file like

1.


#include <math.h>

This will add math.h as in C:\Keil\....\ folder.

2. Second if I copy math.h from library folder & paste this file in my project folder.
Then I add


#include "math.h"

Main purpose of this so that any change in math.h should not occur to default file provided by keil.

Now my question is it correct. Will now header file will be able to call the function like sqrt.
Where are these function defined as header file has only prototype. There has to be definition for could to build. But when I right click on sqrt(a), & go to function defination. It says function not defined. however code is working correctly & fine

Parents
  • Think again.

    You are not supposed to make any changes to <math.h>. That file is owned by Keil, and intended to be as close to the language standard as possible.

    Exactly why do you consider making changes to a local copy of math.h?

    Also note that you can - in some situations - replace functions from the C standard library with own implementations by just link in your own code. This will not clash with the content of math.h, as long as your own implementation has the same signature - takes the same parameters, uses the same calling conventions and returns the same data type.

Reply
  • Think again.

    You are not supposed to make any changes to <math.h>. That file is owned by Keil, and intended to be as close to the language standard as possible.

    Exactly why do you consider making changes to a local copy of math.h?

    Also note that you can - in some situations - replace functions from the C standard library with own implementations by just link in your own code. This will not clash with the content of math.h, as long as your own implementation has the same signature - takes the same parameters, uses the same calling conventions and returns the same data type.

Children
No data