Sfoglia il codice sorgente

[java/cs] Fixed Float representation bugs on both C# and Java. Fixed Issue #877

Caue Waneck 13 anni fa
parent
commit
f7b92e13f7
2 ha cambiato i file con 3 aggiunte e 0 eliminazioni
  1. 1 0
      gencs.ml
  2. 2 0
      genjava.ml

+ 1 - 0
gencs.ml

@@ -705,6 +705,7 @@ let configure gen =
               )
             | TFloat s -> 
               write w s;
+              (if String.get s (String.length s - 1) = '.' then write w "0");
               (match real_type e.etype with
                 | TType( { t_path = ([], "Single") }, [] ) -> write w "f"
                 | _ -> ()

+ 2 - 0
genjava.ml

@@ -866,6 +866,8 @@ let configure gen =
               )
             | TFloat s -> 
               write w s;
+              (* fix for Int notation, which only fit in a Float *)
+              (if not (String.contains s '.' || String.contains s 'e' || String.contains s 'E') then write w ".0");
               (match real_type e.etype with
                 | TType( { t_path = ([], "Single") }, [] ) -> write w "f"
                 | _ -> ()