Merge pull request #108638 from Ivorforce/range-float
Use `double` consistently in `Range::get_as_ratio`.
This commit is contained in:
@ -272,12 +272,12 @@ double Range::get_as_ratio() const {
|
|||||||
if (shared->exp_ratio && get_min() >= 0) {
|
if (shared->exp_ratio && get_min() >= 0) {
|
||||||
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
|
double exp_min = get_min() == 0 ? 0.0 : Math::log(get_min()) / Math::log((double)2);
|
||||||
double exp_max = Math::log(get_max()) / Math::log((double)2);
|
double exp_max = Math::log(get_max()) / Math::log((double)2);
|
||||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
double value = CLAMP(get_value(), shared->min, shared->max);
|
||||||
double v = Math::log(value) / Math::log((double)2);
|
double v = Math::log(value) / Math::log((double)2);
|
||||||
|
|
||||||
return CLAMP((v - exp_min) / (exp_max - exp_min), 0, 1);
|
return CLAMP((v - exp_min) / (exp_max - exp_min), 0, 1);
|
||||||
} else {
|
} else {
|
||||||
float value = CLAMP(get_value(), shared->min, shared->max);
|
double value = CLAMP(get_value(), shared->min, shared->max);
|
||||||
return CLAMP((value - get_min()) / (get_max() - get_min()), 0, 1);
|
return CLAMP((value - get_min()) / (get_max() - get_min()), 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user