help me
Archiver
Posts: 46,084
Can someone please help me do simple math problem on a bs2?
7501876 / X = Y
" X " is a word size from 0 to 65535
I do not need a decimal point
I don't want to get a math coprocessor from AWC since I will only be using one other problem.
7501876 / X = Y
" X " is a word size from 0 to 65535
I do not need a decimal point
I don't want to get a math coprocessor from AWC since I will only be using one other problem.
Comments
> Can someone please help me do simple math problem on a bs2?
>
> 7501876 / X = Y
>
> " X " is a word size from 0 to 65535
>
Let's see:
- anything < 115 will give you a value > 65535
- anything between 115 and about 3000, you could use 60015/X*125
- anything above 3000, you could use 60015/(X/125)
Not perfect but it'll get you close to the actual value.
SD
--
/===================================================================\
| Steve DeGroof (http://degroof.home.mindspring.com/) |
\===================================================================/
Y = Y - dig 0
I think it will work
TC
7501876 equals 4*31*60499
Try 60499 / X * 31 * 4 = Y
Greetings peter
>Can someone please help me do simple math problem on a bs2?
>
>7501876 / X = Y
>
>" X " is a word size from 0 to 65535
>
>I do not need a decimal point
>
>I don't want to get a math coprocessor from AWC since I will only be
>using one other problem.
>..
>I found out the min value for X is 750.
Hi again TC,
' Y=7501876/X approx for 65536>X>256:
J=ncd X - 8
Y=65535/X*256+(65535//X<<(8-J)/(X>>J))*/114
-- Tracy
>Tracy that dose not work. If you put in 1000 for X into the stamp you
>get 7450 for Y, I should get 7501.
>
>>Anthony Conti wrote (Stamps):
>> >Can someone please help me do simple math problem on a bs2?
>> >
>> >7501876 / X = Y
>> >
>> >" X " is a word size from 0 to 65535
>> >
>> >I do not need a decimal point
>> >
>> >I don't want to get a math coprocessor from AWC since I will only be
>> >using one other problem.
>> >..
>> >I found out the min value for X is 750.
>>
>>Tracy Allen wrote:
>> Hi again TC,
>>
>> ' Y=7501876/X approx for 65536>X>256:
>> J=ncd X - 8
>> Y=65535/X*256+(65535//X<<(8-J)/(X>>J))*/114
TC,
Actually, if you put in 1000 for X into the stamp you get 7470 (not
7450) for Y. That is less than 0,5% error.
Moreover, we can do better, using ** instead of */ for the normalization:
' Y=7501876/X approx for 65536>X>256:
X var word
Y var word
J var nib
for X=500 to 65500 step 500
J=ncd X - 8
Y=65535/X*256+(65535//X<<(8-J)/(X>>J))**29304
debug cr,dec X,tab,dec Y
next
Representative values:
X BS2 Y true Y=7501876/X
500 15003 15003.75
1000 7501 7501.86
1500 5001 5001.25
5000 1500 1500.38
8000 937 937.73
12000 625 625.16
40000 187 187.55
65000 115 115.41
-- regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com/BS2math2.htm <--- explanation of how it works
mailto:tracy@e...