Sources of inaccuracy for double floating point numbers [closed] - floating-accuracy

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Besides the impossibility of representing decimal numbers like 0.1 in a binary base, and, the inaccuracy by design of denormalized floats; is there any other source of inaccuracy when working with double floating-point numbers?

Just one strange example of numerical inaccuracy of floats is as follows:
If one converts 9999999.4999999999 to a float and back to a double, the result is given as 10000000, even though that value is obviously closer to 9999999, and even though 9999999.499999999 correctly rounds to 9999999.
I understand that this is a very specific example, but more detailed (and scientific reasoning!) can be found here:
https://docs.oracle.com/cd/E19957-01/806-3568/ncg_goldberg.html

Related

Program that counts all the possible PARTS of a number [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
Alright, so one of my friends challenged me to get this done, but I just can't get very far....
What he asked me to do is to make a program that shows and counts ALL the possible parts of an entered number.
Example for 5:
1+1+1+1+1
2+1+1+1
3+1+1
4+1
5
3+2
2+2+1
I would like the program to be written in either C++ or some pseudocode, I wouldn't mind for either.
Anticipated thanks to you all!
Edit: Not duplicate. I requested a solution in c++; and the other one is in Python. Also, my question asks for ALL possible parts that added return the initial number.
For non zero partitions ( imagine boolean separators in array of 1)
2 ** (n-1)
This list would include both 2 + 3 and 3 + 2.
If you allow 0 then infinite.

multiplication R without float [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
is there a way to do the multiplication with a float in a serie sof two multiplications with integers. I would need to write a function which accepts as input values such as
3.4556546e-8
1.3
0.134435
Instead of doing 100*0.134435 it would do
100/1000000
and then multiply with
134435
the function should as output just give 1000000 and 134435 - it is just needed because i need to work with some very large numbers in big integers and mutipliying with anythign except for intgers doent work
Apparently you want to do arbitrary precision arithmetics. You don't need to reinvent the wheel.
library(gmp)
x <- as.bigq(0.134435)
100 * x
#Big Rational ('bigq') :
# [1] 121088283181110525/9007199254740992

Maximum factorial that is formed by three digits? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Number of digits that are present in the maximum number that is formed using three digits?
Maximum factorial that is formed by three digits?
This was a question asked on a site.
I am not able to understand is there any thing tricky i am not getting?
i have tried 3 and 720 but it is incorrect
The maximum factorial which can be formed using 3 digits is 999!.
The answer can be easily obtained from wolfram alpha.
Number of digits in 999!.
999!=Answer

Working out Normalised Floating Points [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
From the following options, expressed in hexadecimal notation, select the answer which is a normalised floating point number: Pick 1 answer
I know the answer is one but I forgot how to work out this question, can anyone assist?
1.80800000
2.ff800000
3.80080000
4.FFF8FFFF
Normalized values are numbers where the exponent part is between 0x01 and 0xFE. Other exponents have special meanings. The first option has an exponent part of 0x01, the second and fourth options have 0xFF and the third option has 0x00.

How do you calculate integers overflow? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I try to calculate, based on given parameters, integer overflow.
for example, if I have an integer than is <= 200, but when I insert it to an unsigned int, it will be > 200. What is the actual arithmetic process for that?
Operations on fixed size integers are usually made modulo 2m, where m is the number of bits (nowadays usually 32 or 64).
This means that a multiple of 2m is added or subtracted from the result to keep it in the range for the type, be it unsigned (0, 2m-1) or signed (-2m-1, 2m-1-1).
You might be interested in the Mathematical foundations of computer integers.

Resources