4
$\begingroup$

One can extract an Integer's digits using IntegerDigits and reassemble them into the Integer using FromDigits. Is there a function that reassembles the output of RealDigits into the Real?

$\endgroup$
4
  • 3
    $\begingroup$ N@FromDigits[RealDigits[123.55555]]? $\endgroup$
    – kglr
    Jul 5, 2014 at 4:29
  • 1
    $\begingroup$ @kguler: didn't realize fromdigits accounted for offset.. right in the details in the doc... +1 $\endgroup$
    – ciao
    Jul 5, 2014 at 4:31
  • $\begingroup$ @kguler Post an answer? It seems it's worth spelling out because people are not always aware that FromDigit already does this. $\endgroup$
    – Szabolcs
    Jul 5, 2014 at 4:33
  • $\begingroup$ @Szabolcs & rasher thank you both. Posted an answer. $\endgroup$
    – kglr
    Jul 5, 2014 at 8:07

1 Answer 1

8
$\begingroup$

From FromDigits>>Details:

Blockquote

For example:

N@FromDigits[RealDigits[123.55555]]
(* 123.556 *) 
$\endgroup$

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.