Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.7K Views
|
4 Replies
|
0 Total Likes
View groups...
Share
Share this post:

How to display a repeating decimal as a fraction in cloud?

I can't seem to see how to show a repeating decimal as a fraction in a cloud notebook:

Example: 0.183...

Sorry if this is obvious, can't seem to see it.

4 Replies

Thanks for the help, I think I like the function better; it matches the solution in my text book.

Posted 4 years ago

Hi Christopher,

To construct a Rational from a repeating decimal

FromDigits[{{{1, 8, 3}}, 0}]
(* 61/333 *)
POSTED BY: Rohit Namjoshi

That's surprising; I was expecting something more along the lines of: Fraction[0.183...]

Posted 4 years ago

Well, you could do something like this, which is the way we would do it manually

fraction[f_, n_] := Round[f*10^n]/(10^n - 1)

fraction[0.183, 3]
(* 61/333 *)

fraction[0.183, 4]
(* 610/3333 *)

fraction[0.142857, 6]
(* 1/7 *)
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard