Skip to content

Commit 9d2b5f9

Browse files
raoulbjmooring
andauthored
math: Add trigonometric functions and some angle helper functions
This commit adds these new template functions in the `math` namespace: math.Acos math.Asin math.Atan math.Atan2 math.Cos math.Pi math.Sin math.Tan math.ToDegrees math.ToRadians Co-authored-by: Joe Mooring <[email protected]>
1 parent 0e00561 commit 9d2b5f9

File tree

14 files changed

+933
-54
lines changed

14 files changed

+933
-54
lines changed
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Acos
3+
description: Returns the arccosine, in radians, of the given number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Asin
10+
- functions/math/Atan
11+
- functions/math/Atan2
12+
- functions/math/Pi
13+
- functions/math/Sin
14+
- functions/math/Cos
15+
- functions/math/Tan
16+
returnType: float64
17+
signatures: [math.Acos VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Acos 1 }} → 0
24+
```
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Asin
3+
description: Returns the arcsine, in radians, of the given number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Acos
10+
- functions/math/Atan
11+
- functions/math/Atan2
12+
- functions/math/Pi
13+
- functions/math/Sin
14+
- functions/math/Cos
15+
- functions/math/Tan
16+
returnType: float64
17+
signatures: [math.Asin VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Asin 1 }} → 1.5707963267948966
24+
```
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Atan
3+
description: Returns the arctangent, in radians, of the given number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Atan2
10+
- functions/math/Asin
11+
- functions/math/Acos
12+
- functions/math/Pi
13+
- functions/math/Sin
14+
- functions/math/Cos
15+
- functions/math/Tan
16+
returnType: float64
17+
signatures: [math.Atan VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Atan 1 }} → 0.7853981633974483
24+
```
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Atan2
3+
description: Returns the arctangent, in radians, of the given number pair, determining the correct quadrant from their signs.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Atan
10+
- functions/math/Asin
11+
- functions/math/Acos
12+
- functions/math/Pi
13+
- functions/math/Sin
14+
- functions/math/Cos
15+
- functions/math/Tan
16+
returnType: float64
17+
signatures: [math.Atan2 VALUE VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Atan2 1 2 }} → 0.4636476090008061
24+
```

docs/content/en/functions/math/Cos.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Cos
3+
description: Returns the cosine of the given radian number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Pi
10+
- functions/math/Sin
11+
- functions/math/Tan
12+
- functions/math/Asin
13+
- functions/math/Acos
14+
- functions/math/Atan
15+
- functions/math/Atan2
16+
returnType: float64
17+
signatures: [math.Cos VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Cos 1 }} → 0.5403023058681398
24+
```

docs/content/en/functions/math/Pi.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Pi
3+
description: Returns the mathematical constant pi.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Sin
10+
- functions/math/Cos
11+
- functions/math/Tan
12+
- functions/math/Asin
13+
- functions/math/Acos
14+
- functions/math/Atan
15+
- functions/math/Atan2
16+
returnType: float64
17+
signatures: [math.Pi]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Pi }} → 3.141592653589793
24+
```

docs/content/en/functions/math/Sin.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Sin
3+
description: Returns the sine of the given radian number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Pi
10+
- functions/math/Cos
11+
- functions/math/Tan
12+
- functions/math/Asin
13+
- functions/math/Acos
14+
- functions/math/Atan
15+
- functions/math/Atan2
16+
returnType: float64
17+
signatures: [math.Sin VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Sin 1 }} → 0.8414709848078965
24+
```

docs/content/en/functions/math/Tan.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
title: math.Tan
3+
description: Returns the tangent of the given radian number.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/Pi
10+
- functions/math/Sin
11+
- functions/math/Cos
12+
- functions/math/Asin
13+
- functions/math/Acos
14+
- functions/math/Atan
15+
- functions/math/Atan2
16+
returnType: float64
17+
signatures: [math.Tan VALUE]
18+
---
19+
20+
{{< new-in 0.130.0 >}}
21+
22+
```go-html-template
23+
{{ math.Tan 1 }} → 1.557407724654902
24+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: math.ToDegrees
3+
description: ToDegrees converts radians into degrees.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/ToRadians
10+
- functions/math/Pi
11+
returnType: float64
12+
signatures: [math.ToDegrees VALUE]
13+
---
14+
15+
{{< new-in 0.130.0 >}}
16+
17+
```go-html-template
18+
{{ math.ToDegrees 1.5707963267948966 }} → 90
19+
```
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
title: math.ToRadians
3+
description: ToRadians converts degrees into radians.
4+
categories: []
5+
keywords: []
6+
action:
7+
aliases: []
8+
related:
9+
- functions/math/ToDegrees
10+
- functions/math/Pi
11+
returnType: float64
12+
signatures: [math.ToRadians VALUE]
13+
---
14+
15+
{{< new-in 0.130.0 >}}
16+
17+
```go-html-template
18+
{{ math.ToRadians 90 }} → 1.5707963267948966
19+
```

0 commit comments

Comments
 (0)