0
$\begingroup$

Is there a way to convert a number like 2.5326384172870370602159219766864657866396178797`20.124930050805514*^-12 to a high precision integer?

Mathematica gives me only 20 digits with RealDigits[] when I do this but there are clearly more digits available.

Edit: I should have also stated that I need to do the conversion in Mathematica, not manually.

$\endgroup$
6
  • $\begingroup$ For clarity, can you actually put Mathematica code in the body of your question? As it stands, I think I'm misunderstanding your question, because I can't evaluate that numeric expression as is. $\endgroup$
    – lericr
    Sep 13, 2023 at 3:22
  • $\begingroup$ It might also help to explain how you got that number. It looks like it's specifying a precision of 20 digits, and so I'm not sure why you expect any certainty in digits beyond 20. $\endgroup$
    – lericr
    Sep 13, 2023 at 3:26
  • $\begingroup$ So, "integer" was just a mistake, right? That number obviously can't be an integer. $\endgroup$
    – lericr
    Sep 13, 2023 at 16:03
  • $\begingroup$ Maybe what you want is SetPrecision, but given that your original number has a precision of about 20 digits, the digits beyond that after you use SetPrecision won't be reliable. $\endgroup$
    – lericr
    Sep 13, 2023 at 16:05
  • $\begingroup$ Can you maybe just include what result you actually want to see? $\endgroup$
    – lericr
    Sep 13, 2023 at 16:08

2 Answers 2

2
$\begingroup$

Look at the precision of your numbe:r

num=2.5326384172870370602159219766864657866396178797`20.124930050805514*^-\
12;
Precision[num]

20.1249

By specifying "`20.124930050805514" you decrease the precision explicitly. Delete this:

num = 2.5326384172870370602159219766864657866396178797*^-12;
Precision[num]

46.4036

And RealDigits will not deliver what you want:

RealDigits[num]

{2, 5, 3, 2, 6, 3, 8, 4, 1, 7, 2, 8, 7, 0, 3, 7, 0, 6, 0, 2, 1, 5, 9, 
  2, 1, 9, 7, 6, 6, 8, 6, 4, 6, 5, 7, 8, 6, 6, 3, 9, 6, 1, 7, 8, 7, 9,
   7}, -11}
$\endgroup$
2
  • $\begingroup$ That's understood but is there anyway to delete it with a Mathematica command. I get the sense that one Mathematica sets the precision there's no way to change it. $\endgroup$ Sep 13, 2023 at 13:23
  • $\begingroup$ To delete the precision specification is best done with string manipulation . "SetPrecision" will change the precision. However, if you increase the precision, there will be some garbage in the unspecified digits. $\endgroup$ Sep 13, 2023 at 16:00
1
$\begingroup$

Yes, in Windows use Shift+Windows+S and copy your headline to clipboard. Paste it in Mathematica

bild=headline

Now you can recognize the number string

   TextRecognize[bild, Language -> "English"]

    Is there a way to convert a number like 
       2.53263841728703706021592197668646578663961 78797 20.124930050805514*4-\ 12 
    to an high precision integer?

Given that the string is interpreted as intended

     Rationalize[(2.5326384172870370602159219766864657866396178797`
     20.124930050805514)^- 12, 10^-100]

      1/307390781241935529806

or

Rationalize[(2.5326384172870370602159219766864657866396178797`20.124930050805514)
    ^- 12, 10^-100]

    7045236/490652289593
$\endgroup$
1
  • $\begingroup$ Unfortunately, In[58]:= N[ Rationalize[(2.5326384172870370602159219766864657866396178797`20.\ 124930050805514)^-12, 10^-100]] Out[58]= 0.0000143589 $\endgroup$ Sep 13, 2023 at 15:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.