Thanks Dave!
Nice try... however it doesn't work, you need all the bits to get the result R correct. Easy to test this with Excel
Actually (L/2)^2 could be calculated earlier in the PC and programmed as a constant to PIC. Then it would reduce the formula
to
R=(H*H + Lsqr2)/H
and
in this case the constant Lsqr2 = 24 822 475 152 and this is too big also for the LONG variable but now used only as a input to the formula. We could also see the formula like this:
R= (H*H)/H + Lsqr2/H = H + Lsqr2/H, this would reduce all calculation to just one little bit tricky (too many bits) part
=> Lsqr2/H
How could this be compiled easily? 35 bits with 16 bits, is it easily done or does it demand some special technique?
If you know, please advice ...
Bookmarks