Print out a Fraction in textbook style - Printable Version +- HP Forums ( https://www.hpmuseum.org/forum)+-- Forum: HP Calculators (and very old HP Computers) ( /forum-3.html)+--- Forum: HP Prime ( /forum-5.html)+--- Thread: Print out a Fraction in textbook style ( /thread-10941.html) |

Print out a Fraction in textbook style - blevita - 06-19-2018 11:33 AM
Hello Im new to the HP Prime and im new to the Programming of this calculator. But im not new to programming at all. I have played around a bit and find the ability to do own stuff really nice. Unfortunatley i have not figured out, how to print nice looking fractions out on the terminal. Could somenone explain me how to write a fraction as an example: 2/7 with this style: 2 -- 7 Keep in mind, im talking about the PRINT, or any other, Output function for own apps. Thank you. RE: Print out a Fraction in textbook style - StephenG1CMZ - 06-19-2018 11:51 AM
The Prime terminal does not support pretty-printing. So if you want a fraction to appear on the terminal its PRINT(NUM+"/"+DEN) Or LF="\n" SEPRSIZE=MAX(DIM(STRING(NUM)),DIM(STRING(DEN)) SEPR= "-" repeated SEPRSIZE times (TBD) PRINT(NUM+LF+SEPR+LF+DEN) If it doesn't have to be on the terminal, you could try writing it as a Note, which allows more formatting. RE: Print out a Fraction in textbook style - blevita - 06-19-2018 12:03 PM
Thank you for your answer. The Background behind my question is, that i want to programm an quadratic equation solver. This solver should output x1, x2 the discriminant and the vertex of the function. For the vertex i would like to have the equation in the form of: (x+y)^2-z I would like to show the y part as a fraction and the z part also if possible. Therefore i think its not that easy to use your suggestion. The best way would be to just return the answer. But then i only can return one answer or some coma seperated values which doesnt look very good. RE: Print out a Fraction in textbook style - blevita - 06-19-2018 12:17 PM
Here is an example. |