Debian Codegraph @

tests/testthat/_snaps/format_decimal.md

raw symbols SCIP
1 # output test
2
3 Code
4 pillar(add_special((10^(-3:4)) * c(-1, 1)))
5 Output
6 <pillar>
7 <dbl>
8 -0.001
9 0.01
10 -0.1
11 1
12 -10
13 100
14 -1000
15 10000
16 NA
17 -Inf
18 Inf
19 Code
20 pillar(add_special(1.23456 * 10^(-3:3)))
21 Output
22 <pillar>
23 <dbl>
24 0.00123
25 0.0123
26 0.123
27 1.23
28 12.3
29 123.
30 1235.
31 NA
32 -Inf
33 Inf
34
35 ---
36
37 Code
38 pillar(add_special((10^(c(-2:4, 0L))) * c(-1, 1)))
39 Output
40 <pillar>
41 <dbl>
42 -0.01
43 0.1
44 -1
45 10
46 -100
47 1000
48 -10000
49 1
50 NA
51 -Inf
52 Inf
53
54 ---
55
56 Code
57 pillar(add_special((10^(0:-5)) * c(-1, 1)), width = 20)
58 Output
59 <pillar>
60 <dbl>
61 -1
62 0.1
63 -0.01
64 0.001
65 -0.0001
66 0.00001
67 NA
68 -Inf
69 Inf
70
71 ---
72
73 Code
74 pillar(add_special((10^(4:-4)) + 1e-06), width = 20)
75 Output
76 <pillar>
77 <dbl>
78 10000.
79 1000.
80 100.
81 10.0
82 1.00
83 0.100
84 0.0100
85 0.00100
86 0.000101
87 NA
88 -Inf
89 Inf
90
91 # 9.99...95 (tidyverse/tibble#1648)
92
93 Code
94 format(num(x[1], sigfig = 3))
95 Output
96 [1] "9.99"
97 Code
98 format(num(x[2], sigfig = 6))
99 Output
100 [1] "9.99999"
101 Code
102 format(num(x[3], sigfig = 7))
103 Output
104 [1] "9.999999"
105 Code
106 format(num(x[4], sigfig = 11))
107 Output
108 [1] "9.9999999999"
109 Code
110 format(num(x[5], sigfig = 14, notation = "dec"))
111 Output
112 [1] "9.9999999999999"
113
114 # sigfig > 15 fails
115
116 Code
117 format(num(0, sigfig = 16))
118 Condition
119 Error in `check_sigfig()`:
120 ! `sigfig` cannot be larger than 15.
121