Trying to figure out how cmath.h calculates the value of Trancedental functions.But function calling seems to be recursive in header files

  c++, c++11, c++17

I am using Visual Studio 2019.
I have written a bare bones code to calculate and print the value of sine when I enter a number as an argument.
When I right click the call of sin() using math.h and cmath.h as the headers.It first takes me to the defination of sin in the cmath.h header on line 234.Which lookes something like this:

_NODISCARD _Check_return_ inline float sin(_In_ float _Xx) noexcept /* strengthened */ {
    return _CSTD sinf(_Xx);
}

Now when I right click on the sinf() which is in the return part of the function I am taken to tyhe defination of sine in the corecrt_math.h header.Which looks like this:

 _Check_return_ __inline float __CRTDECL sinf(_In_ float _X)
        {
            return (float)sin(_X);
        }

And now when I right click on the sin() function it takes me back to the cmath.h header.
This seems very counter intuitive as when I make header files they are accompanied by another header where I declare the functions which are imoplemented in a .cpp files but here there seems to neither be a .cpp file nor another header which implements trencedental functions.

So how does C++ calculate these functions?

Source: Windows Questions C++

LEAVE A COMMENT