Questions tagged [computer-arithmetic]

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

Filter by
Sorted by
Tagged with
2
votes
2answers
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 = ...
0
votes
1answer
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 ...
0
votes
1answer
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 ...
2
votes
2answers
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: \begin{equation} \lnot(p\lor(\lnot p\land q))=\lnot p\land\lnot q \...
0
votes
0answers
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 ...
0
votes
1answer
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, ...
1
vote
1answer
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 ...
1
vote
1answer
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+...
2
votes
1answer
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: ...
1
vote
2answers
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 ...
1
vote
1answer
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 ...
0
votes
0answers
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 ...
0
votes
1answer
17 views

Computer arithmetic - size of error.

I'm actually reading What Every Computer Scientist Should Know About Floating-Points Arithmetics and I have a little problem with understaing one thing. Here's a quote: Write $(b \otimes b) \...
1
vote
0answers
409 views

What is the easiest to use software to draw Latex embeddable contour diagrams? [closed]

I need to draw a few diagrams of integration contours for complex integrals. What is the easiest to use software on which I can achieve this? Particular things I need, draw a zig-zag line to denote ...
4
votes
1answer
108 views

Mathematics of two's complement

I am trying to understand the underlying mathematics of two's complement. Googling the topic gives me a lot of articles on how to invert the digits and add one, and why computers use this system ...
0
votes
1answer
45 views

standard notation to handle representation of a real number on a computer

Is there a standard notation to handle the effective representation of some real number $x$ on a finite machine ? I have in mind some kind of braces, but I am not sure it is appropriate. Let me try to ...
6
votes
1answer
1k views

Prerequisite reading for Concrete Mathematics? [closed]

I'm a freshman computer science major who has just started reading Concrete Mathematics, mathematics for computer science. Is there any prerequisite reading or learning I should do before embarking on ...
1
vote
1answer
109 views

Bitwise ops - The relationship between $a$, $b$, $a \wedge b$, $a \vee b$ and $a \oplus b$

In computer programming, the term bitwise operation is used to denote the use of boolean operators (and $\wedge$, or $\vee$, exclusive or $\oplus$) on corresponding bits of two numbers. Bits, in this ...
0
votes
1answer
379 views

How can I get the average of two numbers represented as bytes?

I'm dealing with numbers, each one represented by two bytes (a short value, in the programming sense). I want to compute the average of these two numbers, and get ...
2
votes
1answer
147 views

Numerical error analysis

I stand before the following task and I do not know how to solve it. The input parameter $$a=10^6, b=10^6 + 10^{-2}$$ will be round internally to $$a^*, b^*$$ with $$a=a^*(1 + \epsilon_1)$$ $$b=b^*(...
0
votes
2answers
48 views

Numerical presentation of a term

Hello I have the following task: Let $$ y = \sin(x + \delta) -\ sin (x)$$ and $$\delta > 0$$ is very small. Write down a mathematical equivalent representation of this term which is stable. I'm ...
2
votes
1answer
128 views

Determine sign of sum of square roots

Problem Given positive square-free integers $r_i$ and non-zero integers $a_i$, is there an algorithm for determining the sign of $\sum_{i=1}^n a_i\sqrt{r_i}$ without calculating approximations for ...
0
votes
1answer
56 views

Making a function for unbounded variables that is bounded

Ok here is what I need I want to build a formula to implement into a ranking system on my website its been like 20 years since I was in school so help me out I need like 6 variables that equal at ...
1
vote
2answers
4k views

Most negative number (in octal and hex) of a 16-bit one's complement system?

In a 16-bit one's complement system, how do you represent the most negative number in octal and hex? One's complement: http://en.wikipedia.org/wiki/Ones'_complement The most negative 16-bit number ...
0
votes
1answer
99 views

Understand a Maple output

My goal is to solve for $L$ in $\frac{(2k)!}{2^kk!}{2nL - L^2 \choose 2k} = \sum_{s=0}^k{L \choose s}{n-L \choose s}s!\frac{(2k-2s)!}{2^{k-s}(k-s)!)}{L-s \choose 2k-2s}.$ I tried to use the solve ...
1
vote
1answer
459 views

Complexity of computing $N!$

Question: Complexity of computing $N!$, considering that each multiplication cost about $O(\log^2{n})$. Attempt: There's $n-1$ multiplication. Each multiplication leads to a bigger number, thus $n-1$ ...
2
votes
1answer
159 views

IEEE754 32-bit single precision format

I have a question like this: Show how the number $-12.75$D is stored in the computer's storage using IEEE754 32-bit single precision format. You are required to show your conversion steps clearly. ...
3
votes
3answers
17k views

Differences between signed and unsigned decimal values

What are examples of signed and unsigned decimal values? What are the differences between them?
0
votes
3answers
20k views

Arithmetic Overflow and Underflowing

I am a bit unclear about underflowing in terms of binary representation. Let's say that an unsigned 8-bit variable gets overflown from the addition of $150+150$. A signed 8-bit variable gets ...
1
vote
1answer
800 views

Logic Circuits And Equations Issue - Multiply Binary Number By 3

I am trying to build a logic circuit that multiplies any 4 digit binary number by 3. I know that if I multiply/divide number by 2 it moves left/right the digits, but what I'm doing with multiply by ...