Friday Night Maths

Man of Honour
OP
Joined
13 Nov 2009
Posts
11,596
Location
Northampton
Soldato
Joined
27 Dec 2005
Posts
17,288
Location
Bristol
((A*256)+B)/4 = 748
(A*256)+B = 2992
A*256 = 2992-B
A = (2992-B)/256
B = 2992-(A*256)

If B = 1 then A = 11.68359375

My maths is ***** but do you not need to know at least one of A or B to find the other?
 
Caporegime
Joined
29 Jan 2008
Posts
58,912
My brain is toast.

I have an equation I need to reverse to Solve both A & B, any care to school me?

((A*256)+B)/4 = 748

You might want to explain what you're trying to do here OP - give some context or further details etc...

You've got two unknown variables so currently, without any other conditions, they there are infinite values they can take.. for example when B is 0 A is 11.6875 and when A is zero B is 2992.

If you want to illustrate this then, with A on the x axis and B on the y axis, if you were to draw a line passing through (0, 2992) and (11.6875, 0) any point along that line gives you a value for A and B
 
Caporegime
Joined
29 Jan 2008
Posts
58,912
My maths is ***** but do you not need to know at least one of A or B to find the other?

If you've got another equation involving A and B then you're good. Think back to simultaneous equations at school - if you've got two equations with the two unknowns then you can substitute in and solve for one of the variables etc... If you plot both lines you're basically finding the intercept.
 
Man of Honour
OP
Joined
13 Nov 2009
Posts
11,596
Location
Northampton
I think I may have solved it from a mathematically concept. Just trying to confirm try the maths on a few inputs ...Not quite for the application

You might want to explain what you're trying to do here OP - give some context or further details etc...

You've got two unknown variables so currently, without any other conditions, they there are infinite values they can take.. for example when B is 0 A is 11.6875 and when A is zero B is 2992.

If you want to illustrate this then, with A on the x axis and B on the y axis, if you were to draw a line passing through (0, 2992) and (11.6875, 0) any point along that line gives you a value for A and B

Sending data over a serial like protocol that deals with hexadecimal. The receiving device performs the formula in the OP to convert the data it receives to a real value.

All of the values must be integers (non-decimal)
 
Associate
Joined
23 Dec 2008
Posts
1,040
((A*256)+B)/4 = 748

if A=11 (can't be over 11 round number otherwise it is over 748*4 so can't add B) based on the earlier 11.68359375

((11*256)+B)/4 = 748

2816+B = 2992

b = 2992 - 2816 = 176

b=176, a=11 seems to work .
 
Caporegime
Joined
18 Oct 2002
Posts
25,289
Location
Lake District
B is 176 and A is 11

I did 748 * 4

Then 2992 divided by 256 which was 11.something

So I then assumed that A was 11 and then took the difference from 2992 to give me B.
 
Back
Top Bottom