diff --git a/hercules_cg/src/gpu.rs b/hercules_cg/src/gpu.rs
index 73dcf52811b355e8e4c1434e1f9bd6f3fb5baaff..6dc5d53ee012fd92552601ad9db0393983510305 100644
--- a/hercules_cg/src/gpu.rs
+++ b/hercules_cg/src/gpu.rs
@@ -1797,7 +1797,7 @@ extern \"C\" {} {}(",
             Constant::Integer64(val) => write!(w, "{}{} = {}ll;\n", tabs, name, val)?,
             Constant::UnsignedInteger64(val) => write!(w, "{}{} = {}ull;\n", tabs, name, val)?,
             Constant::Float32(val) => {
-                write!(w, "{}{} = {}f;\n", tabs, name, format_float(**val as f64))?
+                write!(w, "{}{} = {};\n", tabs, name, format_float(**val as f64))?
             }
             Constant::Float64(val) => write!(w, "{}{} = {};\n", tabs, name, format_float(**val))?,
             // All three following collections involve align then allocate from the
@@ -2223,9 +2223,15 @@ fn convert_type(ty: &Type, make_pointer: bool) -> String {
 }
 
 fn format_float(val: f64) -> String {
-    let mut s = val.to_string();
-    if !s.contains('.') && !s.contains('e') && !s.contains('E') {
-        s.push_str(".0");
+    if val == f64::INFINITY {
+        "INFINITY".to_string()
+    } else if val == f64::NEG_INFINITY {
+        "-INFINITY".to_string()
+    } else {
+        let mut s = val.to_string();
+        if !s.contains('.') && !s.contains('e') && !s.contains('E') {
+            s.push_str(".0");
+        }
+        s
     }
-    s
 }
diff --git a/juno_samples/edge_detection/src/gpu.sch b/juno_samples/edge_detection/src/gpu.sch
index 2a8960eec731fec4a3187c6df2e47eb72e3a2411..ed4140847d0508a2c66cddde79d57eebbabd64ea 100644
--- a/juno_samples/edge_detection/src/gpu.sch
+++ b/juno_samples/edge_detection/src/gpu.sch
@@ -67,12 +67,9 @@ let out = fork-split(max_gradient);
 fork-tile[32, 0, false, true](out._4_max_gradient.fj1);
 let out = fork-split(max_gradient);
 simpl!(max_gradient);
-xdot[true](max_gradient);
 clean-monoid-reduces(max_gradient);
-xdot[true](max_gradient);
 fork-fission-bufferize[out._4_max_gradient.fj0, out._4_max_gradient.fj1](max_gradient);
 simpl!(max_gradient);
-xdot[true](max_gradient);
 
 no-memset(reject_zero_crossings@res);
 fixpoint {