
(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 (* (+ (* x -6.0) (* 6.0 y)) z)))
double code(double x, double y, double z) {
return x + (((x * -6.0) + (6.0 * y)) * 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 + (((x * (-6.0d0)) + (6.0d0 * y)) * z)
end function
public static double code(double x, double y, double z) {
return x + (((x * -6.0) + (6.0 * y)) * z);
}
def code(x, y, z): return x + (((x * -6.0) + (6.0 * y)) * z)
function code(x, y, z) return Float64(x + Float64(Float64(Float64(x * -6.0) + Float64(6.0 * y)) * z)) end
function tmp = code(x, y, z) tmp = x + (((x * -6.0) + (6.0 * y)) * z); end
code[x_, y_, z_] := N[(x + N[(N[(N[(x * -6.0), $MachinePrecision] + N[(6.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(x \cdot -6 + 6 \cdot y\right) \cdot z
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* x z))))
(if (<= x -1.8e+136)
t_0
(if (<= x -9e-67)
x
(if (<= x 1800.0) (* 6.0 (* y z)) (if (<= x 4e+214) x t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (x * z);
double tmp;
if (x <= -1.8e+136) {
tmp = t_0;
} else if (x <= -9e-67) {
tmp = x;
} else if (x <= 1800.0) {
tmp = 6.0 * (y * z);
} else if (x <= 4e+214) {
tmp = x;
} 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) :: tmp
t_0 = (-6.0d0) * (x * z)
if (x <= (-1.8d+136)) then
tmp = t_0
else if (x <= (-9d-67)) then
tmp = x
else if (x <= 1800.0d0) then
tmp = 6.0d0 * (y * z)
else if (x <= 4d+214) then
tmp = x
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 * (x * z);
double tmp;
if (x <= -1.8e+136) {
tmp = t_0;
} else if (x <= -9e-67) {
tmp = x;
} else if (x <= 1800.0) {
tmp = 6.0 * (y * z);
} else if (x <= 4e+214) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (x * z) tmp = 0 if x <= -1.8e+136: tmp = t_0 elif x <= -9e-67: tmp = x elif x <= 1800.0: tmp = 6.0 * (y * z) elif x <= 4e+214: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(x * z)) tmp = 0.0 if (x <= -1.8e+136) tmp = t_0; elseif (x <= -9e-67) tmp = x; elseif (x <= 1800.0) tmp = Float64(6.0 * Float64(y * z)); elseif (x <= 4e+214) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (x * z); tmp = 0.0; if (x <= -1.8e+136) tmp = t_0; elseif (x <= -9e-67) tmp = x; elseif (x <= 1800.0) tmp = 6.0 * (y * z); elseif (x <= 4e+214) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.8e+136], t$95$0, If[LessEqual[x, -9e-67], x, If[LessEqual[x, 1800.0], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4e+214], x, t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;x \leq -1.8 \cdot 10^{+136}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-67}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1800:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq 4 \cdot 10^{+214}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.80000000000000003e136 or 3.9999999999999998e214 < x Initial program 99.9%
Taylor expanded in y around 0 97.0%
Taylor expanded in z around inf 61.5%
if -1.80000000000000003e136 < x < -9.00000000000000031e-67 or 1800 < x < 3.9999999999999998e214Initial program 99.9%
Taylor expanded in z around 0 58.7%
if -9.00000000000000031e-67 < x < 1800Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 74.6%
Final simplification66.9%
(FPCore (x y z)
:precision binary64
(if (<= x -2e+136)
(* (* x -6.0) z)
(if (<= x -1.1e-63)
x
(if (<= x 120.0)
(* 6.0 (* y z))
(if (<= x 1.06e+215) x (* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -2e+136) {
tmp = (x * -6.0) * z;
} else if (x <= -1.1e-63) {
tmp = x;
} else if (x <= 120.0) {
tmp = 6.0 * (y * z);
} else if (x <= 1.06e+215) {
tmp = x;
} else {
tmp = -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 (x <= (-2d+136)) then
tmp = (x * (-6.0d0)) * z
else if (x <= (-1.1d-63)) then
tmp = x
else if (x <= 120.0d0) then
tmp = 6.0d0 * (y * z)
else if (x <= 1.06d+215) then
tmp = x
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -2e+136) {
tmp = (x * -6.0) * z;
} else if (x <= -1.1e-63) {
tmp = x;
} else if (x <= 120.0) {
tmp = 6.0 * (y * z);
} else if (x <= 1.06e+215) {
tmp = x;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -2e+136: tmp = (x * -6.0) * z elif x <= -1.1e-63: tmp = x elif x <= 120.0: tmp = 6.0 * (y * z) elif x <= 1.06e+215: tmp = x else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -2e+136) tmp = Float64(Float64(x * -6.0) * z); elseif (x <= -1.1e-63) tmp = x; elseif (x <= 120.0) tmp = Float64(6.0 * Float64(y * z)); elseif (x <= 1.06e+215) tmp = x; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -2e+136) tmp = (x * -6.0) * z; elseif (x <= -1.1e-63) tmp = x; elseif (x <= 120.0) tmp = 6.0 * (y * z); elseif (x <= 1.06e+215) tmp = x; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -2e+136], N[(N[(x * -6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, -1.1e-63], x, If[LessEqual[x, 120.0], N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.06e+215], x, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2 \cdot 10^{+136}:\\
\;\;\;\;\left(x \cdot -6\right) \cdot z\\
\mathbf{elif}\;x \leq -1.1 \cdot 10^{-63}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 120:\\
\;\;\;\;6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{+215}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -2.00000000000000012e136Initial program 99.9%
Taylor expanded in y around 0 95.5%
Taylor expanded in z around inf 56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
Simplified56.7%
Taylor expanded in x around 0 56.7%
associate-*r*56.8%
*-commutative56.8%
*-commutative56.8%
*-commutative56.8%
Simplified56.8%
if -2.00000000000000012e136 < x < -1.1e-63 or 120 < x < 1.06e215Initial program 99.9%
Taylor expanded in z around 0 58.7%
if -1.1e-63 < x < 120Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 74.6%
if 1.06e215 < x Initial program 99.9%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 70.8%
Final simplification66.9%
(FPCore (x y z)
:precision binary64
(if (<= x -1.15e+136)
(* (* x -6.0) z)
(if (<= x -3.3e-63)
x
(if (<= x 1350.0)
(* (* 6.0 y) z)
(if (<= x 8.2e+214) x (* -6.0 (* x z)))))))
double code(double x, double y, double z) {
double tmp;
if (x <= -1.15e+136) {
tmp = (x * -6.0) * z;
} else if (x <= -3.3e-63) {
tmp = x;
} else if (x <= 1350.0) {
tmp = (6.0 * y) * z;
} else if (x <= 8.2e+214) {
tmp = x;
} else {
tmp = -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 (x <= (-1.15d+136)) then
tmp = (x * (-6.0d0)) * z
else if (x <= (-3.3d-63)) then
tmp = x
else if (x <= 1350.0d0) then
tmp = (6.0d0 * y) * z
else if (x <= 8.2d+214) then
tmp = x
else
tmp = (-6.0d0) * (x * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= -1.15e+136) {
tmp = (x * -6.0) * z;
} else if (x <= -3.3e-63) {
tmp = x;
} else if (x <= 1350.0) {
tmp = (6.0 * y) * z;
} else if (x <= 8.2e+214) {
tmp = x;
} else {
tmp = -6.0 * (x * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -1.15e+136: tmp = (x * -6.0) * z elif x <= -3.3e-63: tmp = x elif x <= 1350.0: tmp = (6.0 * y) * z elif x <= 8.2e+214: tmp = x else: tmp = -6.0 * (x * z) return tmp
function code(x, y, z) tmp = 0.0 if (x <= -1.15e+136) tmp = Float64(Float64(x * -6.0) * z); elseif (x <= -3.3e-63) tmp = x; elseif (x <= 1350.0) tmp = Float64(Float64(6.0 * y) * z); elseif (x <= 8.2e+214) tmp = x; else tmp = Float64(-6.0 * Float64(x * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= -1.15e+136) tmp = (x * -6.0) * z; elseif (x <= -3.3e-63) tmp = x; elseif (x <= 1350.0) tmp = (6.0 * y) * z; elseif (x <= 8.2e+214) tmp = x; else tmp = -6.0 * (x * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -1.15e+136], N[(N[(x * -6.0), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, -3.3e-63], x, If[LessEqual[x, 1350.0], N[(N[(6.0 * y), $MachinePrecision] * z), $MachinePrecision], If[LessEqual[x, 8.2e+214], x, N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{+136}:\\
\;\;\;\;\left(x \cdot -6\right) \cdot z\\
\mathbf{elif}\;x \leq -3.3 \cdot 10^{-63}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1350:\\
\;\;\;\;\left(6 \cdot y\right) \cdot z\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{+214}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if x < -1.15e136Initial program 99.9%
Taylor expanded in y around 0 95.5%
Taylor expanded in z around inf 56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
Simplified56.7%
Taylor expanded in x around 0 56.7%
associate-*r*56.8%
*-commutative56.8%
*-commutative56.8%
*-commutative56.8%
Simplified56.8%
if -1.15e136 < x < -3.29999999999999994e-63 or 1350 < x < 8.2e214Initial program 99.9%
Taylor expanded in z around 0 58.7%
if -3.29999999999999994e-63 < x < 1350Initial program 99.8%
associate-*r*99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.8%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 74.6%
associate-*r*74.6%
Simplified74.6%
if 8.2e214 < x Initial program 99.9%
Taylor expanded in y around 0 100.0%
Taylor expanded in z around inf 70.8%
Final simplification66.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.5e-11) (not (<= z 1.6e-36))) (* (- y x) (* 6.0 z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5e-11) || !(z <= 1.6e-36)) {
tmp = (y - x) * (6.0 * 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 <= (-8.5d-11)) .or. (.not. (z <= 1.6d-36))) then
tmp = (y - x) * (6.0d0 * z)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8.5e-11) || !(z <= 1.6e-36)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.5e-11) or not (z <= 1.6e-36): tmp = (y - x) * (6.0 * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.5e-11) || !(z <= 1.6e-36)) tmp = Float64(Float64(y - x) * Float64(6.0 * z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.5e-11) || ~((z <= 1.6e-36))) tmp = (y - x) * (6.0 * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.5e-11], N[Not[LessEqual[z, 1.6e-36]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-11} \lor \neg \left(z \leq 1.6 \cdot 10^{-36}\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.50000000000000037e-11 or 1.60000000000000011e-36 < 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 z around inf 97.8%
associate-*r*97.8%
*-commutative97.8%
*-commutative97.8%
Simplified97.8%
if -8.50000000000000037e-11 < z < 1.60000000000000011e-36Initial program 99.9%
Taylor expanded in z around 0 75.0%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -1e-11) (not (<= z 1.3e-36))) (* (- y x) (* 6.0 z)) (+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1e-11) || !(z <= 1.3e-36)) {
tmp = (y - x) * (6.0 * 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 ((z <= (-1d-11)) .or. (.not. (z <= 1.3d-36))) then
tmp = (y - x) * (6.0d0 * 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 ((z <= -1e-11) || !(z <= 1.3e-36)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1e-11) or not (z <= 1.3e-36): tmp = (y - x) * (6.0 * z) else: tmp = x + (-6.0 * (x * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1e-11) || !(z <= 1.3e-36)) tmp = Float64(Float64(y - x) * Float64(6.0 * 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 ((z <= -1e-11) || ~((z <= 1.3e-36))) tmp = (y - x) * (6.0 * z); else tmp = x + (-6.0 * (x * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1e-11], N[Not[LessEqual[z, 1.3e-36]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-11} \lor \neg \left(z \leq 1.3 \cdot 10^{-36}\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + -6 \cdot \left(x \cdot z\right)\\
\end{array}
\end{array}
if z < -9.99999999999999939e-12 or 1.3e-36 < 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 z around inf 97.8%
associate-*r*97.8%
*-commutative97.8%
*-commutative97.8%
Simplified97.8%
if -9.99999999999999939e-12 < z < 1.3e-36Initial program 99.9%
Taylor expanded in y around 0 75.0%
Final simplification87.6%
(FPCore (x y z) :precision binary64 (if (or (<= z -20000000.0) (not (<= z 0.165))) (* (- y x) (* 6.0 z)) (+ x (* 6.0 (* y z)))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -20000000.0) || !(z <= 0.165)) {
tmp = (y - x) * (6.0 * 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 ((z <= (-20000000.0d0)) .or. (.not. (z <= 0.165d0))) then
tmp = (y - x) * (6.0d0 * 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 ((z <= -20000000.0) || !(z <= 0.165)) {
tmp = (y - x) * (6.0 * z);
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -20000000.0) or not (z <= 0.165): tmp = (y - x) * (6.0 * z) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -20000000.0) || !(z <= 0.165)) tmp = Float64(Float64(y - x) * Float64(6.0 * 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 ((z <= -20000000.0) || ~((z <= 0.165))) tmp = (y - x) * (6.0 * z); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -20000000.0], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(N[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -20000000 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;\left(y - x\right) \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if z < -2e7 or 0.165000000000000008 < 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 z around inf 99.1%
associate-*r*99.1%
*-commutative99.1%
*-commutative99.1%
Simplified99.1%
if -2e7 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in y around inf 99.9%
Final simplification99.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -20000000.0) (not (<= z 0.165))) (* -6.0 (* x z)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -20000000.0) || !(z <= 0.165)) {
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 <= (-20000000.0d0)) .or. (.not. (z <= 0.165d0))) 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 <= -20000000.0) || !(z <= 0.165)) {
tmp = -6.0 * (x * z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -20000000.0) or not (z <= 0.165): tmp = -6.0 * (x * z) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -20000000.0) || !(z <= 0.165)) 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 <= -20000000.0) || ~((z <= 0.165))) tmp = -6.0 * (x * z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -20000000.0], N[Not[LessEqual[z, 0.165]], $MachinePrecision]], N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -20000000 \lor \neg \left(z \leq 0.165\right):\\
\;\;\;\;-6 \cdot \left(x \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -2e7 or 0.165000000000000008 < z Initial program 99.8%
Taylor expanded in y around 0 46.8%
Taylor expanded in z around inf 46.1%
if -2e7 < z < 0.165000000000000008Initial program 99.9%
Taylor expanded in z around 0 72.4%
Final simplification58.5%
(FPCore (x y z) :precision binary64 (+ x (* z (* 6.0 (- y x)))))
double code(double x, double y, double z) {
return x + (z * (6.0 * (y - 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 + (z * (6.0d0 * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (z * (6.0 * (y - x)));
}
def code(x, y, z): return x + (z * (6.0 * (y - x)))
function code(x, y, z) return Float64(x + Float64(z * Float64(6.0 * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (z * (6.0 * (y - x))); end
code[x_, y_, z_] := N[(x + N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + z \cdot \left(6 \cdot \left(y - x\right)\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 35.8%
Final simplification35.8%
(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 2024077
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, E"
:precision binary64
:alt
(- x (* (* 6.0 z) (- x y)))
(+ x (* (* (- y x) 6.0) z)))