float-equal warnings

Gary E. Miller gem at rellim.com
Mon Apr 10 02:06:53 UTC 2017


Yo trv-n at comcast.net!

On Sun, 09 Apr 2017 20:57:10 -0400
trv-n at comcast.net wrote:

> In ntp_refclock.c function refclock_control near line 920 a test for a
> nonzero value is made with the time1 and time2 fudges, which raises
> float-equal warnings.

Yup.

> One way to fix this is to compare against DBL_MIN, but float.h would
> need to be included.

Yup.

> Comparing against LOGTOD(-31) will fail for any value less than ~0.2ns
> (the minimum l_fp fraction).

Yup.  Except the results is a constant, and having to compute a log
every time on a constant is a bit watesful.

> Comparing against S_PER_NS will fail for values less than 1ns.

Yup.  Or maybe S_PER_NS/10 in case the value might be rounded.

> I was going to submit a patch with LOGTOD() since it doesn't seem like
> a user would bother to put a fudge smaller than that, but I thought
> I'd ask first.

I agree, for most cases.  There are a few where 0.09 may be enough.

Start hacking, send a merge request or a patch.  We can interate to a
solution.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
	gem at rellim.com  Tel:+1 541 382 8588

	    Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ntpsec.org/pipermail/devel/attachments/20170409/aae320e7/attachment.bin>


More information about the devel mailing list