From: Youngjae Cho Date: Tue, 24 Sep 2019 02:43:49 +0000 (+0900) Subject: Add float typecasting to prevent the loss of fractional part in division X-Git-Tag: submit/tizen/20190924.060448^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fheads%2Ftizen_5.5_mobile_hotfix;p=platform%2Fadaptation%2Femulator%2Fdevice-manager-plugin-emul.git Add float typecasting to prevent the loss of fractional part in division Change-Id: I596e67df50c253591bc8365e60623b31ca4c51d1 Signed-off-by: Youngjae Cho --- diff --git a/src/device_manager_plugin_emul.c b/src/device_manager_plugin_emul.c index ebca0c4..6f0e226 100644 --- a/src/device_manager_plugin_emul.c +++ b/src/device_manager_plugin_emul.c @@ -374,7 +374,7 @@ int OEM_sys_get_backlight_brightness(int index, int *value, int power_saving) devmgr_log("Can't read max_brightness node[%s]", path); return ret; } - pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5); + pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5); if (*value > max_brightness - pwr_saving_offset) *value = max_brightness; @@ -409,7 +409,7 @@ static int OEM_sys_set_backlight_brightness(int index, int value, int power_savi devmgr_log("Can't read max_brightness node[%s]", path); return ret; } - pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * max_brightness / MAX_CANDELA_CRITERION) + 0.5); + pwr_saving_offset = (int)((PWR_SAVING_CANDELA_CRITERION * (float)max_brightness / MAX_CANDELA_CRITERION) + 0.5); if (value < pwr_saving_offset) value = 0;