
(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%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -6.5e-74) (not (<= y 2150000000000.0))) (+ x (* 6.0 (* y z))) (* x (+ 1.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e-74) || !(y <= 2150000000000.0)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * (1.0 + (z * -6.0));
}
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 <= (-6.5d-74)) .or. (.not. (y <= 2150000000000.0d0))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x * (1.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -6.5e-74) || !(y <= 2150000000000.0)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x * (1.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -6.5e-74) or not (y <= 2150000000000.0): tmp = x + (6.0 * (y * z)) else: tmp = x * (1.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -6.5e-74) || !(y <= 2150000000000.0)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -6.5e-74) || ~((y <= 2150000000000.0))) tmp = x + (6.0 * (y * z)); else tmp = x * (1.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -6.5e-74], N[Not[LessEqual[y, 2150000000000.0]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -6.5 \cdot 10^{-74} \lor \neg \left(y \leq 2150000000000\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\end{array}
\end{array}
if y < -6.5000000000000002e-74 or 2.15e12 < y Initial program 99.8%
Taylor expanded in y around inf 91.1%
if -6.5000000000000002e-74 < y < 2.15e12Initial program 99.8%
Taylor expanded in x around inf 90.7%
Final simplification90.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.8e-73) (not (<= y 2200000000000.0))) (+ x (* 6.0 (* y z))) (+ x (* z (/ x -0.16666666666666666)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.8e-73) || !(y <= 2200000000000.0)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x / -0.16666666666666666));
}
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.8d-73)) .or. (.not. (y <= 2200000000000.0d0))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + (z * (x / (-0.16666666666666666d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -2.8e-73) || !(y <= 2200000000000.0)) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (z * (x / -0.16666666666666666));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.8e-73) or not (y <= 2200000000000.0): tmp = x + (6.0 * (y * z)) else: tmp = x + (z * (x / -0.16666666666666666)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.8e-73) || !(y <= 2200000000000.0)) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(z * Float64(x / -0.16666666666666666))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -2.8e-73) || ~((y <= 2200000000000.0))) tmp = x + (6.0 * (y * z)); else tmp = x + (z * (x / -0.16666666666666666)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.8e-73], N[Not[LessEqual[y, 2200000000000.0]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(x / -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-73} \lor \neg \left(y \leq 2200000000000\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{x}{-0.16666666666666666}\\
\end{array}
\end{array}
if y < -2.80000000000000012e-73 or 2.2e12 < y Initial program 99.8%
Taylor expanded in y around inf 91.1%
if -2.80000000000000012e-73 < y < 2.2e12Initial program 99.8%
*-commutative99.8%
flip--71.4%
clear-num71.3%
un-div-inv71.3%
clear-num71.3%
flip--99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
associate-/l/99.8%
associate-/r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
associate-*r*90.8%
*-commutative90.8%
*-commutative90.8%
/-rgt-identity90.8%
associate-*r*90.7%
associate-/l*90.7%
*-commutative90.7%
metadata-eval90.7%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
Final simplification91.0%
(FPCore (x y z)
:precision binary64
(if (<= y -2.8e-73)
(+ x (* z (* y 6.0)))
(if (<= y 2150000000000.0)
(+ x (* z (/ x -0.16666666666666666)))
(+ x (* 6.0 (* y z))))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.8e-73) {
tmp = x + (z * (y * 6.0));
} else if (y <= 2150000000000.0) {
tmp = x + (z * (x / -0.16666666666666666));
} 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.8d-73)) then
tmp = x + (z * (y * 6.0d0))
else if (y <= 2150000000000.0d0) then
tmp = x + (z * (x / (-0.16666666666666666d0)))
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.8e-73) {
tmp = x + (z * (y * 6.0));
} else if (y <= 2150000000000.0) {
tmp = x + (z * (x / -0.16666666666666666));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.8e-73: tmp = x + (z * (y * 6.0)) elif y <= 2150000000000.0: tmp = x + (z * (x / -0.16666666666666666)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.8e-73) tmp = Float64(x + Float64(z * Float64(y * 6.0))); elseif (y <= 2150000000000.0) tmp = Float64(x + Float64(z * Float64(x / -0.16666666666666666))); 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.8e-73) tmp = x + (z * (y * 6.0)); elseif (y <= 2150000000000.0) tmp = x + (z * (x / -0.16666666666666666)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.8e-73], N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2150000000000.0], N[(x + N[(z * N[(x / -0.16666666666666666), $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.8 \cdot 10^{-73}:\\
\;\;\;\;x + z \cdot \left(y \cdot 6\right)\\
\mathbf{elif}\;y \leq 2150000000000:\\
\;\;\;\;x + z \cdot \frac{x}{-0.16666666666666666}\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.80000000000000012e-73Initial program 99.9%
Taylor expanded in y around inf 86.4%
if -2.80000000000000012e-73 < y < 2.15e12Initial program 99.8%
*-commutative99.8%
flip--71.4%
clear-num71.3%
un-div-inv71.3%
clear-num71.3%
flip--99.7%
Applied egg-rr99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.7%
associate-/l/99.8%
associate-/r*99.8%
metadata-eval99.8%
Applied egg-rr99.8%
associate-/r/99.7%
Simplified99.7%
Taylor expanded in y around 0 90.7%
associate-*r*90.8%
*-commutative90.8%
*-commutative90.8%
/-rgt-identity90.8%
associate-*r*90.7%
associate-/l*90.7%
*-commutative90.7%
metadata-eval90.7%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
if 2.15e12 < y Initial program 99.7%
Taylor expanded in y around inf 97.7%
Final simplification91.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -96000000000.0) (not (<= z 0.165))) (* x (* z -6.0)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -96000000000.0) || !(z <= 0.165)) {
tmp = x * (z * -6.0);
} 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 <= (-96000000000.0d0)) .or. (.not. (z <= 0.165d0))) then
tmp = x * (z * (-6.0d0))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -96000000000.0) || !(z <= 0.165)) {
tmp = x * (z * -6.0);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -96000000000.0) or not (z <= 0.165): tmp = x * (z * -6.0) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -96000000000.0) || !(z <= 0.165)) tmp = Float64(x * Float64(z * -6.0)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -96000000000.0) || ~((z <= 0.165))) tmp = x * (z * -6.0); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -96000000000.0], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -96000000000 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -9.6e10 or 0.165000000000000008 < z Initial program 99.7%
Taylor expanded in x around inf 58.3%
Taylor expanded in z around inf 58.3%
*-commutative58.3%
Simplified58.3%
if -9.6e10 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 73.1%
Final simplification65.7%
(FPCore (x y z) :precision binary64 (if (<= z -96000000000.0) (* x (* z -6.0)) (if (<= z 0.165) x (* z (/ x -0.16666666666666666)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = x * (z * -6.0);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x / -0.16666666666666666);
}
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 <= (-96000000000.0d0)) then
tmp = x * (z * (-6.0d0))
else if (z <= 0.165d0) then
tmp = x
else
tmp = z * (x / (-0.16666666666666666d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = x * (z * -6.0);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x / -0.16666666666666666);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -96000000000.0: tmp = x * (z * -6.0) elif z <= 0.165: tmp = x else: tmp = z * (x / -0.16666666666666666) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -96000000000.0) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= 0.165) tmp = x; else tmp = Float64(z * Float64(x / -0.16666666666666666)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -96000000000.0) tmp = x * (z * -6.0); elseif (z <= 0.165) tmp = x; else tmp = z * (x / -0.16666666666666666); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -96000000000.0], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.165], x, N[(z * N[(x / -0.16666666666666666), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -96000000000:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 0.165:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \frac{x}{-0.16666666666666666}\\
\end{array}
\end{array}
if z < -9.6e10Initial program 99.6%
Taylor expanded in x around inf 50.3%
Taylor expanded in z around inf 50.3%
*-commutative50.3%
Simplified50.3%
if -9.6e10 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in x around inf 66.1%
Taylor expanded in z around inf 66.1%
*-commutative66.1%
Simplified66.1%
*-commutative66.1%
associate-*r*66.3%
metadata-eval66.3%
associate-/r/66.2%
associate-*r/66.1%
metadata-eval66.1%
div-inv66.2%
div-inv66.1%
frac-2neg66.1%
metadata-eval66.1%
remove-double-div66.2%
*-commutative66.2%
clear-num66.2%
metadata-eval66.2%
frac-2neg66.2%
metadata-eval66.2%
metadata-eval66.2%
associate-*r/66.2%
distribute-lft-neg-in66.2%
metadata-eval66.2%
div-inv66.2%
frac-2neg66.2%
distribute-neg-frac66.2%
remove-double-neg66.2%
metadata-eval66.2%
/-rgt-identity66.2%
distribute-neg-frac66.2%
Applied egg-rr66.2%
Taylor expanded in x around 0 66.1%
metadata-eval66.1%
*-commutative66.1%
associate-/r/66.1%
associate-/r*66.1%
associate-/l*66.2%
associate-*r/66.2%
*-lft-identity66.2%
associate-/r/66.3%
*-commutative66.3%
Simplified66.3%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= z -96000000000.0) (* x (* z -6.0)) (if (<= z 0.165) x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = x * (z * -6.0);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
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 <= (-96000000000.0d0)) then
tmp = x * (z * (-6.0d0))
else if (z <= 0.165d0) then
tmp = x
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = x * (z * -6.0);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -96000000000.0: tmp = x * (z * -6.0) elif z <= 0.165: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -96000000000.0) tmp = Float64(x * Float64(z * -6.0)); elseif (z <= 0.165) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -96000000000.0) tmp = x * (z * -6.0); elseif (z <= 0.165) tmp = x; else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -96000000000.0], N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.165], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -96000000000:\\
\;\;\;\;x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;z \leq 0.165:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -9.6e10Initial program 99.6%
Taylor expanded in x around inf 50.3%
Taylor expanded in z around inf 50.3%
*-commutative50.3%
Simplified50.3%
if -9.6e10 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in x around inf 66.1%
Taylor expanded in z around inf 66.1%
*-commutative66.1%
Simplified66.1%
*-commutative66.1%
associate-*r*66.3%
metadata-eval66.3%
associate-/r/66.2%
associate-*r/66.1%
metadata-eval66.1%
div-inv66.2%
div-inv66.1%
frac-2neg66.1%
metadata-eval66.1%
remove-double-div66.2%
*-commutative66.2%
clear-num66.2%
metadata-eval66.2%
frac-2neg66.2%
metadata-eval66.2%
metadata-eval66.2%
associate-*r/66.2%
distribute-lft-neg-in66.2%
metadata-eval66.2%
div-inv66.2%
frac-2neg66.2%
distribute-neg-frac66.2%
remove-double-neg66.2%
metadata-eval66.2%
/-rgt-identity66.2%
distribute-neg-frac66.2%
Applied egg-rr66.2%
associate-/r/66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (if (<= z -96000000000.0) (/ z (/ -0.16666666666666666 x)) (if (<= z 0.165) x (* z (* x -6.0)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = z / (-0.16666666666666666 / x);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
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 <= (-96000000000.0d0)) then
tmp = z / ((-0.16666666666666666d0) / x)
else if (z <= 0.165d0) then
tmp = x
else
tmp = z * (x * (-6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -96000000000.0) {
tmp = z / (-0.16666666666666666 / x);
} else if (z <= 0.165) {
tmp = x;
} else {
tmp = z * (x * -6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -96000000000.0: tmp = z / (-0.16666666666666666 / x) elif z <= 0.165: tmp = x else: tmp = z * (x * -6.0) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -96000000000.0) tmp = Float64(z / Float64(-0.16666666666666666 / x)); elseif (z <= 0.165) tmp = x; else tmp = Float64(z * Float64(x * -6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -96000000000.0) tmp = z / (-0.16666666666666666 / x); elseif (z <= 0.165) tmp = x; else tmp = z * (x * -6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -96000000000.0], N[(z / N[(-0.16666666666666666 / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.165], x, N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -96000000000:\\
\;\;\;\;\frac{z}{\frac{-0.16666666666666666}{x}}\\
\mathbf{elif}\;z \leq 0.165:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if z < -9.6e10Initial program 99.6%
Taylor expanded in x around inf 50.3%
Taylor expanded in z around inf 50.3%
*-commutative50.3%
Simplified50.3%
*-commutative50.3%
associate-*r*50.3%
metadata-eval50.3%
associate-/r/50.2%
associate-*r/50.2%
associate-/l*50.3%
div-inv50.3%
metadata-eval50.3%
associate-*l/50.3%
metadata-eval50.3%
Applied egg-rr50.3%
if -9.6e10 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 73.1%
if 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in x around inf 66.1%
Taylor expanded in z around inf 66.1%
*-commutative66.1%
Simplified66.1%
*-commutative66.1%
associate-*r*66.3%
metadata-eval66.3%
associate-/r/66.2%
associate-*r/66.1%
metadata-eval66.1%
div-inv66.2%
div-inv66.1%
frac-2neg66.1%
metadata-eval66.1%
remove-double-div66.2%
*-commutative66.2%
clear-num66.2%
metadata-eval66.2%
frac-2neg66.2%
metadata-eval66.2%
metadata-eval66.2%
associate-*r/66.2%
distribute-lft-neg-in66.2%
metadata-eval66.2%
div-inv66.2%
frac-2neg66.2%
distribute-neg-frac66.2%
remove-double-neg66.2%
metadata-eval66.2%
/-rgt-identity66.2%
distribute-neg-frac66.2%
Applied egg-rr66.2%
associate-/r/66.3%
div-inv66.3%
metadata-eval66.3%
Applied egg-rr66.3%
Final simplification65.8%
(FPCore (x y z) :precision binary64 (* x (+ 1.0 (* z -6.0))))
double code(double x, double y, double z) {
return x * (1.0 + (z * -6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x * (1.0d0 + (z * (-6.0d0)))
end function
public static double code(double x, double y, double z) {
return x * (1.0 + (z * -6.0));
}
def code(x, y, z): return x * (1.0 + (z * -6.0))
function code(x, y, z) return Float64(x * Float64(1.0 + Float64(z * -6.0))) end
function tmp = code(x, y, z) tmp = x * (1.0 + (z * -6.0)); end
code[x_, y_, z_] := N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 + z \cdot -6\right)
\end{array}
Initial program 99.8%
Taylor expanded in x around inf 66.5%
Final simplification66.5%
(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 38.1%
Final simplification38.1%
(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 2023297
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:herbie-target
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))