So i want to be able to convert any decimal number into fraction. In both forms such as one without remainder like this: 3/5 or with remainder: 3 1/4
3/5
3 1/4
I came up with this for 16ths
function getfract(theNum){ var input=theNum.toString(); var whole = input.split(".")[0]; var rem = input.split(".")[1] * .1; return(whole + " " + Math.round(rem * 16) + "/16"); }