Task

Express a number in decimal as a fixed-length string with leading zeros.



For example, the number   7.125   could be expressed as   00007.125.




declare
  fun {PrintFloat X Prec}
     {Property.put 'print.floatPrecision' Prec}
     S = {Float.toString X}
  in
     {Append
      for I in 1..Prec-{Length S}+1 collect:C do {C &0} end
      S}
  end
in 
  {System.showInfo {PrintFloat 7.125 8}}