`` Feet and inches - http://algos.scriptol.com `` Converts inches to feet and inches: `` Input: one or several values `` Output: one or several pair of values include extern real floor(real) extern real fmod(real, real) extern real modf(real, alias real) constant real BASE = 64.0 real fround(real n, natural d) return floor(n * pow(10.0, d) + 0.5) / pow(10.0, d) real, real, real, real, real inchesCvt(real input) real feet real inches real dec_inches real num_inches real den_inches feet = floor(input / 12.0) inches = fmod(input, 12.0) num_inches = modf(inches, alias dec_inches) * BASE num_inches = fround(num_inches, 0) if num_inches <> 0.0 den_inches = BASE while fmod(num_inches, 2.0) <> 0.0 den_inches / 2.0 num_inches / 2.0 /while /if return feet, inches, dec_inches, num_inches, den_inches int main(int argc, array argv) real arg, feet, inches, dec, num, den, dummy if argc < 2 print "Inches" print "Usage: inches size [size] ..." exit(0) /if for int i in 1 -- argc text t = argv[i].toText() arg = t.toReal() feet, inches, dec, num, den = inchesCvt(arg) echo arg, " Inches = ", int(feet), "' ", int(dec), "\"" if num <> 0.0 echo " - ", int(num), " / ", int(den) if modf(num, alias dummy) echo " (approx.)" /if print /for return 0 main($argc, $argv)