www/js/global.js

changeset 258
943fbe0e9fd6
parent 256
4767a790d1f6
child 278
dc22dd5d77fd
--- a/www/js/global.js	Sat Feb 09 22:12:31 2019 +0100
+++ b/www/js/global.js	Sun Feb 10 16:14:48 2019 +0100
@@ -998,8 +998,14 @@
 		percCara = 0;
 	if ((WGratio > 0) && (TotTme > 0)) {
 		BD = WGratio;
-		BD = max(2, min(5.5, BD));
-		Temp = max(60, min(72, Temp));
+		if (BD < 2)
+			BD = 2;
+		if (BD > 5.5)
+			BD = 5.5;
+		if (Temp < 60)
+			Temp = 60;
+		if (Temp > 72)
+			Temp = 72;
 	} else {
 		BD = 3.5;
 		Temp = 67;
@@ -1009,9 +1015,9 @@
 		attenuation = 77;
 
 	var AttBeer = 0.00825 * attenuation + 0.00817 * BD - 0.00684 * Temp + 0.00026 * TotTme - 0.00356 * percCara + 0.00553 * percSugar + 0.547;
-	var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 1000) / 1000;
+	var fg = Math.round((1 + (1 - AttBeer) * (og - 1)) * 10000) / 10000;
 
-	console.log("estimate_fg("+percSugar+","+percCara+","+WGratio+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg);
+	//console.log("estimate_fg("+percSugar+","+percCara+","+BD+","+TotTme+","+Temp+","+attenuation+","+og+") :"+fg);
 	return fg;
 }
 

mercurial