...
Code Block | ||||
---|---|---|---|---|
| ||||
float calcPercentagecalc_percentage(float value) { return value * 0.1f; } void floatRoutinefloat_routine(void) { float value = 99.0f; long double percentage; percentage = calcPercentagecalc_percentage(value); } |
Compliant Solution (Cast)
...
Code Block | ||||
---|---|---|---|---|
| ||||
float calcPercentagecalc_percentage(float value) { return (float)(value * 0.1f); } void floatRoutinefloat_routine(void) { float value = 99.0f; long double percentage; percentage = calcPercentagecalc_percentage(value); } |
Compliant Solution (Within the Function)
...
Code Block | ||||
---|---|---|---|---|
| ||||
void floatRoutinefloat_routine(void) { float value = 99.0f; long double percentage; volatile float temp; percentage = temp = calcPercentagecalc_percentage(value); } |
Compliant Solution (Outside the Function)
...
Code Block | ||||
---|---|---|---|---|
| ||||
void floatRoutinefloat_routine(void) { float value = 99.0f; long double percentage; percentage = (float)calcPercentage calc_percentage(value); } |
Risk Assessment
...