()
| 215 | } |
| 216 | |
| 217 | private final void parse() { |
| 218 | if (coefficient != null || special != null) |
| 219 | return; |
| 220 | |
| 221 | String lc; |
| 222 | switch (lc = data.toLowerCase()) { |
| 223 | case "+nan": |
| 224 | case "nan": |
| 225 | case "-nan": |
| 226 | special = Special.NAN; |
| 227 | break; |
| 228 | |
| 229 | case "+infinity": |
| 230 | case "infinity": |
| 231 | case "+inf": |
| 232 | case "inf": |
| 233 | special = Special.POSITIVE_INFINITY; |
| 234 | break; |
| 235 | |
| 236 | case "-infinity": |
| 237 | case "-inf": |
| 238 | special = Special.NEGATIVE_INFINITY; |
| 239 | break; |
| 240 | |
| 241 | default: { |
| 242 | int i = lc.indexOf("e"); |
| 243 | |
| 244 | try { |
| 245 | if (i == -1) { |
| 246 | coefficient = new BigDecimal(data); |
| 247 | } |
| 248 | else { |
| 249 | coefficient = new BigDecimal(data.substring(0, i)); |
| 250 | exponent = Integer.parseInt(data.substring(i + 1)); |
| 251 | } |
| 252 | |
| 253 | normalise(); |
| 254 | } |
| 255 | |
| 256 | // [#10880] If we cannot represent the value internally, then we'll just work with data |
| 257 | catch (NumberFormatException ignore) {} |
| 258 | break; |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | private final void normalise() { |
| 264 | int scale = coefficient.scale(); |
no test coverage detected