
(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 (fma (* (- y x) z) 6.0 x))
double code(double x, double y, double z) {
return fma(((y - x) * z), 6.0, x);
}
function code(x, y, z) return fma(Float64(Float64(y - x) * z), 6.0, x) end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision] * 6.0 + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\left(y - x\right) \cdot z, 6, x\right)
\end{array}
Initial program 99.8%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
(FPCore (x y z) :precision binary64 (fma z (* (- x y) -6.0) x))
double code(double x, double y, double z) {
return fma(z, ((x - y) * -6.0), x);
}
function code(x, y, z) return fma(z, Float64(Float64(x - y) * -6.0), x) end
code[x_, y_, z_] := N[(z * N[(N[(x - y), $MachinePrecision] * -6.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, \left(x - y\right) \cdot -6, x\right)
\end{array}
Initial program 99.8%
+-commutative99.8%
*-commutative99.8%
fma-define99.8%
remove-double-neg99.8%
distribute-lft-neg-in99.8%
distribute-rgt-neg-in99.8%
sub-neg99.8%
distribute-neg-in99.8%
remove-double-neg99.8%
+-commutative99.8%
sub-neg99.8%
metadata-eval99.8%
Simplified99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* z (* y 6.0))) (t_1 (* x (* z -6.0))))
(if (<= z -7e+166)
(* 6.0 (* y z))
(if (<= z -3.5e+33)
t_1
(if (<= z -9.6e-23)
t_0
(if (<= z 0.17) x (if (<= z 2.8e+118) t_1 t_0)))))))
double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -7e+166) {
tmp = 6.0 * (y * z);
} else if (z <= -3.5e+33) {
tmp = t_1;
} else if (z <= -9.6e-23) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.8e+118) {
tmp = t_1;
} else {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = z * (y * 6.0d0)
t_1 = x * (z * (-6.0d0))
if (z <= (-7d+166)) then
tmp = 6.0d0 * (y * z)
else if (z <= (-3.5d+33)) then
tmp = t_1
else if (z <= (-9.6d-23)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if (z <= 2.8d+118) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = z * (y * 6.0);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -7e+166) {
tmp = 6.0 * (y * z);
} else if (z <= -3.5e+33) {
tmp = t_1;
} else if (z <= -9.6e-23) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.8e+118) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = z * (y * 6.0) t_1 = x * (z * -6.0) tmp = 0 if z <= -7e+166: tmp = 6.0 * (y * z) elif z <= -3.5e+33: tmp = t_1 elif z <= -9.6e-23: tmp = t_0 elif z <= 0.17: tmp = x elif z <= 2.8e+118: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(z * Float64(y * 6.0)) t_1 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -7e+166) tmp = Float64(6.0 * Float64(y * z)); elseif (z <= -3.5e+33) tmp = t_1; elseif (z <= -9.6e-23) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 2.8e+118) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = z * (y * 6.0); t_1 = x * (z * -6.0); tmp = 0.0; if (z <= -7e+166) tmp = 6.0 * (y * z); elseif (z <= -3.5e+33) tmp = t_1; elseif (z <= -9.6e-23) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 2.8e+118) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7e+166], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.5e+33], t$95$1, If[LessEqual[z, -9.6e-23], t$95$0, If[LessEqual[z, 0.17], x, If[LessEqual[z, 2.8e+118], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := z \cdot \left(y \cdot 6\right)\\
t_1 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{+166}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -3.5 \cdot 10^{+33}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.9999999999999997e166Initial program 100.0%
associate-*r*99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.9%
fma-define99.9%
Applied egg-rr99.9%
Taylor expanded in y around inf 63.4%
*-commutative63.4%
Simplified63.4%
if -6.9999999999999997e166 < z < -3.5000000000000001e33 or 0.170000000000000012 < z < 2.79999999999999986e118Initial program 99.4%
Taylor expanded in x around inf 68.0%
+-commutative68.0%
Simplified68.0%
Taylor expanded in z around inf 64.4%
if -3.5000000000000001e33 < z < -9.59999999999999986e-23 or 2.79999999999999986e118 < z Initial program 99.8%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 65.4%
*-commutative65.4%
associate-*r*65.4%
*-commutative65.4%
associate-*r*65.6%
Simplified65.6%
if -9.59999999999999986e-23 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 79.0%
Final simplification71.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* y z))) (t_1 (* x (* z -6.0))))
(if (<= z -8e+166)
t_0
(if (<= z -3.6e+36)
t_1
(if (<= z -2.1e-45)
t_0
(if (<= z 0.17) x (if (<= z 2.55e+118) t_1 t_0)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -8e+166) {
tmp = t_0;
} else if (z <= -3.6e+36) {
tmp = t_1;
} else if (z <= -2.1e-45) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.55e+118) {
tmp = t_1;
} else {
tmp = t_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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 6.0d0 * (y * z)
t_1 = x * (z * (-6.0d0))
if (z <= (-8d+166)) then
tmp = t_0
else if (z <= (-3.6d+36)) then
tmp = t_1
else if (z <= (-2.1d-45)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x
else if (z <= 2.55d+118) then
tmp = t_1
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = 6.0 * (y * z);
double t_1 = x * (z * -6.0);
double tmp;
if (z <= -8e+166) {
tmp = t_0;
} else if (z <= -3.6e+36) {
tmp = t_1;
} else if (z <= -2.1e-45) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 2.55e+118) {
tmp = t_1;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (y * z) t_1 = x * (z * -6.0) tmp = 0 if z <= -8e+166: tmp = t_0 elif z <= -3.6e+36: tmp = t_1 elif z <= -2.1e-45: tmp = t_0 elif z <= 0.17: tmp = x elif z <= 2.55e+118: tmp = t_1 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(y * z)) t_1 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -8e+166) tmp = t_0; elseif (z <= -3.6e+36) tmp = t_1; elseif (z <= -2.1e-45) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 2.55e+118) tmp = t_1; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * (y * z); t_1 = x * (z * -6.0); tmp = 0.0; if (z <= -8e+166) tmp = t_0; elseif (z <= -3.6e+36) tmp = t_1; elseif (z <= -2.1e-45) tmp = t_0; elseif (z <= 0.17) tmp = x; elseif (z <= 2.55e+118) tmp = t_1; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8e+166], t$95$0, If[LessEqual[z, -3.6e+36], t$95$1, If[LessEqual[z, -2.1e-45], t$95$0, If[LessEqual[z, 0.17], x, If[LessEqual[z, 2.55e+118], t$95$1, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(y \cdot z\right)\\
t_1 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -8 \cdot 10^{+166}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.1 \cdot 10^{-45}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.55 \cdot 10^{+118}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -7.99999999999999952e166 or -3.5999999999999997e36 < z < -2.09999999999999995e-45 or 2.55000000000000001e118 < z Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 63.7%
*-commutative63.7%
Simplified63.7%
if -7.99999999999999952e166 < z < -3.5999999999999997e36 or 0.170000000000000012 < z < 2.55000000000000001e118Initial program 99.4%
Taylor expanded in x around inf 68.0%
+-commutative68.0%
Simplified68.0%
Taylor expanded in z around inf 64.4%
if -2.09999999999999995e-45 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0 80.5%
Final simplification71.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.205) (not (<= z 0.17))) (* (- y x) (* z 6.0)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.205) || !(z <= 0.17)) {
tmp = (y - x) * (z * 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 ((z <= (-0.205d0)) .or. (.not. (z <= 0.17d0))) then
tmp = (y - x) * (z * 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 ((z <= -0.205) || !(z <= 0.17)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.205) or not (z <= 0.17): tmp = (y - x) * (z * 6.0) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.205) || !(z <= 0.17)) tmp = Float64(Float64(y - x) * Float64(z * 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 ((z <= -0.205) || ~((z <= 0.17))) tmp = (y - x) * (z * 6.0); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.205], N[Not[LessEqual[z, 0.17]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.205 \lor \neg \left(z \leq 0.17\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -0.204999999999999988 or 0.170000000000000012 < z Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 97.7%
associate-*r*97.7%
*-commutative97.7%
*-commutative97.7%
Simplified97.7%
if -0.204999999999999988 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in y around inf 97.8%
*-commutative97.8%
Simplified97.8%
Final simplification97.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.8e-46) (not (<= z 220000.0))) (* (- y x) (* z 6.0)) (* x (+ (* z -6.0) 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-46) || !(z <= 220000.0)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x * ((z * -6.0) + 1.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 <= (-2.8d-46)) .or. (.not. (z <= 220000.0d0))) then
tmp = (y - x) * (z * 6.0d0)
else
tmp = x * ((z * (-6.0d0)) + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.8e-46) || !(z <= 220000.0)) {
tmp = (y - x) * (z * 6.0);
} else {
tmp = x * ((z * -6.0) + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.8e-46) or not (z <= 220000.0): tmp = (y - x) * (z * 6.0) else: tmp = x * ((z * -6.0) + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.8e-46) || !(z <= 220000.0)) tmp = Float64(Float64(y - x) * Float64(z * 6.0)); else tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.8e-46) || ~((z <= 220000.0))) tmp = (y - x) * (z * 6.0); else tmp = x * ((z * -6.0) + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.8e-46], N[Not[LessEqual[z, 220000.0]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(z * 6.0), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-46} \lor \neg \left(z \leq 220000\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\end{array}
\end{array}
if z < -2.7999999999999998e-46 or 2.2e5 < z Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 95.7%
associate-*r*95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
if -2.7999999999999998e-46 < z < 2.2e5Initial program 99.9%
Taylor expanded in x around inf 82.1%
+-commutative82.1%
Simplified82.1%
Final simplification89.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.12e-41) (not (<= x 1.25e-43))) (* x (+ (* z -6.0) 1.0)) (* 6.0 (* y z))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.12e-41) || !(x <= 1.25e-43)) {
tmp = x * ((z * -6.0) + 1.0);
} 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 ((x <= (-1.12d-41)) .or. (.not. (x <= 1.25d-43))) then
tmp = x * ((z * (-6.0d0)) + 1.0d0)
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 ((x <= -1.12e-41) || !(x <= 1.25e-43)) {
tmp = x * ((z * -6.0) + 1.0);
} else {
tmp = 6.0 * (y * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.12e-41) or not (x <= 1.25e-43): tmp = x * ((z * -6.0) + 1.0) else: tmp = 6.0 * (y * z) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.12e-41) || !(x <= 1.25e-43)) tmp = Float64(x * Float64(Float64(z * -6.0) + 1.0)); else tmp = Float64(6.0 * Float64(y * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.12e-41) || ~((x <= 1.25e-43))) tmp = x * ((z * -6.0) + 1.0); else tmp = 6.0 * (y * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.12e-41], N[Not[LessEqual[x, 1.25e-43]], $MachinePrecision]], N[(x * N[(N[(z * -6.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.12 \cdot 10^{-41} \lor \neg \left(x \leq 1.25 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(z \cdot -6 + 1\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if x < -1.11999999999999999e-41 or 1.25000000000000005e-43 < x Initial program 99.8%
Taylor expanded in x around inf 88.5%
+-commutative88.5%
Simplified88.5%
if -1.11999999999999999e-41 < x < 1.25000000000000005e-43Initial program 99.7%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 63.9%
*-commutative63.9%
Simplified63.9%
Final simplification77.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -2.6e-46) (not (<= z 4.5e-27))) (* 6.0 (* y z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e-46) || !(z <= 4.5e-27)) {
tmp = 6.0 * (y * 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 <= (-2.6d-46)) .or. (.not. (z <= 4.5d-27))) then
tmp = 6.0d0 * (y * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -2.6e-46) || !(z <= 4.5e-27)) {
tmp = 6.0 * (y * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -2.6e-46) or not (z <= 4.5e-27): tmp = 6.0 * (y * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -2.6e-46) || !(z <= 4.5e-27)) tmp = Float64(6.0 * Float64(y * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -2.6e-46) || ~((z <= 4.5e-27))) tmp = 6.0 * (y * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -2.6e-46], N[Not[LessEqual[z, 4.5e-27]], $MachinePrecision]], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.6 \cdot 10^{-46} \lor \neg \left(z \leq 4.5 \cdot 10^{-27}\right):\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2.6000000000000002e-46 or 4.5000000000000002e-27 < z Initial program 99.7%
associate-*r*99.6%
+-commutative99.6%
*-commutative99.6%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 52.2%
*-commutative52.2%
Simplified52.2%
if -2.6000000000000002e-46 < z < 4.5000000000000002e-27Initial program 99.9%
Taylor expanded in z around 0 83.6%
Final simplification65.4%
(FPCore (x y z) :precision binary64 (+ x (* z (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + (z * ((y - x) * 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 + (z * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + (z * ((y - x) * 6.0));
}
def code(x, y, z): return x + (z * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(z * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + (z * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(z * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 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 39.7%
(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 2024139
(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)))