Forráskód Böngészése

fix float printing in hlc

Nicolas Cannasse 9 éve
szülő
commit
c312886182
2 módosított fájl, 2 hozzáadás és 2 törlés
  1. 1 1
      genhl.ml
  2. 1 1
      std/hl/_std/Math.hx

+ 1 - 1
genhl.ml

@@ -6291,7 +6291,7 @@ let write_c version file (code:code) =
 				else
 					sexpr "%s = %ld" (reg r) code.ints.(idx)
 			| OFloat (r,idx) ->
-				sexpr "%s = %f" (reg r) code.floats.(idx)
+				sexpr "%s = %.19g" (reg r) code.floats.(idx)
 			| OBool (r,b) ->
 				sexpr "%s = %s" (reg r) (if b then "true" else "false")
 			| OBytes (r,idx) ->

+ 1 - 1
std/hl/_std/Math.hx

@@ -36,7 +36,7 @@ class Math {
 	public static function random():Float return 0.15; // I rolled a D20
 
 	static function __init__() : Void {
-		PI = 3.14159265359;
+		PI = 3.1415926535897932384626433832795;
 		NaN = 0. / 0.;
 		POSITIVE_INFINITY = 1. / 0.;
 		NEGATIVE_INFINITY = -1. / 0.;