static float safeRatio(float x, float y) { float r = x/y; //print("ratio=" + r + " (x=" + x + ", y=" + y + ")"); ret Double.isNaN(r) ? 0f : r; }