xref: /freebsd/contrib/one-true-awk/testdir/t.addops (revision 5956d97f4b3204318ceb6aa9c77bd0bc6ea87a41)
1{	n = $1
2	n += $1
3	if (n != $1 + $1) print NR,  "urk +="
4	n = $1
5	n -= $1
6	if (n != 0) print NR,  "urk -="
7	n = $1
8	n *= 3.5
9	if (n != 3.5 * $1) print NR,  "urk *="
10	n = $1
11	n /= 4
12	if (n != $1 / 4) print NR,  "urk /="
13	n = NR
14	n ^= 2
15	if (n != NR * NR) print NR,  "urk1 ^=", n, NR * NR
16	n = NR
17	n **= 2
18	if (n != NR * NR) print NR,  "urk1 **=", n, NR * NR
19	n = NR
20	n ^= 1.5
21	ns = sprintf("%.10g", n)
22	sq = sprintf("%.10g", NR * sqrt(NR))
23	if (ns != sq) print NR,  "urk2 ^=", ns, sq
24}
25