mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-24 04:42:51 -04:00
fixes a overseen NumberFormatException
This commit is contained in:
parent
12c7d73692
commit
f0a1b16e9a
@ -222,11 +222,15 @@ public final class Bits {
|
||||
return val;
|
||||
}
|
||||
|
||||
private static long decodeFixed(String str) {
|
||||
private static long decodeFixed(String str) throws NumberFormatException {
|
||||
int p = str.indexOf(':');
|
||||
int frac = Integer.parseInt(str.substring(p + 1));
|
||||
double floating = Double.parseDouble(str.substring(0, p));
|
||||
return (long) (floating * (1L << frac));
|
||||
try {
|
||||
int frac = Integer.parseInt(str.substring(p + 1));
|
||||
double floating = Double.parseDouble(str.substring(0, p));
|
||||
return (long) (floating * (1L << frac));
|
||||
} catch (java.lang.NumberFormatException e) {
|
||||
throw new NumberFormatException(str, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user