@@ -17,53 +17,52 @@ import (
17
17
// Module math is a Starlark module of math-related functions and constants.
18
18
// The module defines the following functions:
19
19
//
20
- // ceil(x) - Returns the ceiling of x, the smallest integer greater than or equal to x.
21
- // copysign(x, y) - Returns a value with the magnitude of x and the sign of y.
22
- // fabs(x) - Returns the absolute value of x as float.
23
- // floor(x) - Returns the floor of x, the largest integer less than or equal to x.
24
- // mod(x, y) - Returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
25
- // pow(x, y) - Returns x**y, the base-x exponential of y.
26
- // remainder(x, y) - Returns the IEEE 754 floating-point remainder of x/y.
27
- // round(x) - Returns the nearest integer, rounding half away from zero.
20
+ // ceil(x) - Returns the ceiling of x, the smallest integer greater than or equal to x.
21
+ // copysign(x, y) - Returns a value with the magnitude of x and the sign of y.
22
+ // fabs(x) - Returns the absolute value of x as float.
23
+ // floor(x) - Returns the floor of x, the largest integer less than or equal to x.
24
+ // mod(x, y) - Returns the floating-point remainder of x/y. The magnitude of the result is less than y and its sign agrees with that of x.
25
+ // pow(x, y) - Returns x**y, the base-x exponential of y.
26
+ // remainder(x, y) - Returns the IEEE 754 floating-point remainder of x/y.
27
+ // round(x) - Returns the nearest integer, rounding half away from zero.
28
28
//
29
- // exp(x) - Returns e raised to the power x, where e = 2.718281… is the base of natural logarithms.
30
- // sqrt(x) - Returns the square root of x.
29
+ // exp(x) - Returns e raised to the power x, where e = 2.718281… is the base of natural logarithms.
30
+ // sqrt(x) - Returns the square root of x.
31
31
//
32
- // acos(x) - Returns the arc cosine of x, in radians.
33
- // asin(x) - Returns the arc sine of x, in radians.
34
- // atan(x) - Returns the arc tangent of x, in radians.
35
- // atan2(y, x) - Returns atan(y / x), in radians.
36
- // The result is between -pi and pi.
37
- // The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis.
38
- // The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct
39
- // quadrant for the angle.
40
- // For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
41
- // cos(x) - Returns the cosine of x, in radians.
42
- // hypot(x, y) - Returns the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y).
43
- // sin(x) - Returns the sine of x, in radians.
44
- // tan(x) - Returns the tangent of x, in radians.
32
+ // acos(x) - Returns the arc cosine of x, in radians.
33
+ // asin(x) - Returns the arc sine of x, in radians.
34
+ // atan(x) - Returns the arc tangent of x, in radians.
35
+ // atan2(y, x) - Returns atan(y / x), in radians.
36
+ // The result is between -pi and pi.
37
+ // The vector in the plane from the origin to point (x, y) makes this angle with the positive X axis.
38
+ // The point of atan2() is that the signs of both inputs are known to it, so it can compute the correct
39
+ // quadrant for the angle.
40
+ // For example, atan(1) and atan2(1, 1) are both pi/4, but atan2(-1, -1) is -3*pi/4.
41
+ // cos(x) - Returns the cosine of x, in radians.
42
+ // hypot(x, y) - Returns the Euclidean norm, sqrt(x*x + y*y). This is the length of the vector from the origin to point (x, y).
43
+ // sin(x) - Returns the sine of x, in radians.
44
+ // tan(x) - Returns the tangent of x, in radians.
45
45
//
46
- // degrees(x) - Converts angle x from radians to degrees.
47
- // radians(x) - Converts angle x from degrees to radians.
46
+ // degrees(x) - Converts angle x from radians to degrees.
47
+ // radians(x) - Converts angle x from degrees to radians.
48
48
//
49
- // acosh(x) - Returns the inverse hyperbolic cosine of x.
50
- // asinh(x) - Returns the inverse hyperbolic sine of x.
51
- // atanh(x) - Returns the inverse hyperbolic tangent of x.
52
- // cosh(x) - Returns the hyperbolic cosine of x.
53
- // sinh(x) - Returns the hyperbolic sine of x.
54
- // tanh(x) - Returns the hyperbolic tangent of x.
49
+ // acosh(x) - Returns the inverse hyperbolic cosine of x.
50
+ // asinh(x) - Returns the inverse hyperbolic sine of x.
51
+ // atanh(x) - Returns the inverse hyperbolic tangent of x.
52
+ // cosh(x) - Returns the hyperbolic cosine of x.
53
+ // sinh(x) - Returns the hyperbolic sine of x.
54
+ // tanh(x) - Returns the hyperbolic tangent of x.
55
55
//
56
- // log(x, base) - Returns the logarithm of x in the given base, or natural logarithm by default.
56
+ // log(x, base) - Returns the logarithm of x in the given base, or natural logarithm by default.
57
57
//
58
- // gamma(x) - Returns the Gamma function of x.
58
+ // gamma(x) - Returns the Gamma function of x.
59
59
//
60
60
// All functions accept both int and float values as arguments.
61
61
//
62
62
// The module also defines approximations of the following constants:
63
63
//
64
- // e - The base of natural logarithms, approximately 2.71828.
65
- // pi - The ratio of a circle's circumference to its diameter, approximately 3.14159.
66
- //
64
+ // e - The base of natural logarithms, approximately 2.71828.
65
+ // pi - The ratio of a circle's circumference to its diameter, approximately 3.14159.
67
66
var Module = & starlarkstruct.Module {
68
67
Name : "math" ,
69
68
Members : starlark.StringDict {
@@ -146,7 +145,8 @@ func newBinaryBuiltin(name string, fn func(float64, float64) float64) *starlark.
146
145
})
147
146
}
148
147
149
- // log wraps the Log function
148
+ // log wraps the Log function
149
+ //
150
150
// as a Starlark built-in that accepts int or float arguments.
151
151
func log (thread * starlark.Thread , b * starlark.Builtin , args starlark.Tuple , kwargs []starlark.Tuple ) (starlark.Value , error ) {
152
152
var (
0 commit comments