are real numbers evil ?

This commit is contained in:
tTh 2022-09-19 11:17:24 +02:00
parent feafd2799d
commit eedc9197db
1 changed files with 6 additions and 5 deletions

View File

@ -16,9 +16,10 @@ extern int verbosity;
/* --------------------------------------------------------------------- */
/* new func: Wed 14 Sep 2022 11:28:04 AM CEST
*/
int fimg_equalize(FloatImg *src, float vmax)
int fimg_equalize(FloatImg *src, double vmax)
{
float mm[6], maxi, coef;
float mm[6];
double maxi, coef;
int foo;
#if DEBUG_LEVEL
@ -31,8 +32,8 @@ if (foo) {
fprintf(stderr, "%s: err %d get_minmax\n", __func__, foo);
return foo;
}
maxi = mm[1] > mm[3] ? mm[1] : mm[3];
maxi = maxi > mm[5] ? maxi : mm[5];
maxi = mm[1] > mm[3] ? (double)mm[1] : (double)mm[3];
maxi = maxi > mm[5] ? maxi : (double)mm[5];
coef = vmax / maxi;
if (verbosity) {
@ -41,7 +42,7 @@ if (verbosity) {
fprintf(stderr, "vmax %f maxi %f multcoef = %g\n", vmax, maxi, coef);
}
foo = fimg_mul_cste(src, coef);
foo = fimg_mul_cste(src, (float)coef);
if (foo) {
fprintf(stderr, "%s: err %d mul_cste\n", __func__, foo);
return foo;