Go Down

Topic: Convert bitmath into regular math? (Read 3533 times) previous topic - next topic


34 << 3
34 * 23

IF constants are used then the compiler turns either one into 272

IF the values are in variables that may change

A << B is very few cycles, the majority just to put A and B into registers and 1 cycle to shift

A * BC is many cycles

DKL65, you will be far better off just learning bit math than twisting your brain trying to make a few cheap calculator functions do the job.

The Windows calculator can be put into Scientific mode under View, you get many new buttons. There are other free calculators available. For Linux the term more and better comes to mind.

Back in the 80's I had at least 2 "programmer's" hand calculators and one that was a watch.

Print yourself a cheat sheet to refer to. After enough glances/look-ups (which okay may take more than a few weeks if you use it rarely) you won't need it any more.

You can do hex bits with 4 fingers, which are on the table are 1's and which are lifted are zeros. Count 0 to 15 on 4 fingers alone, 0 to 255 with two hands. Not bad when so many people need to take their shoes off to count past 10.
Nick Gammon on multitasking Arduinos:
1) http://gammon.com.au/blink
2) http://gammon.com.au/serial
3) http://gammon.com.au/interrupts


There is a "programmer calculator" on Windows 7 that calculates bitshifts, logic gates, and even convert different types of intergers. I use it all the time. I just asked the question out of curiousity.

Quote from: AWOL
Just because your calculator doesn't include all arithmetic operation doesn't mean modulo operations are not members of the set of arithmetic operations.

I didn't say modulo wasn't a legit arithmetic operation (it's actually a useful one); I just said that it wasn't on a standard calculator. When I want to calculate bitmath, I use my brain, or Window 7's Programmer Calculator. I wonder if there are real programmer calculators that people sell.


Jun 11, 2012, 10:10 pm Last Edit: Jun 11, 2012, 10:13 pm by AWOL Reason: 1
I wonder if there are real programmer calculators that people sell.

I've got a 27 year old Casino fx-570 you can buy.
Still works.
Like this
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.


real programmers calculators

Most scientific calculators support binary/octal/hex math

currently - realcalc scientific calculator on my android [12 digits in hex mode] - payed version => add your own conversion functions and constants
supports and or xor not nand nor xnor +-*/ sqrt power

before a TANDY EC4014  - 10 digits display + solar was the trigger (still in use)
before a Casio fx-785P - programmable in some basic dialect and it has an IO port (still to be investigated :)
before another Casio ???
before a slide ruler - http://en.wikipedia.org/wiki/Slide_rule - (still have one, not in use)
before a pen and paper (still in use)
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Go Up