I'm am mixing some PWM signals and storing them as global variables (about 50 variables)
to be used in different modules.
I can store them as integers, but would like to do some math operations with variables
that are singles (probably 30 math operations).
Would it be faster to store the PWM signals as singles, or convert from integers to
singles then back to integers when I do the math operations?
Thanks,
Joe

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
> Would it be faster to store the PWM signals as singles, or convert
from integers to singles then back to integers when I do the math...
Three issues: speed, space and range/resolution:
- obviously, not converting is faster than converting.
- a single is stored as four bytes, an integer as two, so integers
take half the space.
- an integer holds no fraction so you will lose the fraction portion
of each math cycle if you convert the single to an integer, and if the
integer exceeds 16 bits, you've lost that, too.
I would opt for storing your vars as singles.
Tom

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )