Several float to int potential rounding errors/inconsistencies
Linus Torvalds
torvalds at linux-foundation.org
Tue Mar 7 09:11:41 PST 2017
On Mon, Mar 6, 2017 at 8:50 PM, Linus Torvalds
<torvalds at linux-foundation.org> wrote:
>
> Ugh, yes. Mainly because it warns even about the "cast rint() to an
> integer" case:
Actually, the correct thing to do is to use lrint(), but my very dim
memory is that this didn't work on Windows.
Dirk (or anybody else with a Windows build), does this build:
git grep -l '\<rint(' | xargs sed -i 's/rint(/lrint(/g'
it just replaces 'rint()" calls with 'lrint()'.
If it does build, you should just commit it. Otherwise we'd need some
Windows helper macro to implement it, possibly just
#ifdef WIN32
#define lrint(x) ((long)rint(x))
#endif
or similar.
That gets rid of the worst noise, and leaves just real (but admittedly
likely not very important) float->integer conversion warnings.
Linus
More information about the subsurface
mailing list