Click here to Skip to main content
14,449,862 members
Rate this:
Please Sign up or sign in to vote.
See more:
I need to multiply two partially known numbers where each factor is at 15 decimal places and no less. I'm hoping there is a program that will figure out through permutations or combinations what the zero's in those partially known numbers must be in order to match a 29 decimal place predetermined answer I provide. If this is possible, could a program be written so it can perform this function for 66 rows of completely different 29 decimal place predetermined answers and show what each associated factors are at 15 decimal places? The reason for the specific decimal places both in the factors and the product is to ensure complete accuracy which is crucial for the type of modelling I'm doing.

Example:

My Input---> 0.199848000000000 X 4.974380000000000 = ‭0.99412293432154732337566954206

Program Output --> 0.199848442087413 X 4.974384208042620 = ‭0.99412293432154732337566954206

What I have tried:

Haven't tried anything because I'm not sure if this can actually be done. Plus, I have to admit my ignorance and confess I do not know anything about programming, yet I really need this one solved for me. Forgive me for going against the policy here of "not having people do your work for you", but if this works the way I hope it does, it will revolutionize the type of modelling I'm performing. I will be happy to reference anyone who helps with this in my paper to the Transactions of the AMS.
Posted
Updated 5 days ago
v6
Rate this:
Please Sign up or sign in to vote.

Solution 3

Quote:
I'm not sure if this can actually be done.

It can be done.
Many approach are possible.
My approach would be to scale the numbers until they are all integers, then use big integers. Because integer arithmetic is faster than floating point and big integer are very common as of today.
0.199848000000000 X 4.974380000000000 = ‭0.99412293432154732337566954206
 1.99848000000000 X 49.74380000000000 = ‭ 99.412293432154732337566954206
 19.9848000000000 X 497.4380000000000 = ‭ 9941.2293432154732337566954206
 199.848000000000 X 4974.380000000000 = ‭ 994122.93432154732337566954206
 1998.48000000000 X 49743.80000000000 = ‭ 99412293.432154732337566954206
 199848.000000000 X 497438.0000000000 = ‭ 9941229343.2154732337566954206
...
 1998480000000000 X 4974380000000000 = ‭ 994122934321547323375669542060

then solve P and Q in
(1998480000000000 + P) X (4974380000000000 + Q) = ‭ 994122934321547323375669542060
I would try to factorize 994122934321547323375669542060
994122934321547323375669542060 = 2^2 × 3^4 × 5 × 7^3 × 103 × 63577 × 69203 × 3947923974637
Quote:
I have to admit my ignorance and confess I do not know anything about programming, yet I really need this one solved for me.

You have been given general guidelines because it is what can be done in the scope of this forum.
Writing efficient code for this problem is a real job because one need to do a real study to avoid pitfalls, and it takes time.
   
v5
Rate this:
Please Sign up or sign in to vote.

Solution 1

Yes, a program could be written to provide the answer, but it would need some specialised arithmetic. If your language of choice includes a Decimal type then you may be able to use that. If not then you would need to create your own, which is not as difficult as it sounds. Don't try and use float or double types as they tend to lose precision quite quickly.
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

You probably want to look at GNU MPFR Multi Precision Floating point with correct rounding [^], or another library that does arbitrary precision math.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100