...
Code Block | ||
---|---|---|
| ||
double currentBalance; // User's cash balance
void doDeposit(String userInput) {
double val = 0;
try {
val = Double.valueOf(userInput);
} catch (NumberFormatException e) {
// Handle input format error
}
if (val >= Double.MAX_VALUE - currentBalance) {
// Handle range error
}
currentBalance += val;
}
|
...
Code Block | ||
---|---|---|
| ||
double currentBalance; // User's cash balance void doDeposit(String suserInput){ double val = 0; try { val = Double.valueOf(userInput); } catch (NumberFormatException e) { // Handle input format error } if (Double.isInfinite(val)){ // Handle infinity error } if (Double.isNaN(val)) { // Handle NaN error } if (val >= Double.MAX_VALUE - currentBalance) { // Handle range error } currentBalance += val; } |
...
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="4f76f58b844a96ca-b97a2030-41b24522-9cbdaf45-58072a997d23bb09a8b1c9eb"><ac:plain-text-body><![CDATA[ | [[IEEE 754 | https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE7542006 | IEEE 754]] | ]]></ac:plain-text-body></ac:structured-macro> |
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="a16f0d0e6548da62-60f150bd-45d845e2-b526ab73-a2f355ec2769bb42d0014953"><ac:plain-text-body><![CDATA[ | [[IEEE 1003.1, 2004 | https://www.securecoding.cert.org/confluence/display/seccode/AA.+C+References#AA.CReferences-IEEE1003 | IEEE 1003.1, 2004]] | ]]></ac:plain-text-body></ac:structured-macro> |
...