
(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 (* (fma y 6.0 (* x (- 6.0))) z)))
double code(double x, double y, double z) {
return x + (fma(y, 6.0, (x * -6.0)) * z);
}
function code(x, y, z) return Float64(x + Float64(fma(y, 6.0, Float64(x * Float64(-6.0))) * z)) end
code[x_, y_, z_] := N[(x + N[(N[(y * 6.0 + N[(x * (-6.0)), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \mathsf{fma}\left(y, 6, x \cdot \left(-6\right)\right) \cdot z
\end{array}
Initial program 99.8%
*-commutative99.8%
sub-neg99.8%
distribute-rgt-in99.8%
fma-def99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(if (or (<= y -31500000000.0)
(not (or (<= y -7e-155) (and (not (<= y -1.1e-170)) (<= y 8e-99)))))
(+ x (* 6.0 (* y z)))
(+ x (* -6.0 (* x z)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -31500000000.0) || !((y <= -7e-155) || (!(y <= -1.1e-170) && (y <= 8e-99)))) {
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 <= (-31500000000.0d0)) .or. (.not. (y <= (-7d-155)) .or. (.not. (y <= (-1.1d-170))) .and. (y <= 8d-99))) 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 <= -31500000000.0) || !((y <= -7e-155) || (!(y <= -1.1e-170) && (y <= 8e-99)))) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (-6.0 * (x * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -31500000000.0) or not ((y <= -7e-155) or (not (y <= -1.1e-170) and (y <= 8e-99))): 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 <= -31500000000.0) || !((y <= -7e-155) || (!(y <= -1.1e-170) && (y <= 8e-99)))) 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 <= -31500000000.0) || ~(((y <= -7e-155) || (~((y <= -1.1e-170)) && (y <= 8e-99))))) 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, -31500000000.0], N[Not[Or[LessEqual[y, -7e-155], And[N[Not[LessEqual[y, -1.1e-170]], $MachinePrecision], LessEqual[y, 8e-99]]]], $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 -31500000000 \lor \neg \left(y \leq -7 \cdot 10^{-155} \lor \neg \left(y \leq -1.1 \cdot 10^{-170}\right) \land y \leq 8 \cdot 10^{-99}\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 < -3.15e10 or -7.00000000000000031e-155 < y < -1.10000000000000007e-170 or 8.0000000000000002e-99 < y Initial program 99.8%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
if -3.15e10 < y < -7.00000000000000031e-155 or -1.10000000000000007e-170 < y < 8.0000000000000002e-99Initial program 99.8%
Taylor expanded in y around 0 90.3%
Final simplification93.0%
(FPCore (x y z)
:precision binary64
(if (or (<= y -280000000000.0)
(not
(or (<= y -7.5e-155) (and (not (<= y -1.1e-170)) (<= y 2.7e-98)))))
(+ x (* 6.0 (* y z)))
(+ x (* x (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -280000000000.0) || !((y <= -7.5e-155) || (!(y <= -1.1e-170) && (y <= 2.7e-98)))) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (x * (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 <= (-280000000000.0d0)) .or. (.not. (y <= (-7.5d-155)) .or. (.not. (y <= (-1.1d-170))) .and. (y <= 2.7d-98))) then
tmp = x + (6.0d0 * (y * z))
else
tmp = x + (x * (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -280000000000.0) || !((y <= -7.5e-155) || (!(y <= -1.1e-170) && (y <= 2.7e-98)))) {
tmp = x + (6.0 * (y * z));
} else {
tmp = x + (x * (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -280000000000.0) or not ((y <= -7.5e-155) or (not (y <= -1.1e-170) and (y <= 2.7e-98))): tmp = x + (6.0 * (y * z)) else: tmp = x + (x * (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -280000000000.0) || !((y <= -7.5e-155) || (!(y <= -1.1e-170) && (y <= 2.7e-98)))) tmp = Float64(x + Float64(6.0 * Float64(y * z))); else tmp = Float64(x + Float64(x * Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -280000000000.0) || ~(((y <= -7.5e-155) || (~((y <= -1.1e-170)) && (y <= 2.7e-98))))) tmp = x + (6.0 * (y * z)); else tmp = x + (x * (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -280000000000.0], N[Not[Or[LessEqual[y, -7.5e-155], And[N[Not[LessEqual[y, -1.1e-170]], $MachinePrecision], LessEqual[y, 2.7e-98]]]], $MachinePrecision]], N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -280000000000 \lor \neg \left(y \leq -7.5 \cdot 10^{-155} \lor \neg \left(y \leq -1.1 \cdot 10^{-170}\right) \land y \leq 2.7 \cdot 10^{-98}\right):\\
\;\;\;\;x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\end{array}
\end{array}
if y < -2.8e11 or -7.5000000000000006e-155 < y < -1.10000000000000007e-170 or 2.6999999999999999e-98 < y Initial program 99.8%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
if -2.8e11 < y < -7.5000000000000006e-155 or -1.10000000000000007e-170 < y < 2.6999999999999999e-98Initial program 99.8%
Taylor expanded in y around 0 90.3%
*-commutative90.3%
associate-*r*90.3%
*-commutative90.3%
Simplified90.3%
Final simplification93.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* 6.0 (* y z)))))
(if (<= y -125000000000.0)
t_0
(if (<= y -8.5e-155)
(+ x (* x (* z -6.0)))
(if (or (<= y -1.1e-170) (not (<= y 2.2e-98)))
t_0
(+ x (* z (* x -6.0))))))))
double code(double x, double y, double z) {
double t_0 = x + (6.0 * (y * z));
double tmp;
if (y <= -125000000000.0) {
tmp = t_0;
} else if (y <= -8.5e-155) {
tmp = x + (x * (z * -6.0));
} else if ((y <= -1.1e-170) || !(y <= 2.2e-98)) {
tmp = t_0;
} else {
tmp = x + (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) :: t_0
real(8) :: tmp
t_0 = x + (6.0d0 * (y * z))
if (y <= (-125000000000.0d0)) then
tmp = t_0
else if (y <= (-8.5d-155)) then
tmp = x + (x * (z * (-6.0d0)))
else if ((y <= (-1.1d-170)) .or. (.not. (y <= 2.2d-98))) then
tmp = t_0
else
tmp = x + (z * (x * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (6.0 * (y * z));
double tmp;
if (y <= -125000000000.0) {
tmp = t_0;
} else if (y <= -8.5e-155) {
tmp = x + (x * (z * -6.0));
} else if ((y <= -1.1e-170) || !(y <= 2.2e-98)) {
tmp = t_0;
} else {
tmp = x + (z * (x * -6.0));
}
return tmp;
}
def code(x, y, z): t_0 = x + (6.0 * (y * z)) tmp = 0 if y <= -125000000000.0: tmp = t_0 elif y <= -8.5e-155: tmp = x + (x * (z * -6.0)) elif (y <= -1.1e-170) or not (y <= 2.2e-98): tmp = t_0 else: tmp = x + (z * (x * -6.0)) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(6.0 * Float64(y * z))) tmp = 0.0 if (y <= -125000000000.0) tmp = t_0; elseif (y <= -8.5e-155) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif ((y <= -1.1e-170) || !(y <= 2.2e-98)) tmp = t_0; else tmp = Float64(x + Float64(z * Float64(x * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (6.0 * (y * z)); tmp = 0.0; if (y <= -125000000000.0) tmp = t_0; elseif (y <= -8.5e-155) tmp = x + (x * (z * -6.0)); elseif ((y <= -1.1e-170) || ~((y <= 2.2e-98))) tmp = t_0; else tmp = x + (z * (x * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -125000000000.0], t$95$0, If[LessEqual[y, -8.5e-155], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -1.1e-170], N[Not[LessEqual[y, 2.2e-98]], $MachinePrecision]], t$95$0, N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + 6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \leq -125000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -8.5 \cdot 10^{-155}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-170} \lor \neg \left(y \leq 2.2 \cdot 10^{-98}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\end{array}
\end{array}
if y < -1.25e11 or -8.4999999999999996e-155 < y < -1.10000000000000007e-170 or 2.19999999999999996e-98 < y Initial program 99.8%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
if -1.25e11 < y < -8.4999999999999996e-155Initial program 99.7%
Taylor expanded in y around 0 82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
if -1.10000000000000007e-170 < y < 2.19999999999999996e-98Initial program 99.9%
Taylor expanded in y around 0 95.0%
associate-*r*95.1%
Simplified95.1%
Final simplification93.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* z (* y 6.0)))))
(if (<= y -31500000000.0)
t_0
(if (<= y -7e-155)
(+ x (* x (* z -6.0)))
(if (<= y -1.1e-170)
t_0
(if (<= y 1.1e-98) (+ x (* z (* x -6.0))) (+ x (* 6.0 (* y z)))))))))
double code(double x, double y, double z) {
double t_0 = x + (z * (y * 6.0));
double tmp;
if (y <= -31500000000.0) {
tmp = t_0;
} else if (y <= -7e-155) {
tmp = x + (x * (z * -6.0));
} else if (y <= -1.1e-170) {
tmp = t_0;
} else if (y <= 1.1e-98) {
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) :: t_0
real(8) :: tmp
t_0 = x + (z * (y * 6.0d0))
if (y <= (-31500000000.0d0)) then
tmp = t_0
else if (y <= (-7d-155)) then
tmp = x + (x * (z * (-6.0d0)))
else if (y <= (-1.1d-170)) then
tmp = t_0
else if (y <= 1.1d-98) 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 t_0 = x + (z * (y * 6.0));
double tmp;
if (y <= -31500000000.0) {
tmp = t_0;
} else if (y <= -7e-155) {
tmp = x + (x * (z * -6.0));
} else if (y <= -1.1e-170) {
tmp = t_0;
} else if (y <= 1.1e-98) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (6.0 * (y * z));
}
return tmp;
}
def code(x, y, z): t_0 = x + (z * (y * 6.0)) tmp = 0 if y <= -31500000000.0: tmp = t_0 elif y <= -7e-155: tmp = x + (x * (z * -6.0)) elif y <= -1.1e-170: tmp = t_0 elif y <= 1.1e-98: tmp = x + (z * (x * -6.0)) else: tmp = x + (6.0 * (y * z)) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z * Float64(y * 6.0))) tmp = 0.0 if (y <= -31500000000.0) tmp = t_0; elseif (y <= -7e-155) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (y <= -1.1e-170) tmp = t_0; elseif (y <= 1.1e-98) 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) t_0 = x + (z * (y * 6.0)); tmp = 0.0; if (y <= -31500000000.0) tmp = t_0; elseif (y <= -7e-155) tmp = x + (x * (z * -6.0)); elseif (y <= -1.1e-170) tmp = t_0; elseif (y <= 1.1e-98) tmp = x + (z * (x * -6.0)); else tmp = x + (6.0 * (y * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -31500000000.0], t$95$0, If[LessEqual[y, -7e-155], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.1e-170], t$95$0, If[LessEqual[y, 1.1e-98], 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}
t_0 := x + z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;y \leq -31500000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-155}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;y \leq -1.1 \cdot 10^{-170}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-98}:\\
\;\;\;\;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.15e10 or -7.00000000000000031e-155 < y < -1.10000000000000007e-170Initial program 99.8%
Taylor expanded in y around inf 95.5%
if -3.15e10 < y < -7.00000000000000031e-155Initial program 99.7%
Taylor expanded in y around 0 82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
if -1.10000000000000007e-170 < y < 1.09999999999999998e-98Initial program 99.9%
Taylor expanded in y around 0 95.0%
associate-*r*95.1%
Simplified95.1%
if 1.09999999999999998e-98 < y Initial program 99.8%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
Final simplification93.0%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (* z (* y 6.0)))))
(if (<= y -235000000000.0)
t_0
(if (<= y -7e-155)
(+ x (* x (* z -6.0)))
(if (<= y -4.8e-171)
t_0
(if (<= y 7.2e-99) (+ x (* z (* x -6.0))) (+ x (* y (* 6.0 z)))))))))
double code(double x, double y, double z) {
double t_0 = x + (z * (y * 6.0));
double tmp;
if (y <= -235000000000.0) {
tmp = t_0;
} else if (y <= -7e-155) {
tmp = x + (x * (z * -6.0));
} else if (y <= -4.8e-171) {
tmp = t_0;
} else if (y <= 7.2e-99) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (y * (6.0 * 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) :: t_0
real(8) :: tmp
t_0 = x + (z * (y * 6.0d0))
if (y <= (-235000000000.0d0)) then
tmp = t_0
else if (y <= (-7d-155)) then
tmp = x + (x * (z * (-6.0d0)))
else if (y <= (-4.8d-171)) then
tmp = t_0
else if (y <= 7.2d-99) then
tmp = x + (z * (x * (-6.0d0)))
else
tmp = x + (y * (6.0d0 * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x + (z * (y * 6.0));
double tmp;
if (y <= -235000000000.0) {
tmp = t_0;
} else if (y <= -7e-155) {
tmp = x + (x * (z * -6.0));
} else if (y <= -4.8e-171) {
tmp = t_0;
} else if (y <= 7.2e-99) {
tmp = x + (z * (x * -6.0));
} else {
tmp = x + (y * (6.0 * z));
}
return tmp;
}
def code(x, y, z): t_0 = x + (z * (y * 6.0)) tmp = 0 if y <= -235000000000.0: tmp = t_0 elif y <= -7e-155: tmp = x + (x * (z * -6.0)) elif y <= -4.8e-171: tmp = t_0 elif y <= 7.2e-99: tmp = x + (z * (x * -6.0)) else: tmp = x + (y * (6.0 * z)) return tmp
function code(x, y, z) t_0 = Float64(x + Float64(z * Float64(y * 6.0))) tmp = 0.0 if (y <= -235000000000.0) tmp = t_0; elseif (y <= -7e-155) tmp = Float64(x + Float64(x * Float64(z * -6.0))); elseif (y <= -4.8e-171) tmp = t_0; elseif (y <= 7.2e-99) tmp = Float64(x + Float64(z * Float64(x * -6.0))); else tmp = Float64(x + Float64(y * Float64(6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x + (z * (y * 6.0)); tmp = 0.0; if (y <= -235000000000.0) tmp = t_0; elseif (y <= -7e-155) tmp = x + (x * (z * -6.0)); elseif (y <= -4.8e-171) tmp = t_0; elseif (y <= 7.2e-99) tmp = x + (z * (x * -6.0)); else tmp = x + (y * (6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x + N[(z * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -235000000000.0], t$95$0, If[LessEqual[y, -7e-155], N[(x + N[(x * N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.8e-171], t$95$0, If[LessEqual[y, 7.2e-99], N[(x + N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x + z \cdot \left(y \cdot 6\right)\\
\mathbf{if}\;y \leq -235000000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq -7 \cdot 10^{-155}:\\
\;\;\;\;x + x \cdot \left(z \cdot -6\right)\\
\mathbf{elif}\;y \leq -4.8 \cdot 10^{-171}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 7.2 \cdot 10^{-99}:\\
\;\;\;\;x + z \cdot \left(x \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if y < -2.35e11 or -7.00000000000000031e-155 < y < -4.79999999999999974e-171Initial program 99.8%
Taylor expanded in y around inf 95.5%
if -2.35e11 < y < -7.00000000000000031e-155Initial program 99.7%
Taylor expanded in y around 0 82.2%
*-commutative82.2%
associate-*r*82.2%
*-commutative82.2%
Simplified82.2%
if -4.79999999999999974e-171 < y < 7.2000000000000001e-99Initial program 99.9%
Taylor expanded in y around 0 95.0%
associate-*r*95.1%
Simplified95.1%
if 7.2000000000000001e-99 < y Initial program 99.8%
Taylor expanded in y around inf 95.4%
*-commutative95.4%
Simplified95.4%
add-sqr-sqrt50.2%
pow250.2%
associate-*r*50.2%
*-commutative50.2%
Applied egg-rr50.2%
unpow250.2%
add-sqr-sqrt95.4%
*-commutative95.4%
Applied egg-rr95.4%
Final simplification93.0%
(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 (* -6.0 (* x z))))
double code(double x, double y, double z) {
return x + (-6.0 * (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) * (x * z))
end function
public static double code(double x, double y, double z) {
return x + (-6.0 * (x * z));
}
def code(x, y, z): return x + (-6.0 * (x * z))
function code(x, y, z) return Float64(x + Float64(-6.0 * Float64(x * z))) end
function tmp = code(x, y, z) tmp = x + (-6.0 * (x * z)); end
code[x_, y_, z_] := N[(x + N[(-6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + -6 \cdot \left(x \cdot z\right)
\end{array}
Initial program 99.8%
Taylor expanded in y around 0 64.9%
Final simplification64.9%
(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 40.2%
Final simplification40.2%
(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 2024019
(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)))