Skip to main content
10-Marble
November 4, 2025
Solved

convert from decimals to fractions

  • November 4, 2025
  • 3 replies
  • 672 views

Is there a function to convert from decimals to fractions?

Best answer by Werner_E

@pannus0 wrote:

Is there a function to convert from decimals to fractions?


Not ready-made. You would have to program your own.

In real Mathcad (legacy Mathcad, versions 15 and below) there was a formatting option which would display a number with fractions but Prime does not offer this facility.

3 replies

23-Emerald IV
November 4, 2025

Try the symbolic keyword confrac.

 

Success!
Luc

pannus010-MarbleAuthor
10-Marble
November 4, 2025

I tried it as you suggested and I get:

 

pannus0_1-1762281018387.png

 

23-Emerald IV
November 4, 2025

That's correct, it means 0 + 1/2.

Did you read the manual? Add ",fraction" to confrac and see what happens.

 

Success!
Luc

Werner_E25-Diamond IAnswer
25-Diamond I
November 4, 2025

@pannus0 wrote:

Is there a function to convert from decimals to fractions?


Not ready-made. You would have to program your own.

In real Mathcad (legacy Mathcad, versions 15 and below) there was a formatting option which would display a number with fractions but Prime does not offer this facility.

23-Emerald IV
November 4, 2025

In real mathcad we had (have !):

LucMeekes_0-1762281496349.png

and the functionality is available in Prime as well, according to the manual.

 

Luc

pannus010-MarbleAuthor
10-Marble
November 4, 2025

Something curious only happens with 0.25,0.25, but when they are numbers for example 0.375 this doesn't happen, any solution?

 

 

pannus0_0-1762282870965.png

 

 

25-Diamond I
November 4, 2025

Here is a quick hack. The display is all but nice, though.

Werner_E_1-1762285303760.png

It should(may) work up to 12 decimals. Using a higher value for N increases the chance for round off errors when using "gcd".

We could determine the power of 10 needed to multiply the number to get an integer using strings. We might convert the absolute value of the fractional part into a string, delete the leading zero and the decimal point (if present) and the length of the string would correspond to the exponent of the power of 10 needed. Nonetheless the main problem still is the ugly display of the result.

 

In case you are not looking for mixed fractions you may also use the similar "test2".

Werner_E_2-1762285412809.png

While the display format as an 1x3 or 1x2 matrix sure isn't clear an nice, we have at least numerical results which could be used for further calculations (whatever they may be).

Of course we could convert the result into a string which makes for a slightly nicer look but could be used for display only.

Werner_E_3-1762285844645.png

 

Best result in Prime I could achieve was with the symbolical evaluation of a simple program

Werner_E_4-1762285907582.png

 

But sure nothing compares with the simplicity of real Mathcad's formatting options:

Werner_E_0-1762356544099.png

 

Prime 11 sheet attached