# Questions tagged [computer-arithmetic]

For questions concerning finite precision arithmetic in computers and other related concepts.

80 questions
Filter by
Sorted by
Tagged with
231 views

### How can I rearrange this logarithmic formula to be computer friendly?

I've had a look through the logarithmic identities on Wikipedia, but nothing fits the bill. Basically, I have a formula which shows how much more 'risky' one number is compared to another, where 0 = ...
157 views

### Implementing a (5,5;4) counter with FA and HA

I am trying to implement a (5,5;4)-counter using only FA's and HA's as building blocks. I tried using both Wallace and Dadda tree structures, but I was never able to end up with a 4-bit number as a ...
64 views

### Find original inputs x and ^y for a given product, possible or not? [closed]

387,381,625,547,900,583,936 is the product of this calculation 21 * 2^64. If I only have the product and the multiplier 2 (without the exponent) would it be possible to find the other inputs used to ...
61 views

### How do I prove that these are equal using laws of logic?

Prove that $\lnot(p\lor(\lnot p\land q)$ is equivalent to $\lnot p\land\lnot q$ I always end up at $\lnot p$, here's my solution: \lnot(p\lor(\lnot p\land q))=\lnot p\land\lnot q \...
140 views

### Rearrangement algorithm

I came across the following algorithm puzzle while interviewing for computer programmer job with a top internet giant. There are $n=4$ bags with each bag able to carry a maximum of $k=500$ Kilogram ...
226 views

### Find the equation of a non-linear relation given 2 points

So I ask my question, let me just begin by stating that I'm in grade 9, and have decided to start learning calculus to aid me in the development of an undisclosed project that I am working on. Now, ...
177 views

### How to encode a list of integers, how to find an arithmetical formula for a sequence?

I have the following list of integers : $$t={0, 15, 73, 27, 73, 105, 25, 65, 26, 8, 84, 72, 15, 73, 27, 73, 105, 25, 65}$$ And I want to find a function or (an expression) such that $f(k)$ is always ...
86 views

### Determining if the result of adding (subtracting) two binary numbers is correct as NBC and 2's

My task is to convert two numbers to binary, add them and determine if the result is correct as a NBC and 2's. Then I have to subtract B from A by converting by using 2's for calculating -B [that is A+...
445 views

### How would you reduce roundoff error in “mod” when implementing a periodic function?

I recently wrote How calculators do trigonometry where I wrote a simple program for computing $\sin(x)$. For completeness, I include a slightly modified version of the program here: ...
566 views

### Use Weak Mathematical Induction to show that in a full binary tree the number of leaves is one more than the number of internal nodes

Use Weak Mathematical Induction to show that in a full binary tree the number of leaves is one more than the number of internal nodes (i.e., $L = I + 1$). Induct on the number of leaves. What is the ...
43 views

### Mistake in generating random numbers - no irrational ones

Hi I just wondered if the probability densities have to be corrected when using them on a PC since the number representation is not at all continuous. So we cant simulate any irrational numbers and ...
34 views

### Proving correctness for code computing function.

I was solving an exercise from the book "Complexity, computability and languages" which asks: Write a program that computes $f(x)=1 \iff x$ is even, $f(x)=0\iff x$ is odd. I wrote the following ...