Definitions of sqrt, sin, cos, pow etc. in cmath

后端 未结 8 1138
野趣味
野趣味 2020-12-13 00:13

Are there any definitions of functions like sqrt(), sin(), cos(), tan(), log(), exp() (these fr

相关标签:
8条回答
  • 2020-12-13 01:18

    Usage: root(number,root,depth)

    Example: root(16,2) == sqrt(16) == 4
    Example: root(16,2,2) == sqrt(sqrt(16)) == 2
    Example: root(64,3) == 4

    Implementation in C#:

    double root(double number, double root, double depth = 1f)
    {
        return Math.Pow(number, Math.Pow(root, -depth));
    }
    

    Usage: Sqrt(Number,depth)

    Example: Sqrt(16) == 4
    Example: Sqrt(8,2) == sqrt(sqrt(8))

    double Sqrt(double number, double depth = 1) return root(number,2,depth);
    

    By: Imk0tter

    0 讨论(0)
  • 2020-12-13 01:18

    Those are almost always implemented as system calls. If you want to look at the sources, you'd need access to the OS sources, which means you need to look at an open-source OS like Linux or BSD.

    0 讨论(0)
提交回复
热议问题