From: Wolfgang Denk Date: Tue, 29 Oct 2013 11:48:07 +0100 Subject: [U-Boot] Illegal use of FP ops in clock_ti814x.c In-Reply-To: References: <20131027211157.1AF2E380495@gemini.denx.de> <20131028235619.2507C380425@gemini.denx.de> Message-ID: <20131029104807.738E338061F@gemini.denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Dear M?ns Rullg?rd, In message you wrote: > > >> Something like this should be equivalent. That said, it looks > >> suspiciously like it's meant to simply do a division and round up. If > >> that is the case, +225 should be +249. It probably makes no difference > >> for the values actually encountered. > > > > Umm... this is the part which I do not understand. > > > > The original code adds 90%; you add 90%, too. However, to round up, > > one usually adds only 50% ? > > Adding 50% would round to nearest. For integer division to round up, > you must add one less than the divisor. Agreed. But do we want to round up? The original code used +90%, which is something else, too... > > Where are these 90% coming from? Are they in any way meaningful, or > > even critical? > > My guess is that it was someone's approximation of 249 / 250. I don't > know the hardware, so it's conceivable that it really should be this > way, although it seems unlikely. Are you able to test such a modificationon actual hardware? Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de "The X11 source code style is ATROCIOUS and should not be used as a model." - Doug Gwyn