[PATCH] various fixes detected with -Wdouble-promotion

Paul Eggert eggert@cs.ucla.edu
Sun Oct 12 20:16:00 GMT 2025


On 2025-10-11 02:47, Alexander Monakov wrote:
> Would you say the same about changing to 'x == 0' (integer zero)?

No, 'x == 0' is fine.

> as changes like this:
> 
> -    p6 = p[6] + y * -0xf.ff6b8p-12;
> +    p6 = p[6] + y * -0xf.ff6b8p-12f;
> 
> in the patch show, Glibc would be better off being clean w.r.t
> -Wdouble-promotion.

That change is questionable, as it appears that the error induced by 
sticking to single precision likely outweighs the error induced by 
double-rounding. If it's really the intent to increase the error (or if 
there's some reason the error is not increased), this change (and 
similar changes) should be accompanied by commentary stating why the 
code sticks to single precision even though double precision would 
apparently yield less error.

Sorry if my earlier message seemed offputting. My intent was only to 
focus on maintainability (and I guess now on correctness), instead of 
focusing on the secondary goal of pacifying false alarms from the compiler.


More information about the Libc-alpha mailing list