This code is trying to abbreviate printing `0.000` or `1.000`. We can more
accurately describe the situations under which this will happen, squashing:
gvrender_core_svg.c: In function ‘svg_print_stop’:
gvrender_core_svg.c:525:16: warning: comparing floating-point with ‘==’ or
‘!=’ is unsafe [-Wfloat-equal]
525 | if (offset == 0.0)
| ^~
gvrender_core_svg.c:527:21: warning: comparing floating-point with ‘==’ or
‘!=’ is unsafe [-Wfloat-equal]
527 | else if (offset == 1.0)
| ^~
static void svg_print_stop(GVJ_t * job, double offset, gvcolor_t color)
{
- if (offset == 0.0)
+ if (fabs(offset - 0.0) < 0.0005)
gvputs(job, "<stop offset=\"0\" style=\"stop-color:");
- else if (offset == 1.0)
+ else if (fabs(offset - 1.0) < 0.0005)
gvputs(job, "<stop offset=\"1\" style=\"stop-color:");
else
gvprintf(job, "<stop offset=\"%.03f\" style=\"stop-color:", offset);