d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Random Question
Add Reply New Topic New Poll
Member
Posts: 23,862
Joined: Aug 16 2006
Gold: 20.00
Jul 13 2012 03:16pm
Was thinking about stuff and got too deep in thought the other day.


Random question appeared:


How does a math function, a simple one like addition for example, look like as a bare bones kind of thing.

Like if you bring up the calculator program on windows or if you use 99% of programming languages, you can just use '+' syntax and it does the work for you. I am curious as to what the code behind the '+' looks like.

Maybe it is really simple. I dunno.

At some point there has to be something that defines addition right? Or else no one would be able to use it....
Banned
Posts: 2,525
Joined: Jan 2 2012
Gold: 0.01
Warn: 10%
Jul 13 2012 03:20pm
It's "implemented" on processor level, it's just operation it does on two values.
Member
Posts: 61,418
Joined: Nov 21 2006
Gold: Locked
Jul 13 2012 05:03pm
all base arithmetical functions are done using bitwise operators, i think (you can google for examples of them)
correct me if i'm wrong
Member
Posts: 4,605
Joined: Sep 15 2011
Gold: 9,464.00
Jul 13 2012 05:19pm
software level: ADD - http://en.wikipedia.org/wiki/Assembly_language

hardware level: http://en.wikipedia.org/wiki/Adder_(electronics)

This post was edited by irimi on Jul 13 2012 05:21pm
Member
Posts: 32,925
Joined: Jul 23 2006
Gold: 3,804.50
Jul 13 2012 06:43pm
it's like a microwave. it just works.

there were only three classes i took in college that i found useful, and two of them were computer engineering courses. if you have any interest in how computers work or if you want to pursue CS as a hobby/professionally, i highly recommend taking a few CE courses.
Go Back To Programming & Development Topic List
Add Reply New Topic New Poll