Cmath interior decoration

I'm just wondering where and how functions like sine, cosine and sqrt are implemented inside cmath. I know that cmath includes math.h and math.h there are tons of things, but where is the actual “math” behind some of these functions?

EDIT: I'm more interested in whether there is tangible source code related to math functions, or whether these headers are the lowest that I'm going to leave.

+3
source share
4 answers

The math for these operations is almost certainly not performed in C code, at least for x86 architectures. This is done on a chip. Since integrating the 8087 mathematical coprocessor into 486 , the x86 family has had instructions on the chip to make sine, cosine, and square root, among others. This page has a nice overview.

Edit:

Duplicates just found in How C calculates sin () and other math functions? and How do trigonometric functions work? .

+3
source

, , , <cmath> <math.h>. , , , , . . Plauger, , , " C" , , .

+1

- , , , , C . - , . , , . netlib " " fdlibm.
e_sqrt.c. , .

+1

Source: https://habr.com/ru/post/1785126/


All Articles