
(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 12 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 (* 6.0 (* z (- y x)))))
double code(double x, double y, double z) {
return x + (6.0 * (z * (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 + (6.0d0 * (z * (y - x)))
end function
public static double code(double x, double y, double z) {
return x + (6.0 * (z * (y - x)));
}
def code(x, y, z): return x + (6.0 * (z * (y - x)))
function code(x, y, z) return Float64(x + Float64(6.0 * Float64(z * Float64(y - x)))) end
function tmp = code(x, y, z) tmp = x + (6.0 * (z * (y - x))); end
code[x_, y_, z_] := N[(x + N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + 6 \cdot \left(z \cdot \left(y - x\right)\right)
\end{array}
Initial program 99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z x))))
(if (<= z -0.165)
t_0
(if (<= z 3e-24)
x
(if (or (<= z 2.8e+60) (and (not (<= z 6.4e+135)) (<= z 2.4e+226)))
(* 6.0 (* z y))
t_0)))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (z * x);
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 3e-24) {
tmp = x;
} else if ((z <= 2.8e+60) || (!(z <= 6.4e+135) && (z <= 2.4e+226))) {
tmp = 6.0 * (z * y);
} 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) * (z * x)
if (z <= (-0.165d0)) then
tmp = t_0
else if (z <= 3d-24) then
tmp = x
else if ((z <= 2.8d+60) .or. (.not. (z <= 6.4d+135)) .and. (z <= 2.4d+226)) then
tmp = 6.0d0 * (z * y)
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 * (z * x);
double tmp;
if (z <= -0.165) {
tmp = t_0;
} else if (z <= 3e-24) {
tmp = x;
} else if ((z <= 2.8e+60) || (!(z <= 6.4e+135) && (z <= 2.4e+226))) {
tmp = 6.0 * (z * y);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (z * x) tmp = 0 if z <= -0.165: tmp = t_0 elif z <= 3e-24: tmp = x elif (z <= 2.8e+60) or (not (z <= 6.4e+135) and (z <= 2.4e+226)): tmp = 6.0 * (z * y) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * x)) tmp = 0.0 if (z <= -0.165) tmp = t_0; elseif (z <= 3e-24) tmp = x; elseif ((z <= 2.8e+60) || (!(z <= 6.4e+135) && (z <= 2.4e+226))) tmp = Float64(6.0 * Float64(z * y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (z * x); tmp = 0.0; if (z <= -0.165) tmp = t_0; elseif (z <= 3e-24) tmp = x; elseif ((z <= 2.8e+60) || (~((z <= 6.4e+135)) && (z <= 2.4e+226))) tmp = 6.0 * (z * y); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.165], t$95$0, If[LessEqual[z, 3e-24], x, If[Or[LessEqual[z, 2.8e+60], And[N[Not[LessEqual[z, 6.4e+135]], $MachinePrecision], LessEqual[z, 2.4e+226]]], N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot x\right)\\
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-24}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+60} \lor \neg \left(z \leq 6.4 \cdot 10^{+135}\right) \land z \leq 2.4 \cdot 10^{+226}:\\
\;\;\;\;6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 2.8e60 < z < 6.3999999999999995e135 or 2.4e226 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.8%
Taylor expanded in y around 0 64.9%
if -0.165000000000000008 < z < 2.99999999999999995e-24Initial program 99.9%
Taylor expanded in z around 0 71.4%
if 2.99999999999999995e-24 < z < 2.8e60 or 6.3999999999999995e135 < z < 2.4e226Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 97.2%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
Final simplification69.5%
(FPCore (x y z)
:precision binary64
(if (<= z -0.165)
(* z (* x -6.0))
(if (<= z 4.8e-24)
x
(if (or (<= z 2.2e+60) (and (not (<= z 4.6e+138)) (<= z 2.4e+226)))
(* 6.0 (* z y))
(* -6.0 (* z x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = z * (x * -6.0);
} else if (z <= 4.8e-24) {
tmp = x;
} else if ((z <= 2.2e+60) || (!(z <= 4.6e+138) && (z <= 2.4e+226))) {
tmp = 6.0 * (z * y);
} else {
tmp = -6.0 * (z * 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 <= (-0.165d0)) then
tmp = z * (x * (-6.0d0))
else if (z <= 4.8d-24) then
tmp = x
else if ((z <= 2.2d+60) .or. (.not. (z <= 4.6d+138)) .and. (z <= 2.4d+226)) then
tmp = 6.0d0 * (z * y)
else
tmp = (-6.0d0) * (z * x)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = z * (x * -6.0);
} else if (z <= 4.8e-24) {
tmp = x;
} else if ((z <= 2.2e+60) || (!(z <= 4.6e+138) && (z <= 2.4e+226))) {
tmp = 6.0 * (z * y);
} else {
tmp = -6.0 * (z * x);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.165: tmp = z * (x * -6.0) elif z <= 4.8e-24: tmp = x elif (z <= 2.2e+60) or (not (z <= 4.6e+138) and (z <= 2.4e+226)): tmp = 6.0 * (z * y) else: tmp = -6.0 * (z * x) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.165) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= 4.8e-24) tmp = x; elseif ((z <= 2.2e+60) || (!(z <= 4.6e+138) && (z <= 2.4e+226))) tmp = Float64(6.0 * Float64(z * y)); else tmp = Float64(-6.0 * Float64(z * x)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.165) tmp = z * (x * -6.0); elseif (z <= 4.8e-24) tmp = x; elseif ((z <= 2.2e+60) || (~((z <= 4.6e+138)) && (z <= 2.4e+226))) tmp = 6.0 * (z * y); else tmp = -6.0 * (z * x); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-24], x, If[Or[LessEqual[z, 2.2e+60], And[N[Not[LessEqual[z, 4.6e+138]], $MachinePrecision], LessEqual[z, 2.4e+226]]], N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-24}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+60} \lor \neg \left(z \leq 4.6 \cdot 10^{+138}\right) \land z \leq 2.4 \cdot 10^{+226}:\\
\;\;\;\;6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(z \cdot x\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.2%
*-commutative98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in y around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -0.165000000000000008 < z < 4.7999999999999996e-24Initial program 99.9%
Taylor expanded in z around 0 71.4%
if 4.7999999999999996e-24 < z < 2.19999999999999996e60 or 4.60000000000000015e138 < z < 2.4e226Initial program 99.8%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 97.2%
Taylor expanded in y around inf 74.0%
*-commutative74.0%
Simplified74.0%
if 2.19999999999999996e60 < z < 4.60000000000000015e138 or 2.4e226 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 70.5%
Final simplification69.5%
(FPCore (x y z)
:precision binary64
(if (<= z -0.165)
(* z (* x -6.0))
(if (<= z 1.02e-23)
x
(if (<= z 3.8e+60)
(* 6.0 (* z y))
(if (or (<= z 7.4e+136) (not (<= z 2.9e+226)))
(* -6.0 (* z x))
(* z (* 6.0 y)))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = z * (x * -6.0);
} else if (z <= 1.02e-23) {
tmp = x;
} else if (z <= 3.8e+60) {
tmp = 6.0 * (z * y);
} else if ((z <= 7.4e+136) || !(z <= 2.9e+226)) {
tmp = -6.0 * (z * x);
} else {
tmp = z * (6.0 * y);
}
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.165d0)) then
tmp = z * (x * (-6.0d0))
else if (z <= 1.02d-23) then
tmp = x
else if (z <= 3.8d+60) then
tmp = 6.0d0 * (z * y)
else if ((z <= 7.4d+136) .or. (.not. (z <= 2.9d+226))) then
tmp = (-6.0d0) * (z * x)
else
tmp = z * (6.0d0 * y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = z * (x * -6.0);
} else if (z <= 1.02e-23) {
tmp = x;
} else if (z <= 3.8e+60) {
tmp = 6.0 * (z * y);
} else if ((z <= 7.4e+136) || !(z <= 2.9e+226)) {
tmp = -6.0 * (z * x);
} else {
tmp = z * (6.0 * y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.165: tmp = z * (x * -6.0) elif z <= 1.02e-23: tmp = x elif z <= 3.8e+60: tmp = 6.0 * (z * y) elif (z <= 7.4e+136) or not (z <= 2.9e+226): tmp = -6.0 * (z * x) else: tmp = z * (6.0 * y) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.165) tmp = Float64(z * Float64(x * -6.0)); elseif (z <= 1.02e-23) tmp = x; elseif (z <= 3.8e+60) tmp = Float64(6.0 * Float64(z * y)); elseif ((z <= 7.4e+136) || !(z <= 2.9e+226)) tmp = Float64(-6.0 * Float64(z * x)); else tmp = Float64(z * Float64(6.0 * y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.165) tmp = z * (x * -6.0); elseif (z <= 1.02e-23) tmp = x; elseif (z <= 3.8e+60) tmp = 6.0 * (z * y); elseif ((z <= 7.4e+136) || ~((z <= 2.9e+226))) tmp = -6.0 * (z * x); else tmp = z * (6.0 * y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(z * N[(x * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-23], x, If[LessEqual[z, 3.8e+60], N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 7.4e+136], N[Not[LessEqual[z, 2.9e+226]], $MachinePrecision]], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision], N[(z * N[(6.0 * y), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;z \cdot \left(x \cdot -6\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{+60}:\\
\;\;\;\;6 \cdot \left(z \cdot y\right)\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{+136} \lor \neg \left(z \leq 2.9 \cdot 10^{+226}\right):\\
\;\;\;\;-6 \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot y\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.2%
*-commutative98.2%
associate-*r*98.2%
*-commutative98.2%
Simplified98.2%
Taylor expanded in y around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -0.165000000000000008 < z < 1.02000000000000005e-23Initial program 99.9%
Taylor expanded in z around 0 71.4%
if 1.02000000000000005e-23 < z < 3.80000000000000009e60Initial program 99.6%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 93.4%
Taylor expanded in y around inf 79.3%
*-commutative79.3%
Simplified79.3%
if 3.80000000000000009e60 < z < 7.4000000000000002e136 or 2.89999999999999974e226 < z Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 70.5%
if 7.4000000000000002e136 < z < 2.89999999999999974e226Initial program 99.9%
Taylor expanded in z around 0 99.6%
Taylor expanded in z around inf 99.6%
Taylor expanded in y around inf 70.7%
associate-*r*70.8%
Simplified70.8%
Final simplification69.5%
(FPCore (x y z) :precision binary64 (if (or (<= z -8.2e-48) (not (<= z 8e-24))) (* 6.0 (* z (- y x))) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -8.2e-48) || !(z <= 8e-24)) {
tmp = 6.0 * (z * (y - x));
} 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.2d-48)) .or. (.not. (z <= 8d-24))) then
tmp = 6.0d0 * (z * (y - x))
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -8.2e-48) || !(z <= 8e-24)) {
tmp = 6.0 * (z * (y - x));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -8.2e-48) or not (z <= 8e-24): tmp = 6.0 * (z * (y - x)) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -8.2e-48) || !(z <= 8e-24)) tmp = Float64(6.0 * Float64(z * Float64(y - x))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -8.2e-48) || ~((z <= 8e-24))) tmp = 6.0 * (z * (y - x)); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -8.2e-48], N[Not[LessEqual[z, 8e-24]], $MachinePrecision]], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-48} \lor \neg \left(z \leq 8 \cdot 10^{-24}\right):\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -8.20000000000000028e-48 or 7.99999999999999939e-24 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 96.3%
if -8.20000000000000028e-48 < z < 7.99999999999999939e-24Initial program 99.9%
Taylor expanded in z around 0 73.4%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (<= z -7.9e-35) (* 6.0 (* z (- y x))) (if (<= z 2.45e-23) x (* z (* 6.0 (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.9e-35) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 2.45e-23) {
tmp = x;
} else {
tmp = z * (6.0 * (y - 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 <= (-7.9d-35)) then
tmp = 6.0d0 * (z * (y - x))
else if (z <= 2.45d-23) then
tmp = x
else
tmp = z * (6.0d0 * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -7.9e-35) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 2.45e-23) {
tmp = x;
} else {
tmp = z * (6.0 * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.9e-35: tmp = 6.0 * (z * (y - x)) elif z <= 2.45e-23: tmp = x else: tmp = z * (6.0 * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.9e-35) tmp = Float64(6.0 * Float64(z * Float64(y - x))); elseif (z <= 2.45e-23) tmp = x; else tmp = Float64(z * Float64(6.0 * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.9e-35) tmp = 6.0 * (z * (y - x)); elseif (z <= 2.45e-23) tmp = x; else tmp = z * (6.0 * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.9e-35], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.45e-23], x, N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.9 \cdot 10^{-35}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{-23}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -7.89999999999999983e-35Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 94.0%
if -7.89999999999999983e-35 < z < 2.4499999999999999e-23Initial program 99.9%
Taylor expanded in z around 0 73.4%
if 2.4499999999999999e-23 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 98.3%
*-commutative98.3%
associate-*r*98.4%
*-commutative98.4%
Simplified98.4%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (<= z -8.2e-45) (* 6.0 (* z (- y x))) (if (<= z 1.25e-9) (* x (+ 1.0 (* z -6.0))) (* z (* 6.0 (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e-45) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 1.25e-9) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * (6.0 * (y - 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.2d-45)) then
tmp = 6.0d0 * (z * (y - x))
else if (z <= 1.25d-9) then
tmp = x * (1.0d0 + (z * (-6.0d0)))
else
tmp = z * (6.0d0 * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -8.2e-45) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 1.25e-9) {
tmp = x * (1.0 + (z * -6.0));
} else {
tmp = z * (6.0 * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -8.2e-45: tmp = 6.0 * (z * (y - x)) elif z <= 1.25e-9: tmp = x * (1.0 + (z * -6.0)) else: tmp = z * (6.0 * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -8.2e-45) tmp = Float64(6.0 * Float64(z * Float64(y - x))); elseif (z <= 1.25e-9) tmp = Float64(x * Float64(1.0 + Float64(z * -6.0))); else tmp = Float64(z * Float64(6.0 * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -8.2e-45) tmp = 6.0 * (z * (y - x)); elseif (z <= 1.25e-9) tmp = x * (1.0 + (z * -6.0)); else tmp = z * (6.0 * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -8.2e-45], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.25e-9], N[(x * N[(1.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.2 \cdot 10^{-45}:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 1.25 \cdot 10^{-9}:\\
\;\;\;\;x \cdot \left(1 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -8.1999999999999998e-45Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 94.0%
if -8.1999999999999998e-45 < z < 1.25e-9Initial program 99.9%
Taylor expanded in x around inf 73.0%
if 1.25e-9 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification85.8%
(FPCore (x y z) :precision binary64 (if (<= z -0.165) (* 6.0 (* z (- y x))) (if (<= z 3600000.0) (+ x (* 6.0 (* z y))) (* z (* 6.0 (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 3600000.0) {
tmp = x + (6.0 * (z * y));
} else {
tmp = z * (6.0 * (y - 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 <= (-0.165d0)) then
tmp = 6.0d0 * (z * (y - x))
else if (z <= 3600000.0d0) then
tmp = x + (6.0d0 * (z * y))
else
tmp = z * (6.0d0 * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.165) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 3600000.0) {
tmp = x + (6.0 * (z * y));
} else {
tmp = z * (6.0 * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.165: tmp = 6.0 * (z * (y - x)) elif z <= 3600000.0: tmp = x + (6.0 * (z * y)) else: tmp = z * (6.0 * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.165) tmp = Float64(6.0 * Float64(z * Float64(y - x))); elseif (z <= 3600000.0) tmp = Float64(x + Float64(6.0 * Float64(z * y))); else tmp = Float64(z * Float64(6.0 * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.165) tmp = 6.0 * (z * (y - x)); elseif (z <= 3600000.0) tmp = x + (6.0 * (z * y)); else tmp = z * (6.0 * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.165], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3600000.0], N[(x + N[(6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 3600000:\\
\;\;\;\;x + 6 \cdot \left(z \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -0.165000000000000008Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.2%
if -0.165000000000000008 < z < 3.6e6Initial program 99.8%
Taylor expanded in y around inf 99.4%
if 3.6e6 < z Initial program 99.8%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
associate-*r*99.8%
*-commutative99.8%
Simplified99.8%
Final simplification99.2%
(FPCore (x y z) :precision binary64 (if (<= z -0.16) (* 6.0 (* z (- y x))) (if (<= z 0.0045) (+ x (* y (* 6.0 z))) (* z (* 6.0 (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 0.0045) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * (6.0 * (y - 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 <= (-0.16d0)) then
tmp = 6.0d0 * (z * (y - x))
else if (z <= 0.0045d0) then
tmp = x + (y * (6.0d0 * z))
else
tmp = z * (6.0d0 * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.16) {
tmp = 6.0 * (z * (y - x));
} else if (z <= 0.0045) {
tmp = x + (y * (6.0 * z));
} else {
tmp = z * (6.0 * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.16: tmp = 6.0 * (z * (y - x)) elif z <= 0.0045: tmp = x + (y * (6.0 * z)) else: tmp = z * (6.0 * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.16) tmp = Float64(6.0 * Float64(z * Float64(y - x))); elseif (z <= 0.0045) tmp = Float64(x + Float64(y * Float64(6.0 * z))); else tmp = Float64(z * Float64(6.0 * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.16) tmp = 6.0 * (z * (y - x)); elseif (z <= 0.0045) tmp = x + (y * (6.0 * z)); else tmp = z * (6.0 * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.16], N[(6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0045], N[(x + N[(y * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 0.0045:\\
\;\;\;\;x + y \cdot \left(6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -0.160000000000000003Initial program 99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.2%
if -0.160000000000000003 < z < 0.00449999999999999966Initial program 99.9%
associate-*r*99.9%
*-commutative99.9%
flip--54.1%
associate-*r/52.8%
Applied egg-rr52.8%
associate-/l*54.1%
*-commutative54.1%
associate-/l*54.1%
difference-of-squares54.5%
associate-/r*99.8%
*-inverses99.8%
Simplified99.8%
Taylor expanded in y around inf 99.4%
associate-*r*99.4%
*-commutative99.4%
associate-*r*99.5%
Simplified99.5%
if 0.00449999999999999966 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
*-commutative99.7%
associate-*r*99.7%
*-commutative99.7%
Simplified99.7%
Final simplification99.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.165) (not (<= z 300000.0))) (* -6.0 (* z x)) x))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 300000.0)) {
tmp = -6.0 * (z * x);
} 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 <= (-0.165d0)) .or. (.not. (z <= 300000.0d0))) then
tmp = (-6.0d0) * (z * x)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.165) || !(z <= 300000.0)) {
tmp = -6.0 * (z * x);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.165) or not (z <= 300000.0): tmp = -6.0 * (z * x) else: tmp = x return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.165) || !(z <= 300000.0)) tmp = Float64(-6.0 * Float64(z * x)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.165) || ~((z <= 300000.0))) tmp = -6.0 * (z * x); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.165], N[Not[LessEqual[z, 300000.0]], $MachinePrecision]], N[(-6.0 * N[(z * x), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.165 \lor \neg \left(z \leq 300000\right):\\
\;\;\;\;-6 \cdot \left(z \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -0.165000000000000008 or 3e5 < z Initial program 99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.0%
Taylor expanded in y around 0 54.2%
if -0.165000000000000008 < z < 3e5Initial program 99.9%
Taylor expanded in z around 0 69.3%
Final simplification61.8%
(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 36.4%
Final simplification36.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 2023195
(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)))