piclist 2001\01\19\175316a >
Thread: Maths Problem
face BY : Kübek Tonyemail (remove spam text)

I forgot to reply to your question Philip :)
anyway here goes:

Philip Martin wrote:

>get into this figure to convert it into MPH. Thus 122.75 / 12.63
>would be 9.718 mph.


>Route b)
>12275 = 2F (msb) & F3 (lsb) / 1263 = 04 (msb) & EF (lsb) = 00 09 (msb)
. 03
>83 (lsb) or 9.908.
>Would I be right in thinking that route b) is the more correct way to
do it
>and the error is due to the maths capability of the math routine?

Well not really, you start with the value 12.275 which has as many digit
as you need
then you divide it, this way you are ( alomost ) bound to 'loose'

If you instead convert it to 8.16 format you will have this:
122 = 0x7A
275 * 65.534 = 18021.85 = 0x4666
all togehter:
Divide by 12.63 will generate:
to convert to 'fixed 4 digit after decimal point''
Multiply by 10000 / 256*256 = 0.152588 ( rounded )
will generate:
0x017A2D which is 96813 in decimal with 4 digits after dp we get
9.6813 mph which is closer than your original formulas.

I'm sorry for the bad example to the maths pro's on the list but I'm in
a hurry :)


Tony Kübek, Flintab AB            
E-mail: tony.kubekKILLspamspamKILLspamflintab.com

http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

<200101192220.XAA21422@mn10.swip.net> quoted-printable

See also: www.piclist.com/techref/microchip/math/index.htm?key=math
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) Maths Problem

month overview.

new search...