[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMzD94R4AqjgtqxgpnZ67H6GvQzin1idxj8OjMmOfmruEc9_CQ@mail.gmail.com>
Date: Wed, 27 Nov 2019 09:25:37 -0800
From: Brian Vazquez <brianvv@...gle.com>
To: Maciej Żenczykowski <maze@...gle.com>
Cc: Stephen Hemminger <stephen@...workplumber.org>,
Brian Vazquez <brianvv.kernel@...il.com>,
David Ahern <dsahern@...il.com>,
Mahesh Bandewar <maheshb@...gle.com>,
Linux NetDev <netdev@...r.kernel.org>,
Leslie Monis <lesliemonis@...il.com>
Subject: Re: [PATCH iproute2] tc: fix warning in q_pie.c
On Wed, Nov 27, 2019 at 8:44 AM Maciej Żenczykowski <maze@...gle.com> wrote:
>
> > What compiler is this?
> > The type seems correct already. The type of double / unsigned long is double.
> > And the conversion may give different answer.
I don't think this conversion will give a different answer, the
compiler already change the value from UINT64_MAX to 'UINT64_MAX + 1'
which is pow of 2 and can be represented precisely in a double. This
change is just making that conversion explicit to avoid the warning.
>
> Probably some recent version of clang with -Wall.
It's clang 10
>
> That said, I think the warning/error is correct.
> UINT64 doesn't fit in double (which is also 64 bits, but includes sign
> and exponent) - you lose ~13 bits of precision.
> I'm not aware of a way to (natively) divide a double by a uint64
> without the loss (not that it really matters since the double doesn't
> have the requisite precision in the first place).
>
> Why do you think the conversion will give a different answer?
> Isn't this exactly what the compiler will do anyway?
> It's not like we have long double anymore...
Powered by blists - more mailing lists