??? 03/13/08 00:58 Read: times |
#152195 - Responding to: ???'s previous message |
Chris Bertrand said:
hmm.....can 8 bits be over 255......I think NOT!! I should have caught that right away......I'm a dummy......LOL I was going to ask about your integer sizes, but since you said you were dealing with values of "3" and a total value of 48, I assumed that was not the case. You must not have really been dealing with 16 values of "3", then, right? ;) Ok, I tried to use the SR as a float, but I can't get it back to a byte form.
I tried a cast float on SR as each S var is a byte input that needs averaging. (float)SR = ((S1 + S2)/0x02); But that isn't working as expect either. You really need to post your whole code next time, including variable type definitions. But the above, if anything, should be: SR = (long) (( (long) S1 + (long) S2) / 2); There's no need to cast SR at the end because it will be assigned the type of SR anyway. You also probably don't need the (long) after the equals sign, but when in doubt, cast it out. Oh, I cast them as long rather than float. Unless you really have a reason to use float, I'd avoid it. Regards, Craig Steiner |
Topic | Author | Date |
Math not functioning with proper headers? | 01/01/70 00:00 | |
horrible method | 01/01/70 00:00 | |
Lots of issues | 01/01/70 00:00 | |
Code Op at level 8 | 01/01/70 00:00 | |
Try multiple steps | 01/01/70 00:00 | |
ah hah moment arrived......omg | 01/01/70 00:00 | |
01/01/70 00:00 | ||
Here is the block which now works 100% | 01/01/70 00:00 | |
Operation question in C | 01/01/70 00:00 | |
Because | 01/01/70 00:00 | |
Simplify | 01/01/70 00:00 | |
what's the point ? | 01/01/70 00:00 | |
What's the point | 01/01/70 00:00 | |
simpler, but | 01/01/70 00:00 | |
Not right | 01/01/70 00:00 | |
use shift right instead of divide | 01/01/70 00:00 | |
If you're lucky... | 01/01/70 00:00 | |
Use a rount trip buffer | 01/01/70 00:00 | |
Bad names | 01/01/70 00:00 | |
System use names ???? | 01/01/70 00:00 | |
Common naming convention ? | 01/01/70 00:00 | |
ISO/IEC 9899:1990... | 01/01/70 00:00 | |
Comments | 01/01/70 00:00 | |
same effect as a "circular array" | 01/01/70 00:00 | |
think I like this the best | 01/01/70 00:00 | |
Use a loop with deglitching and averaging![]() | 01/01/70 00:00 |