Skip to content
This repository
branch: master
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

file 312 lines (310 sloc) 10.689 kb
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 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311
# template data expected description (optional)
%6. 6s '' %6. 6s INVALID (See use of $w in code above)
%6 .6s '' %6 .6s INVALID
%6.6 s '' %6.6 s INVALID
%A '' %A INVALID
%B '' %B INVALID
%C '' %C INVALID
%D 0x7fffffff 2147483647 Synonym for %ld
%E 123456.789 1.234568E+05 Like %e, but using upper-case "E"
%F 123456.789 123456.789000 Synonym for %f
%G 1234567.89 1.23457E+06 Like %g, but using upper-case "E"
%G 1234567e96 1.23457E+102
%G .1234567e-101 1.23457E-102
%G 12345.6789 12345.7
%G 1234567e96 1.23457E+102 exponent too big skip: os390
%G .1234567e-101 1.23457E-102 exponent too small skip: os390
%H '' %H INVALID
%I '' %I INVALID
%J '' %J INVALID
%K '' %K INVALID
%L '' %L INVALID
%M '' %M INVALID
%N '' %N INVALID
%O 2**32-1 37777777777 Synonym for %lo
%P '' %P INVALID
%Q '' %Q INVALID
%R '' %R INVALID
%S '' %S INVALID
%T '' %T INVALID
%U 2**32-1 4294967295 Synonym for %lu
%V '' %V INVALID
%W '' %W INVALID
%X 2**32-1 FFFFFFFF Like %x, but with u/c letters
%#X 2**32-1 0XFFFFFFFF
%Y '' %Y INVALID
%Z '' %Z INVALID
%a '' %a INVALID
%b 2**32-1 11111111111111111111111111111111
%+b 2**32-1 11111111111111111111111111111111
%#b 2**32-1 0b11111111111111111111111111111111
%34b 2**32-1 11111111111111111111111111111111
%034b 2**32-1 0011111111111111111111111111111111
%-34b 2**32-1 11111111111111111111111111111111
%-034b 2**32-1 11111111111111111111111111111111
%c 65 A
%10c 65 A
%#10c 65 A # modifier: no effect
%010c 65 000000000A
%10lc 65 A l modifier: no effect
%10hc 65 A h modifier: no effect
%10.5c 65 A precision: no effect
%-10c 65 A
%d 123456.789 123456
%d -123456.789 -123456
%d 0 0
%+d 0 +0
%0d 0 0
%.0d 0
%+.0d 0 +
%.0d 1 1
%d 1 1
%+d 1 +1
%#3.2d 1 01 # modifier: no effect
%3.2d 1 01
%03.2d 1 001
%-3.2d 1 01
%-03.2d 1 01 zero pad + left just.: no effect
%d -1 -1
%+d -1 -1
%hd 1 1 More extensive testing of
%ld 1 1 length modifiers would be
%Vd 1 1 platform-specific
%vd chr(1) 1
%+vd chr(1) +1
%#vd chr(1) 1
%vd "\01\02\03" 1.2.3
%vd v1.2.3 1.2.3
%vd [version::qv("1.2.3")] 1.2.3
%vd [version->new("1.2")] 1.200
%vd [version->new("1.02")] 1.20
%vd [version->new("1.002")] 1.2
%vd [version->new("1048576.5")] 1048576.500
%vd [version->new("50")] 50.0
%v.3d "\01\02\03" 001.002.003
%0v3d "\01\02\03" 001.002.003
%v.3d [version::qv("1.2.3")] 001.002.003
%-v3d "\01\02\03" 1 .2 .3
%+-v3d "\01\02\03" +1 .2 .3
%+-v3d [version::qv("1.2.3")] +1 .2 .3
%v4.3d "\01\02\03" 001. 002. 003
%0v4.3d "\01\02\03" 0001.0002.0003
%0*v2d ['-', "\0\7\14"] 00-07-12
%v.*d ["\01\02\03", 3] 001.002.003
%0v*d ["\01\02\03", 3] 001.002.003
%-v*d ["\01\02\03", 3] 1 .2 .3
%+-v*d ["\01\02\03", 3] +1 .2 .3
%v*.*d ["\01\02\03", 4, 3] 001. 002. 003
%0v*.*d ["\01\02\03", 4, 3] 0001.0002.0003
%0*v*d ['-', "\0\7\13", 2] 00-07-11
%0*v*d ['-', version::qv("0.7.11"), 2] 00-07-11
%e 1234.875 1.234875e+03
%e 0.000012345 1.234500e-05
%e 1234567E96 1.234567e+102
%e 0 0.000000e+00
%e .1234567E-101 1.234567e-102
%+e 1234.875 +1.234875e+03
%#e 1234.875 1.234875e+03
%e -1234.875 -1.234875e+03
%+e -1234.875 -1.234875e+03
%#e -1234.875 -1.234875e+03
%.0e 1234.875 1e+03
%#.0e 1234.875 1.e+03
%.0e 1.875 2e+00
%.0e 0.875 9e-01
%.*e [0, 1234.875] 1e+03
%.1e 1234.875 1.2e+03
%-12.4e 1234.875 1.2349e+03
%12.4e 1234.875 1.2349e+03
%+-12.4e 1234.875 +1.2349e+03
%+12.4e 1234.875 +1.2349e+03
%+-12.4e -1234.875 -1.2349e+03
%+12.4e -1234.875 -1.2349e+03
%e 1234567E96 1.234567e+102 exponent too big skip: os390
%e .1234567E-101 1.234567e-102 exponent too small skip: os390
%f 1234.875 1234.875000
%+f 1234.875 +1234.875000
%#f 1234.875 1234.875000
%f -1234.875 -1234.875000
%+f -1234.875 -1234.875000
%#f -1234.875 -1234.875000
%6f 1234.875 1234.875000
%*f [6, 1234.875] 1234.875000
%.0f -0.1 -0 C library bug: no minus skip: VMS
%.0f 1234.875 1235
%.1f 1234.875 1234.9
%-8.1f 1234.875 1234.9
%8.1f 1234.875 1234.9
%+-8.1f 1234.875 +1234.9
%+8.1f 1234.875 +1234.9
%+-8.1f -1234.875 -1234.9
%+8.1f -1234.875 -1234.9
%*.*f [5, 2, 12.3456] 12.35
%f 0 0.000000
%.0f 0 0
%.0f 2**38 274877906944 Should have exact int'l rep'n
%.0f 0.1 0
%.0f 0.6 1 Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix
%.0f -0.6 -1 Known to fail with sfio, (irix|nonstop-ux|powerux); -DHAS_LDBL_SPRINTF_BUG may fix
%.0f 1.6 2
%.0f -1.6 -2
%.0f 1 1
%#.0f 1 1.
%.0lf 1 1 'l' should have no effect
%.0hf 1 %.0hf INVALID 'h' should be rejected
%g 12345.6789 12345.7
%+g 12345.6789 +12345.7
%#g 12345.6789 12345.7
%.0g -0.0 -0 C99 standard mandates minus sign but C89 does not skip: MSWin32 VMS hpux:10.20 openbsd netbsd:1.5 irix
%.0g 12345.6789 1e+04
%#.0g 12345.6789 1.e+04
%.2g 12345.6789 1.2e+04
%.*g [2, 12345.6789] 1.2e+04
%.9g 12345.6789 12345.6789
%12.9g 12345.6789 12345.6789
%012.9g 12345.6789 0012345.6789
%-12.9g 12345.6789 12345.6789
%*.*g [-12, 9, 12345.6789] 12345.6789
%-012.9g 12345.6789 12345.6789
%g -12345.6789 -12345.7
%+g -12345.6789 -12345.7
%g 1234567.89 1.23457e+06
%+g 1234567.89 +1.23457e+06
%#g 1234567.89 1.23457e+06
%g -1234567.89 -1.23457e+06
%+g -1234567.89 -1.23457e+06
%#g -1234567.89 -1.23457e+06
%g 0.00012345 0.00012345
%g 0.000012345 1.2345e-05
%g 1234567E96 1.23457e+102
%g .1234567E-101 1.23457e-102
%g 0 0
%13g 1234567.89 1.23457e+06
%+13g 1234567.89 +1.23457e+06
%013g 1234567.89 001.23457e+06
%-13g 1234567.89 1.23457e+06
%g .1234567E-101 1.23457e-102 exponent too small skip: os390
%g 1234567E96 1.23457e+102 exponent too big skip: os390
%h '' %h INVALID
%i 123456.789 123456 Synonym for %d
%j '' %j INVALID
%k '' %k INVALID
%l '' %l INVALID
%m '' %m INVALID
%s sprintf('%%n%n %d', $n, $n) %n 2 Slight sneakiness to test %n
%o 2**32-1 37777777777
%+o 2**32-1 37777777777
%#o 2**32-1 037777777777
%o 642 1202 check smaller octals across platforms
%+o 642 1202
%#o 642 01202
%d $p=sprintf('%p',$p);$p=~/^[0-9a-f]+$/ 1 Coarse hack: hex from %p?
%d $p=sprintf('%-8p',$p);$p=~/^[0-9a-f]+\s*$/ 1 Coarse hack: hex from %p?
%#p '' %#p INVALID
%q '' %q INVALID
%r '' %r INVALID
%s 'string' string
%10s 'string' string
%+10s 'string' string
%#10s 'string' string
%010s 'string' 0000string
%0*s [10, 'string'] 0000string
%-10s 'string' string
%3s 'string' string
%.3s 'string' str
%.*s [3, 'string'] str
%t '' %t INVALID
%u 2**32-1 4294967295
%+u 2**32-1 4294967295
%#u 2**32-1 4294967295
%12u 2**32-1 4294967295
%012u 2**32-1 004294967295
%-12u 2**32-1 4294967295
%-012u 2**32-1 4294967295
%v '' %v INVALID
%w '' %w INVALID
%x 2**32-1 ffffffff
%+x 2**32-1 ffffffff
%#x 2**32-1 0xffffffff
%10x 2**32-1 ffffffff
%010x 2**32-1 00ffffffff
%-10x 2**32-1 ffffffff
%-010x 2**32-1 ffffffff
%0-10x 2**32-1 ffffffff
%0*x [-10, ,2**32-1] ffffffff
%vx [version::qv("1.2.3")] 1.2.3
%vx [version::qv("1.20.300")] 1.14.12c
%y '' %y INVALID
%z '' %z INVALID
%2$d %1$d [12, 34] 34 12
%*2$d [12, 3] 12
%2$d %d [12, 34] 34 12
%2$d %d %d [12, 34] 34 12 34
%3$d %d %d [12, 34, 56] 56 12 34
%2$*3$d %d [12, 34, 3] 34 12
%*3$2$d %d [12, 34, 3] %*3$2$d 12 INVALID
%2$d 12 0 UNINIT
%0$d 12 %0$d INVALID
%1$$d 12 %1$$d INVALID
%1$1$d 12 %1$1$d INVALID
%*2$*2$d [12, 3] %*2$*2$d INVALID
%*2*2$d [12, 3] %*2*2$d INVALID
%*2$1d [12, 3] %*2$1d INVALID
%0v2.2d ''
%vc,%d [63, 64, 65] %vc,63 INVALID
%v%,%d [63, 64, 65] %v%,63 INVALID
%vd,%d ["\x1", 2, 3] 1,2
%vf,%d [1, 2, 3] %vf,1 INVALID
%vF,%d [1, 2, 3] %vF,1 INVALID
%ve,%d [1, 2, 3] %ve,1 INVALID
%vE,%d [1, 2, 3] %vE,1 INVALID
%vg,%d [1, 2, 3] %vg,1 INVALID
%vG,%d [1, 2, 3] %vG,1 INVALID
%vp '' %vp INVALID
%vn '' %vn INVALID
%vs,%d [1, 2, 3] %vs,1 INVALID
%v_ '' %v_ INVALID
%v#x '' %v#x INVALID
%v02x "\x66\x6f\x6f\012" 66.6f.6f.0a
%#v.8b "\141\000\142" 0b01100001.00000000.0b01100010 perl #39530
%#v.4o "\141\000\142" 0141.0000.0142 perl #39530
%#v.3i "\141\000\142" 097.000.098 perl #39530
%#v.2x "\141\000\142" 0x61.00.0x62 perl #39530
%#v.2X "\141\000\142" 0X61.00.0X62 perl #39530
%#v.8b "\141\017\142" 0b01100001.0b00001111.0b01100010 perl #39530
%#v.4o "\141\017\142" 0141.0017.0142 perl #39530
%#v.3i "\141\017\142" 097.015.098 perl #39530
%#v.2x "\141\017\142" 0x61.0x0f.0x62 perl #39530
%#v.2X "\141\017\142" 0X61.0X0F.0X62 perl #39530
%#*v.8b ["][", "\141\000\142"] 0b01100001][00000000][0b01100010 perl #39530
%#*v.4o ["][", "\141\000\142"] 0141][0000][0142 perl #39530
%#*v.3i ["][", "\141\000\142"] 097][000][098 perl #39530
%#*v.2x ["][", "\141\000\142"] 0x61][00][0x62 perl #39530
%#*v.2X ["][", "\141\000\142"] 0X61][00][0X62 perl #39530
%#*v.8b ["][", "\141\017\142"] 0b01100001][0b00001111][0b01100010 perl #39530
%#*v.4o ["][", "\141\017\142"] 0141][0017][0142 perl #39530
%#*v.3i ["][", "\141\017\142"] 097][015][098 perl #39530
%#*v.2x ["][", "\141\017\142"] 0x61][0x0f][0x62 perl #39530
%#*v.2X ["][", "\141\017\142"] 0X61][0X0F][0X62 perl #39530
%#v.8b "\141\x{1e01}\000\142\x{1e03}" 0b01100001.0b1111000000001.00000000.0b01100010.0b1111000000011 perl #39530
%#v.4o "\141\x{1e01}\000\142\x{1e03}" 0141.017001.0000.0142.017003 perl #39530
%#v.3i "\141\x{1e01}\000\142\x{1e03}" 097.7681.000.098.7683 perl #39530
%#v.2x "\141\x{1e01}\000\142\x{1e03}" 0x61.0x1e01.00.0x62.0x1e03 perl #39530
%#v.2X "\141\x{1e01}\000\142\x{1e03}" 0X61.0X1E01.00.0X62.0X1E03 perl #39530
%#v.8b "\141\x{1e01}\017\142\x{1e03}" 0b01100001.0b1111000000001.0b00001111.0b01100010.0b1111000000011 perl #39530
%#v.4o "\141\x{1e01}\017\142\x{1e03}" 0141.017001.0017.0142.017003 perl #39530
%#v.3i "\141\x{1e01}\017\142\x{1e03}" 097.7681.015.098.7683 perl #39530
%#v.2x "\141\x{1e01}\017\142\x{1e03}" 0x61.0x1e01.0x0f.0x62.0x1e03 perl #39530
%#v.2X "\141\x{1e01}\017\142\x{1e03}" 0X61.0X1E01.0X0F.0X62.0X1E03 perl #39530
%V-%s ["Hello"] %V-Hello INVALID
%K %d %d [13, 29] %K 13 29 INVALID
%*.*K %d [13, 29, 76] %*.*K 13 INVALID
%4$K %d [45, 67] %4$K 45 INVALID
%d %K %d [23, 45] 23 %K 45 INVALID
%*v*999\$d %d %d [11, 22, 33] %*v*999\$d 11 22 INVALID
%#b 0 0
%#o 0 0
%#x 0 0
%2147483647$v2d ''
%*2147483647$v2d '' UNINIT

# vim: sw=4 et
Something went wrong with that request. Please try again.