Pages: 1 [2]   Go Down
Author Topic: Convert bitmath into regular math?  (Read 1279 times)
0 Members and 1 Guest are viewing this topic.
Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4836
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

34 << 3
vs
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.
Logged

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

Offline Offline
Sr. Member
****
Karma: 1
Posts: 462
I am a amateur.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 310
Posts: 26626
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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
« Last Edit: June 11, 2012, 03:13:39 pm by AWOL » Logged

"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.

Global Moderator
Netherlands
Offline Offline
Shannon Member
*****
Karma: 227
Posts: 14024
In theory there is no difference between theory and practice, however in practice there are many...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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 smiley
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)
Logged

Rob Tillaart

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

Pages: 1 [2]   Go Up
Jump to: