| 243 | #define MASK (KMAX-1) |
| 244 | |
| 245 | static double decfloat(FFFILE *f, int c, int bits, int emin, int sign, int pok) |
| 246 | { |
| 247 | uint32_t x[KMAX]; |
| 248 | static const uint32_t th[] = { LD_B1B_MAX }; |
| 249 | int i, j, k, a, z; |
| 250 | long long lrp=0, dc=0; |
| 251 | long long e10=0; |
| 252 | int lnz = 0; |
| 253 | int gotdig = 0, gotrad = 0; |
| 254 | int rp; |
| 255 | int e2; |
| 256 | int emax = -emin-bits+3; |
| 257 | int denormal = 0; |
| 258 | double y; |
| 259 | double frac=0; |
| 260 | double bias=0; |
| 261 | static const int p10s[] = { 10, 100, 1000, 10000, |
| 262 | 100000, 1000000, 10000000, 100000000 }; |
| 263 | |
| 264 | j=0; |
| 265 | k=0; |
| 266 | |
| 267 | /* Don't let leading zeros consume buffer space */ |
| 268 | for (; c=='0'; c = shgetc(f)) gotdig=1; |
| 269 | if (c=='.') { |
| 270 | gotrad = 1; |
| 271 | for (c = shgetc(f); c=='0'; c = shgetc(f)) gotdig=1, lrp--; |
| 272 | } |
| 273 | |
| 274 | x[0] = 0; |
| 275 | for (; c-'0'<10U || c=='.'; c = shgetc(f)) { |
| 276 | if (c == '.') { |
| 277 | if (gotrad) break; |
| 278 | gotrad = 1; |
| 279 | lrp = dc; |
| 280 | } else if (k < KMAX-3) { |
| 281 | dc++; |
| 282 | if (c!='0') lnz = dc; |
| 283 | if (j) x[k] = x[k]*10 + c-'0'; |
| 284 | else x[k] = c-'0'; |
| 285 | if (++j==9) { |
| 286 | k++; |
| 287 | j=0; |
| 288 | } |
| 289 | gotdig=1; |
| 290 | } else { |
| 291 | dc++; |
| 292 | if (c!='0') { |
| 293 | lnz = (KMAX-4)*9; |
| 294 | x[KMAX-4] |= 1; |
| 295 | } |
| 296 | } |
| 297 | } |
| 298 | if (!gotrad) lrp=dc; |
| 299 | |
| 300 | if (gotdig && (c|32)=='e') { |
| 301 | e10 = scanexp(f, pok); |
| 302 | if (e10 == LLONG_MIN) { |
no test coverage detected