Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

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

1 Answer 1

up vote 7 down vote accepted

From FromDigits>>Details:

Blockquote

For example:

N@FromDigits[RealDigits[123.55555]]
(* 123.556 *) 
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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