On Sun, 2025-06-29 at 15:39 +0200, Scott Kostyshak wrote:
> Should we use some kind of tolerance value, e.g., based on
> std::numeric_limits<float>::epsilon and std::numeric_limits<double>::epsilon ?
> 
> /home/scott/lyxbuilds/master-master/repo/src/support/Length.h:119:22: warning:
> comparing floating point with == or != is unsafe [-Wfloat-equal]
>   119 |         { return l1.value() == l2.value() && l1.unit() == l2.unit(); }
>       |                  ~~~~~~~~~~ ^  ~~~~~~~~~~

Can we ever trigger a case where the values are within a few epsilons of
difference apart? :-)

> /home/scott/lyxbuilds/master-master/repo/src/tex2lyx/text.cpp:6290:21:
> warning: comparing floating point with == or != is unsafe [-Wfloat-equal]
>  6290 |                                         else if (value == -1.0)
>       |                                                  ~~~~~ ^  ~~~~

This case seems reasonable. In particular above you also have comparisons with 1
and 0.5. In this context they seem reasonable and fulfilling its purpose. :-)

> Scott

-- 
José Abílio
-- 
lyx-devel mailing list
lyx-devel@lists.lyx.org
https://lists.lyx.org/mailman/listinfo/lyx-devel

Reply via email to