File: mathf.md

package info (click to toggle)
golang-github-masterminds-sprig 3.2.3-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 448 kB
  • sloc: makefile: 10
file content (85 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Float Math Functions

All math functions operate on `float64` values.

## addf

Sum numbers with `addf`

This will return `5.5`:

```
addf 1.5 2 2
```

## add1f

To increment by 1, use `add1f`

## subf

To subtract, use `subf`

This is equivalent to `7.5 - 2 - 3` and will return `2.5`:

```
subf 7.5 2 3
```

## divf

Perform integer division with `divf`

This is equivalent to `10 / 2 / 4` and will return `1.25`:

```
divf 10 2 4
```

## mulf

Multiply with `mulf`

This will return `6`:

```
mulf 1.5 2 2
```

## maxf

Return the largest of a series of floats:

This will return `3`:

```
maxf 1 2.5 3
```

## minf

Return the smallest of a series of floats.

This will return `1.5`:

```
minf 1.5 2 3
```

## floor

Returns the greatest float value less than or equal to input value

`floor 123.9999` will return `123.0`

## ceil

Returns the greatest float value greater than or equal to input value

`ceil 123.001` will return `124.0`

## round

Returns a float value with the remainder rounded to the given number to digits after the decimal point.

`round 123.555555` will return `123.556`