Commits

arkdro committed 2ebc4ae

fix index moving in short_decimal

  • Participants
  • Parent commits 4e8b1d6

Comments (0)

Files changed (1)

File ocaml/src/odec_port.ml

 (* remove trailing zeroes from mantissa, reduce exponent accordingly *)
 let short_decimal mant_str mant_len exp =
   let rec f str idx lexp =
-    if str.[idx] = '0' then
+    if idx > 0 && str.[idx] = '0' then
       f str (idx-1) (lexp+1)
     else
       idx, lexp