Skip to main content

Questions tagged [arithmetic]

-4 votes
1 answer
196 views

floating point representations## exponent == 7 bits ,mantissa == 8 bits 2044    = 0 1001001 11111111 2045.5 = 0 1001001 11111111 why is this happening?? what is the error? Is anything wrong with the ...
Senu Nawamina's user avatar
8 votes
7 answers
10k views

As I got to know there are 256 possible combinations to get for 1 byte. If I understand it correctly, it should mean that you can display any number out of numbers 0-255 and this very number would use ...
treesarecool's user avatar
4 votes
1 answer
5k views

I am working in a system which only supports 32bit integers, in order to have a 64bit (unsigned) integer I decided to simply use two 32bit integers with one being the upper 32 bits (hi), and the other ...
Prime's user avatar
  • 143
1 vote
7 answers
782 views

If you have two positive numbers that can be represented exactly by the finite arithmetic of your computer, that is, two machine numbers, if you perform their sum or subtraction with perfect ...
elcocodrilotito's user avatar
-2 votes
2 answers
5k views

If you run the statement: System .out.println( (Integer.MIN_VALUE)-(Integer .MAX_VALUE )); In java it returns 1 as the answer. Is this because Java just considers those values as 32bit integers ...
isuru-buddhika's user avatar
2 votes
2 answers
220 views

Let's say I want to write a function to compute factorials of nonnegative integers. I could write something like this: fact :: Num a => Int -> a fact n = fromInteger(product [1..n]) (Let's not ...
Daniel McLaury's user avatar
-1 votes
2 answers
167 views

What algorithm can I use to describe a specified gradient (N/M) approximately as the sum of a set of rational fractions { (n1/m1) + (n2/m2) … } ? Design constraints: The algorithm takes as input (N, ...
bignose's user avatar
  • 198
0 votes
1 answer
646 views

I know I am reinventing the wheel. But I'm really interested in implementing arbitrary precision numbers (integers, rationals, complex, etc) in C or C++ and their algorithms. Please be patient. My ...
Hungry Blue Dev's user avatar
2 votes
5 answers
500 views

I'm trying to calculate the sum of 2 bits using basic binary arithmetic and currently, I'm doing this: function Add(bool a, bool b, bool carry) { return { Result: a ^ b ^ carry, ...
DumbButterly's user avatar
2 votes
2 answers
5k views

Intel 8085: In my textbook it is said: "Carry Flag - this flag is the carry out from the MSB of the A-register. CY is set after an ADD instruction if carry out was generated from the A-register." I ...
Lucenzo97's user avatar
  • 293
3 votes
1 answer
4k views

Everything discussed here will refer to Intel 8085 (8-bit architecture). When using two's complement number "conversion" : 1.) If we take SBI 0F (subtraction) for example; immediate value 0F(hex) or ...
Lucenzo97's user avatar
  • 293
-1 votes
1 answer
118 views

Intel 8085: I'm having big troubles understanding addition or subtraction with more than 16-bit numbers in Intel 8085: 1.) If I execute ADC M instruction then this should happen: (A)<--(A)+((H)(L))...
Lucenzo97's user avatar
  • 293
4 votes
4 answers
3k views

The basic arithmetic a computer chip can do only works on numbers(integers or floating point) of a fixed size. There are many algorithms that could be extended to work on numbers of arbitrary size (...
Qqwy's user avatar
  • 4,947
-1 votes
1 answer
99 views

I wrote a supersuccessful answer to a question on an SE site that got (at least) 21 upvotes in a 24-hour period. In theory, I should have gotten 210 rep points, but there is a daily reputation limit ...
Tom Au's user avatar
  • 893
0 votes
1 answer
468 views

It is not unlikely that what I want to do is not possible, but it doesn't hurt to ask. Imagine a set of lists, each containing positive integers (in my case, a list always consists of four integers, ...
ceaaj's user avatar
  • 3

15 30 50 per page