
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) z)))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (((y - x) * 6.0d0) * z)
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * z);
}
def code(x, y, z): return x + (((y - x) * 6.0) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * z)) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot z
\end{array}
Initial program 99.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.05e+22) (not (<= y 8e+26))) (+ x (* 6.0 (* y z))) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+22) || !(y <= 8e+26)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.05d+22)) .or. (.not. (y <= 8d+26))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + ((-6.0d0) * (x * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.05e+22) || !(y <= 8e+26)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.05e+22) or not (y <= 8e+26): tmp = x + (6.0 * (y * z)) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.05e+22) || !(y <= 8e+26)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(-6.0 * Float64(x * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.05e+22) || ~((y <= 8e+26))) tmp = x + (6.0 * (y * z)); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.05e+22], N[Not[LessEqual[y, 8e+26]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.05 \cdot 10^{+22} \lor \neg \left(y \leq 8 \cdot 10^{+26}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if y < -1.0499999999999999e22 or 8.00000000000000038e26 < y Initial program 99.8%
Taylor expanded in y around inf 86.8%
*-commutative86.8%
Simplified86.8%
if -1.0499999999999999e22 < y < 8.00000000000000038e26Initial program 99.9%
Taylor expanded in y around 0 84.0%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= y -3.5e+20) (+ x (* z (* y 6.0))) (if (<= y 4.5e+26) (+ x (* z (* x -6.0))) (+ x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+20) {
tmp = x + (z * (y * 6.0));
} else if (y <= 4.5e+26) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-3.5d+20)) then
tmp = x + (z * (y * 6.0d0))
else if (y <= 4.5d+26) then
tmp = x + (z * (x * (-6.0d0)))
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -3.5e+20) {
tmp = x + (z * (y * 6.0));
} else if (y <= 4.5e+26) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -3.5e+20: tmp = x + (z * (y * 6.0)) elif y <= 4.5e+26: tmp = x + (z * (x * -6.0)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -3.5e+20) tmp = Float64(x + Float64(z * Float64(y * 6.0))); elseif (y <= 4.5e+26) tmp = Float64(x + Float64(z * Float64(x * -6.0))); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -3.5e+20) tmp = x + (z * (y * 6.0)); elseif (y <= 4.5e+26) tmp = x + (z * (x * -6.0)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -3.5e+20], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e+26], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.5 \cdot 10^{+20}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{+26}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -3.5e20Initial program 99.8%
Taylor expanded in y around inf 84.3%
if -3.5e20 < y < 4.49999999999999978e26Initial program 99.9%
Taylor expanded in y around 0 84.0%
associate-*r*84.1%
Simplified84.1%
if 4.49999999999999978e26 < y Initial program 99.8%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= y -2.15e+18) (+ x (* y (* 6.0 z))) (if (<= y 5.8e+18) (+ x (* z (* x -6.0))) (+ x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+18) {
tmp = x + (y * (6.0 * z));
} else if (y <= 5.8e+18) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-2.15d+18)) then
tmp = x + (y * (6.0d0 * z))
else if (y <= 5.8d+18) then
tmp = x + (z * (x * (-6.0d0)))
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.15e+18) {
tmp = x + (y * (6.0 * z));
} else if (y <= 5.8e+18) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.15e+18: tmp = x + (y * (6.0 * z)) elif y <= 5.8e+18: tmp = x + (z * (x * -6.0)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.15e+18) tmp = Float64(x + Float64(y * Float64(6.0 * z))); elseif (y <= 5.8e+18) tmp = Float64(x + Float64(z * Float64(x * -6.0))); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.15e+18) tmp = x + (y * (6.0 * z)); elseif (y <= 5.8e+18) tmp = x + (z * (x * -6.0)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.15e+18], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+18], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.15 \cdot 10^{+18}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+18}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.15e18Initial program 99.8%
Taylor expanded in y around inf 84.3%
*-commutative84.3%
associate-*r*84.3%
Simplified84.3%
if -2.15e18 < y < 5.8e18Initial program 99.9%
Taylor expanded in y around 0 84.0%
associate-*r*84.1%
Simplified84.1%
if 5.8e18 < y Initial program 99.8%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= y -5.2e+18) (+ x (* y (* 6.0 z))) (if (<= y 2.1e+22) (+ x (* -6.0 (* x z))) (+ x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+18) {
tmp = x + (y * (6.0 * z));
} else if (y <= 2.1e+22) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-5.2d+18)) then
tmp = x + (y * (6.0d0 * z))
else if (y <= 2.1d+22) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = x + (6.0d0 * (y * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -5.2e+18) {
tmp = x + (y * (6.0 * z));
} else if (y <= 2.1e+22) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -5.2e+18: tmp = x + (y * (6.0 * z)) elif y <= 2.1e+22: tmp = x + (-6.0 * (x * z)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -5.2e+18) tmp = Float64(x + Float64(y * Float64(6.0 * z))); elseif (y <= 2.1e+22) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(x + Float64(6.0 * Float64(y * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -5.2e+18) tmp = x + (y * (6.0 * z)); elseif (y <= 2.1e+22) tmp = x + (-6.0 * (x * z)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -5.2e+18], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.1e+22], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -5.2 \cdot 10^{+18}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{elif}\;y \leq 2.1 \cdot 10^{+22}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -5.2e18Initial program 99.8%
Taylor expanded in y around inf 84.3%
*-commutative84.3%
associate-*r*84.3%
Simplified84.3%
if -5.2e18 < y < 2.0999999999999998e22Initial program 99.9%
Taylor expanded in y around 0 84.0%
if 2.0999999999999998e22 < y Initial program 99.8%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
Final simplification85.4%
(FPCore (x y z) :precision binary64 (if (<= y -6e+135) (* z (* y 6.0)) (if (<= y 9.5e+21) (+ x (* -6.0 (* x z))) (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -6e+135) {
tmp = z * (y * 6.0);
} else if (y <= 9.5e+21) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (y <= (-6d+135)) then
tmp = z * (y * 6.0d0)
else if (y <= 9.5d+21) then
tmp = x + ((-6.0d0) * (x * z))
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -6e+135) {
tmp = z * (y * 6.0);
} else if (y <= 9.5e+21) {
tmp = x + (-6.0 * (x * z));
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -6e+135: tmp = z * (y * 6.0) elif y <= 9.5e+21: tmp = x + (-6.0 * (x * z)) else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -6e+135) tmp = Float64(z * Float64(y * 6.0)); elseif (y <= 9.5e+21) tmp = Float64(x + Float64(-6.0 * Float64(x * z))); else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -6e+135) tmp = z * (y * 6.0); elseif (y <= 9.5e+21) tmp = x + (-6.0 * (x * z)); else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -6e+135], N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 9.5e+21], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6 \cdot 10^{+135}:\\
\;\;\;\;z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;y \leq 9.5 \cdot 10^{+21}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -6.0000000000000001e135Initial program 99.9%
Taylor expanded in y around inf 89.4%
*-commutative89.4%
Simplified89.4%
+-commutative89.4%
associate-*r*89.4%
*-commutative89.4%
fma-define89.4%
*-commutative89.4%
Applied egg-rr89.4%
Taylor expanded in z around inf 79.4%
add-log-exp42.0%
*-un-lft-identity42.0%
log-prod42.0%
metadata-eval42.0%
add-log-exp79.4%
associate-*r*79.4%
*-commutative79.4%
Applied egg-rr79.4%
+-lft-identity79.4%
Simplified79.4%
if -6.0000000000000001e135 < y < 9.500000000000001e21Initial program 99.8%
Taylor expanded in y around 0 79.0%
if 9.500000000000001e21 < y Initial program 99.8%
Taylor expanded in y around inf 90.4%
*-commutative90.4%
Simplified90.4%
+-commutative90.4%
associate-*r*90.4%
*-commutative90.4%
fma-define90.4%
*-commutative90.4%
Applied egg-rr90.4%
Taylor expanded in z around inf 69.3%
Final simplification77.1%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.166) (not (<= z 49000000.0))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.166) || !(z <= 49000000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.166d0)) .or. (.not. (z <= 49000000.0d0))) then
tmp = (-6.0d0) * (x * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.166) || !(z <= 49000000.0)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.166) or not (z <= 49000000.0): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.166) || !(z <= 49000000.0)) tmp = Float64(-6.0 * Float64(x * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.166) || ~((z <= 49000000.0))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.166], N[Not[LessEqual[z, 49000000.0]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.166 \lor \neg \left(z \leq 49000000\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.166000000000000009 or 4.9e7 < z Initial program 99.8%
Taylor expanded in y around 0 54.6%
Taylor expanded in z around inf 54.6%
if -0.166000000000000009 < z < 4.9e7Initial program 99.9%
Taylor expanded in z around 0 65.2%
Final simplification60.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.166) (* -6.0 (* x z)) (if (<= z 1.45e-12) x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.166) {
tmp = -6.0 * (x * z);
} else if (z <= 1.45e-12) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.166d0)) then
tmp = (-6.0d0) * (x * z)
else if (z <= 1.45d-12) then
tmp = x
else
tmp = 6.0d0 * (y * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.166) {
tmp = -6.0 * (x * z);
} else if (z <= 1.45e-12) {
tmp = x;
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.166: tmp = -6.0 * (x * z) elif z <= 1.45e-12: tmp = x else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.166) tmp = Float64(-6.0 * Float64(x * z)); elseif (z <= 1.45e-12) tmp = x; else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.166) tmp = -6.0 * (x * z); elseif (z <= 1.45e-12) tmp = x; else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.166], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e-12], x, N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.166:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-12}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.166000000000000009Initial program 99.7%
Taylor expanded in y around 0 59.8%
Taylor expanded in z around inf 59.8%
if -0.166000000000000009 < z < 1.4500000000000001e-12Initial program 99.9%
Taylor expanded in z around 0 66.7%
if 1.4500000000000001e-12 < z Initial program 99.8%
Taylor expanded in y around inf 54.9%
*-commutative54.9%
Simplified54.9%
+-commutative54.9%
associate-*r*54.9%
*-commutative54.9%
fma-define54.9%
*-commutative54.9%
Applied egg-rr54.9%
Taylor expanded in z around inf 55.5%
(FPCore (x y z) :precision binary64 (+ x (* 6.0 (* (- y x) z))))
double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + (6.0d0 * ((y - x) * z))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * ((y - x) * z));
}
def code(x, y, z): return x + (6.0 * ((y - x) * z))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(Float64(y - x) * z))) end
function tmp = code(x, y, z) tmp = x + (6.0 * ((y - x) * z)); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(\left(y - x\right) \cdot z\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 x)
double code(double x, double y, double z) {
return x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x
end function
public static double code(double x, double y, double z) {
return x;
}
def code(x, y, z): return x
function code(x, y, z) return x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 34.3%
(FPCore (x y z) :precision binary64 (- x (* (* 6.0 z) (- x y))))
double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x - ((6.0d0 * z) * (x - y))
end function
public static double code(double x, double y, double z) {
return x - ((6.0 * z) * (x - y));
}
def code(x, y, z): return x - ((6.0 * z) * (x - y))
function code(x, y, z) return Float64(x - Float64(Float64(6.0 * z) * Float64(x - y))) end
function tmp = code(x, y, z) tmp = x - ((6.0 * z) * (x - y)); end
code[x_, y_, z_] := N[(x - N[(N[(6.0 * z), $MachinePrecision] * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(6 \cdot z\right) \cdot \left(x - y\right)
\end{array}
herbie shell --seed 2024170
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(! :herbie-platform default (- x (* (* 6 z) (- x y))))
(+ x (* (* (- y x) 6.0) z)))