
(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 9 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(y - x) * Float64(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[(y - x), $MachinePrecision] * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot z\right)
\end{array}
Initial program 99.8%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.9%
Simplified99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* y (* 6.0 z))))
(if (<= z -1.92e+211)
t_0
(if (<= z -3.9e-14)
t_1
(if (<= z 0.17) x (if (<= z 4.3e+170) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = y * (6.0 * z);
double tmp;
if (z <= -1.92e+211) {
tmp = t_0;
} else if (z <= -3.9e-14) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 4.3e+170) {
tmp = t_0;
} else {
tmp = t_1;
}
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 = x * (z * (-6.0d0))
t_1 = y * (6.0d0 * z)
if (z <= (-1.92d+211)) then
tmp = t_0
else if (z <= (-3.9d-14)) then
tmp = t_1
else if (z <= 0.17d0) then
tmp = x
else if (z <= 4.3d+170) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = y * (6.0 * z);
double tmp;
if (z <= -1.92e+211) {
tmp = t_0;
} else if (z <= -3.9e-14) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 4.3e+170) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = y * (6.0 * z) tmp = 0 if z <= -1.92e+211: tmp = t_0 elif z <= -3.9e-14: tmp = t_1 elif z <= 0.17: tmp = x elif z <= 4.3e+170: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(y * Float64(6.0 * z)) tmp = 0.0 if (z <= -1.92e+211) tmp = t_0; elseif (z <= -3.9e-14) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif (z <= 4.3e+170) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = y * (6.0 * z); tmp = 0.0; if (z <= -1.92e+211) tmp = t_0; elseif (z <= -3.9e-14) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif (z <= 4.3e+170) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.92e+211], t$95$0, If[LessEqual[z, -3.9e-14], t$95$1, If[LessEqual[z, 0.17], x, If[LessEqual[z, 4.3e+170], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := y \cdot \left(6 \cdot z\right)\\
\mathbf{if}\;z \leq -1.92 \cdot 10^{+211}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-14}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{+170}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.91999999999999991e211 or 0.170000000000000012 < z < 4.2999999999999999e170Initial program 99.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6462.2%
Simplified62.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f6460.2%
Simplified60.2%
if -1.91999999999999991e211 < z < -3.8999999999999998e-14 or 4.2999999999999999e170 < z Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6464.2%
Simplified64.2%
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6464.2%
Applied egg-rr64.2%
if -3.8999999999999998e-14 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0
Simplified75.0%
Final simplification67.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z -6.0))) (t_1 (* z (* y 6.0))))
(if (<= z -2.5e+211)
t_0
(if (<= z -1.35e-9)
t_1
(if (<= z 0.17) x (if (<= z 6.8e+170) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = z * (y * 6.0);
double tmp;
if (z <= -2.5e+211) {
tmp = t_0;
} else if (z <= -1.35e-9) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 6.8e+170) {
tmp = t_0;
} else {
tmp = t_1;
}
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 = x * (z * (-6.0d0))
t_1 = z * (y * 6.0d0)
if (z <= (-2.5d+211)) then
tmp = t_0
else if (z <= (-1.35d-9)) then
tmp = t_1
else if (z <= 0.17d0) then
tmp = x
else if (z <= 6.8d+170) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double t_1 = z * (y * 6.0);
double tmp;
if (z <= -2.5e+211) {
tmp = t_0;
} else if (z <= -1.35e-9) {
tmp = t_1;
} else if (z <= 0.17) {
tmp = x;
} else if (z <= 6.8e+170) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) t_1 = z * (y * 6.0) tmp = 0 if z <= -2.5e+211: tmp = t_0 elif z <= -1.35e-9: tmp = t_1 elif z <= 0.17: tmp = x elif z <= 6.8e+170: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) t_1 = Float64(z * Float64(y * 6.0)) tmp = 0.0 if (z <= -2.5e+211) tmp = t_0; elseif (z <= -1.35e-9) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif (z <= 6.8e+170) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); t_1 = z * (y * 6.0); tmp = 0.0; if (z <= -2.5e+211) tmp = t_0; elseif (z <= -1.35e-9) tmp = t_1; elseif (z <= 0.17) tmp = x; elseif (z <= 6.8e+170) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.5e+211], t$95$0, If[LessEqual[z, -1.35e-9], t$95$1, If[LessEqual[z, 0.17], x, If[LessEqual[z, 6.8e+170], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
t_1 := z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;z \leq -2.5 \cdot 10^{+211}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-9}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 6.8 \cdot 10^{+170}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.4999999999999998e211 or 0.170000000000000012 < z < 6.8000000000000003e170Initial program 99.7%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6462.2%
Simplified62.2%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f6460.2%
Simplified60.2%
if -2.4999999999999998e211 < z < -1.3500000000000001e-9 or 6.8000000000000003e170 < z Initial program 99.8%
Taylor expanded in x around 0
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f6464.2%
Simplified64.2%
if -1.3500000000000001e-9 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0
Simplified75.0%
Final simplification67.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -0.2) t_0 (if (<= z 0.17) (+ x (* y (* 6.0 z))) t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -0.2) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x + (y * (6.0 * z));
} 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 * ((y - x) * z)
if (z <= (-0.2d0)) then
tmp = t_0
else if (z <= 0.17d0) then
tmp = x + (y * (6.0d0 * z))
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 - x) * z);
double tmp;
if (z <= -0.2) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x + (y * (6.0 * z));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -0.2: tmp = t_0 elif z <= 0.17: tmp = x + (y * (6.0 * z)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -0.2) tmp = t_0; elseif (z <= 0.17) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -0.2) tmp = t_0; elseif (z <= 0.17) tmp = x + (y * (6.0 * z)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.2], t$95$0, If[LessEqual[z, 0.17], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -0.2:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.20000000000000001 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.5%
Simplified98.5%
if -0.20000000000000001 < z < 0.170000000000000012Initial program 99.9%
+-lowering-+.f64N/A
associate-*l*N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6499.9%
Simplified99.9%
Taylor expanded in y around inf
Simplified99.5%
Final simplification98.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -9.1e-20) t_0 (if (<= z 245.0) (* x (+ 1.0 (* z -6.0))) t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -9.1e-20) {
tmp = t_0;
} else if (z <= 245.0) {
tmp = x * (1.0 + (z * -6.0));
} 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 * ((y - x) * z)
if (z <= (-9.1d-20)) then
tmp = t_0
else if (z <= 245.0d0) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
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 - x) * z);
double tmp;
if (z <= -9.1e-20) {
tmp = t_0;
} else if (z <= 245.0) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -9.1e-20: tmp = t_0 elif z <= 245.0: tmp = x * (1.0 + (z * -6.0)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -9.1e-20) tmp = t_0; elseif (z <= 245.0) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -9.1e-20) tmp = t_0; elseif (z <= 245.0) tmp = x * (1.0 + (z * -6.0)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -9.1e-20], t$95$0, If[LessEqual[z, 245.0], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -9.1 \cdot 10^{-20}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 245:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -9.09999999999999997e-20 or 245 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6498.9%
Simplified98.9%
if -9.09999999999999997e-20 < z < 245Initial program 99.9%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6475.7%
Simplified75.7%
Final simplification88.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* 6.0 (* (- y x) z)))) (if (<= z -3.95e-19) t_0 (if (<= z 5.7e-30) x t_0))))
double code(double x, double y, double z) {
double t_0 = 6.0 * ((y - x) * z);
double tmp;
if (z <= -3.95e-19) {
tmp = t_0;
} else if (z <= 5.7e-30) {
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 * ((y - x) * z)
if (z <= (-3.95d-19)) then
tmp = t_0
else if (z <= 5.7d-30) 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 * ((y - x) * z);
double tmp;
if (z <= -3.95e-19) {
tmp = t_0;
} else if (z <= 5.7e-30) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * ((y - x) * z) tmp = 0 if z <= -3.95e-19: tmp = t_0 elif z <= 5.7e-30: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(Float64(y - x) * z)) tmp = 0.0 if (z <= -3.95e-19) tmp = t_0; elseif (z <= 5.7e-30) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = 6.0 * ((y - x) * z); tmp = 0.0; if (z <= -3.95e-19) tmp = t_0; elseif (z <= 5.7e-30) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.95e-19], t$95$0, If[LessEqual[z, 5.7e-30], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -3.95 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 5.7 \cdot 10^{-30}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.9500000000000002e-19 or 5.69999999999999977e-30 < z Initial program 99.8%
Taylor expanded in z around inf
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f6497.2%
Simplified97.2%
if -3.9500000000000002e-19 < z < 5.69999999999999977e-30Initial program 99.9%
Taylor expanded in z around 0
Simplified76.4%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (* x (* z -6.0)))) (if (<= z -0.166) t_0 (if (<= z 0.17) x t_0))))
double code(double x, double y, double z) {
double t_0 = x * (z * -6.0);
double tmp;
if (z <= -0.166) {
tmp = t_0;
} else if (z <= 0.17) {
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 = x * (z * (-6.0d0))
if (z <= (-0.166d0)) then
tmp = t_0
else if (z <= 0.17d0) 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 = x * (z * -6.0);
double tmp;
if (z <= -0.166) {
tmp = t_0;
} else if (z <= 0.17) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * -6.0) tmp = 0 if z <= -0.166: tmp = t_0 elif z <= 0.17: tmp = x else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * -6.0)) tmp = 0.0 if (z <= -0.166) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (z * -6.0); tmp = 0.0; if (z <= -0.166) tmp = t_0; elseif (z <= 0.17) tmp = x; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.166], t$95$0, If[LessEqual[z, 0.17], x, t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot -6\right)\\
\mathbf{if}\;z \leq -0.166:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 0.17:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.166000000000000009 or 0.170000000000000012 < z Initial program 99.8%
Taylor expanded in x around inf
*-lowering-*.f64N/A
+-lowering-+.f64N/A
*-commutativeN/A
*-lowering-*.f6452.0%
Simplified52.0%
Taylor expanded in z around inf
*-commutativeN/A
*-lowering-*.f6450.6%
Simplified50.6%
if -0.166000000000000009 < z < 0.170000000000000012Initial program 99.9%
Taylor expanded in z around 0
Simplified74.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
Simplified34.4%
(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 2024161
(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)))