File: math.in

package info (click to toggle)
fish 3.0.2-2%2Bdeb10u1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 36,448 kB
  • sloc: ansic: 75,559; cpp: 43,314; sh: 9,096; javascript: 7,710; python: 2,538; makefile: 1,461; objc: 709; perl: 367; xml: 18
file content (53 lines) | stat: -rw-r--r-- 935 bytes parent folder | download
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
logmsg Validate basic expressions
math 3 / 2
math 10/6
math -s0 10 / 6
math 'floor(10 / 6)'
math -s3 10/6
math '10 % 6'
math -s0 '10 % 6'
math '23 % 7'
math --scale=6 '5 / 3 * 0.3'
math "7^2"
math -1 + 1
math '-2 * -2'
math 5 \* -2
math -- -4 / 2
math -- '-4 * 2'

logmsg Validate some rounding functions
math 'round(3/2)' ; math 'floor(3/2)' ; math 'ceil(3/2)'
math 'round(-3/2)' ; math 'floor(-3/2)' ; math 'ceil(-3/2)'

logmsg Validate some integral computations
math 1
math 10
math 100
math 1000
math '10^15'
math '-10^14'
math '-10^15'

math -s0 '1.0 / 2.0'
math -s0 '3.0 / 2.0'
math -s0 '10^15 / 2.0'

logmsg Validate how variables in an expression are handled
math $x + 1
set x 1
math $x + 1
set x 3
set y 1.5
math "-$x * $y"
math -s0 "-$x * $y"

logmsg Validate math error reporting
not math '2 - '
not math 'ncr(1)'
not math 'max()'
not math 'sin()'
not math '2 + 2 4'
not math
not math -s 12
not math 2^999999
not math 1 / 0