
(FPCore (x y z) :precision binary64 (+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.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) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\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) (- (/ 2.0 3.0) z))))
double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.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) * ((2.0d0 / 3.0d0) - z))
end function
public static double code(double x, double y, double z) {
return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z));
}
def code(x, y, z): return x + (((y - x) * 6.0) * ((2.0 / 3.0) - z))
function code(x, y, z) return Float64(x + Float64(Float64(Float64(y - x) * 6.0) * Float64(Float64(2.0 / 3.0) - z))) end
function tmp = code(x, y, z) tmp = x + (((y - x) * 6.0) * ((2.0 / 3.0) - z)); end
code[x_, y_, z_] := N[(x + N[(N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(N[(2.0 / 3.0), $MachinePrecision] - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(\frac{2}{3} - z\right)
\end{array}
(FPCore (x y z) :precision binary64 (+ x (+ (* -6.0 (* z (- y x))) (* (- y x) 4.0))))
double code(double x, double y, double z) {
return x + ((-6.0 * (z * (y - x))) + ((y - x) * 4.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 + (((-6.0d0) * (z * (y - x))) + ((y - x) * 4.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((-6.0 * (z * (y - x))) + ((y - x) * 4.0));
}
def code(x, y, z): return x + ((-6.0 * (z * (y - x))) + ((y - x) * 4.0))
function code(x, y, z) return Float64(x + Float64(Float64(-6.0 * Float64(z * Float64(y - x))) + Float64(Float64(y - x) * 4.0))) end
function tmp = code(x, y, z) tmp = x + ((-6.0 * (z * (y - x))) + ((y - x) * 4.0)); end
code[x_, y_, z_] := N[(x + N[(N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-6 \cdot \left(z \cdot \left(y - x\right)\right) + \left(y - x\right) \cdot 4\right)
\end{array}
Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z (- y x)))))
(if (<= z -6.2e-12)
t_0
(if (<= z -6.4e-260)
(* x -3.0)
(if (<= z -2.5e-288) (* y 4.0) (if (<= z 0.5) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (z * (y - x));
double tmp;
if (z <= -6.2e-12) {
tmp = t_0;
} else if (z <= -6.4e-260) {
tmp = x * -3.0;
} else if (z <= -2.5e-288) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.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) * (z * (y - x))
if (z <= (-6.2d-12)) then
tmp = t_0
else if (z <= (-6.4d-260)) then
tmp = x * (-3.0d0)
else if (z <= (-2.5d-288)) then
tmp = y * 4.0d0
else if (z <= 0.5d0) then
tmp = x * (-3.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 * (z * (y - x));
double tmp;
if (z <= -6.2e-12) {
tmp = t_0;
} else if (z <= -6.4e-260) {
tmp = x * -3.0;
} else if (z <= -2.5e-288) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (z * (y - x)) tmp = 0 if z <= -6.2e-12: tmp = t_0 elif z <= -6.4e-260: tmp = x * -3.0 elif z <= -2.5e-288: tmp = y * 4.0 elif z <= 0.5: tmp = x * -3.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * Float64(y - x))) tmp = 0.0 if (z <= -6.2e-12) tmp = t_0; elseif (z <= -6.4e-260) tmp = Float64(x * -3.0); elseif (z <= -2.5e-288) tmp = Float64(y * 4.0); elseif (z <= 0.5) tmp = Float64(x * -3.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (z * (y - x)); tmp = 0.0; if (z <= -6.2e-12) tmp = t_0; elseif (z <= -6.4e-260) tmp = x * -3.0; elseif (z <= -2.5e-288) tmp = y * 4.0; elseif (z <= 0.5) tmp = x * -3.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6.2e-12], t$95$0, If[LessEqual[z, -6.4e-260], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -2.5e-288], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -6.2 \cdot 10^{-12}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6.4 \cdot 10^{-260}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-288}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -6.2000000000000002e-12 or 0.5 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 95.6%
if -6.2000000000000002e-12 < z < -6.3999999999999999e-260 or -2.50000000000000005e-288 < z < 0.5Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around inf 58.1%
*-commutative58.1%
Simplified58.1%
if -6.3999999999999999e-260 < z < -2.50000000000000005e-288Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.9%
Taylor expanded in x around 0 79.2%
*-commutative79.2%
Simplified79.2%
Final simplification76.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (- (* z 6.0) 3.0))) (t_1 (* -6.0 (* z (- y x)))))
(if (<= z -440000.0)
t_1
(if (<= z -1.04e-259)
t_0
(if (<= z -4.5e-290) (* y 4.0) (if (<= z 136000.0) t_0 t_1))))))
double code(double x, double y, double z) {
double t_0 = x * ((z * 6.0) - 3.0);
double t_1 = -6.0 * (z * (y - x));
double tmp;
if (z <= -440000.0) {
tmp = t_1;
} else if (z <= -1.04e-259) {
tmp = t_0;
} else if (z <= -4.5e-290) {
tmp = y * 4.0;
} else if (z <= 136000.0) {
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) - 3.0d0)
t_1 = (-6.0d0) * (z * (y - x))
if (z <= (-440000.0d0)) then
tmp = t_1
else if (z <= (-1.04d-259)) then
tmp = t_0
else if (z <= (-4.5d-290)) then
tmp = y * 4.0d0
else if (z <= 136000.0d0) 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) - 3.0);
double t_1 = -6.0 * (z * (y - x));
double tmp;
if (z <= -440000.0) {
tmp = t_1;
} else if (z <= -1.04e-259) {
tmp = t_0;
} else if (z <= -4.5e-290) {
tmp = y * 4.0;
} else if (z <= 136000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * ((z * 6.0) - 3.0) t_1 = -6.0 * (z * (y - x)) tmp = 0 if z <= -440000.0: tmp = t_1 elif z <= -1.04e-259: tmp = t_0 elif z <= -4.5e-290: tmp = y * 4.0 elif z <= 136000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(Float64(z * 6.0) - 3.0)) t_1 = Float64(-6.0 * Float64(z * Float64(y - x))) tmp = 0.0 if (z <= -440000.0) tmp = t_1; elseif (z <= -1.04e-259) tmp = t_0; elseif (z <= -4.5e-290) tmp = Float64(y * 4.0); elseif (z <= 136000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * ((z * 6.0) - 3.0); t_1 = -6.0 * (z * (y - x)); tmp = 0.0; if (z <= -440000.0) tmp = t_1; elseif (z <= -1.04e-259) tmp = t_0; elseif (z <= -4.5e-290) tmp = y * 4.0; elseif (z <= 136000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(N[(z * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -440000.0], t$95$1, If[LessEqual[z, -1.04e-259], t$95$0, If[LessEqual[z, -4.5e-290], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 136000.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6 - 3\right)\\
t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -440000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.04 \cdot 10^{-259}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-290}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 136000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -4.4e5 or 136000 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.1%
if -4.4e5 < z < -1.03999999999999997e-259 or -4.5e-290 < z < 136000Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 59.4%
if -1.03999999999999997e-259 < z < -4.5e-290Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.9%
Taylor expanded in x around 0 79.2%
*-commutative79.2%
Simplified79.2%
Final simplification78.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z y))))
(if (<= z -1.7e+156)
t_0
(if (<= z -4.6e+73)
(* 6.0 (* x z))
(if (or (<= z -42000.0) (not (<= z 0.58))) t_0 (* x -3.0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (z * y);
double tmp;
if (z <= -1.7e+156) {
tmp = t_0;
} else if (z <= -4.6e+73) {
tmp = 6.0 * (x * z);
} else if ((z <= -42000.0) || !(z <= 0.58)) {
tmp = t_0;
} else {
tmp = x * -3.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 * y)
if (z <= (-1.7d+156)) then
tmp = t_0
else if (z <= (-4.6d+73)) then
tmp = 6.0d0 * (x * z)
else if ((z <= (-42000.0d0)) .or. (.not. (z <= 0.58d0))) then
tmp = t_0
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = -6.0 * (z * y);
double tmp;
if (z <= -1.7e+156) {
tmp = t_0;
} else if (z <= -4.6e+73) {
tmp = 6.0 * (x * z);
} else if ((z <= -42000.0) || !(z <= 0.58)) {
tmp = t_0;
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (z * y) tmp = 0 if z <= -1.7e+156: tmp = t_0 elif z <= -4.6e+73: tmp = 6.0 * (x * z) elif (z <= -42000.0) or not (z <= 0.58): tmp = t_0 else: tmp = x * -3.0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * y)) tmp = 0.0 if (z <= -1.7e+156) tmp = t_0; elseif (z <= -4.6e+73) tmp = Float64(6.0 * Float64(x * z)); elseif ((z <= -42000.0) || !(z <= 0.58)) tmp = t_0; else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (z * y); tmp = 0.0; if (z <= -1.7e+156) tmp = t_0; elseif (z <= -4.6e+73) tmp = 6.0 * (x * z); elseif ((z <= -42000.0) || ~((z <= 0.58))) tmp = t_0; else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e+156], t$95$0, If[LessEqual[z, -4.6e+73], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -42000.0], N[Not[LessEqual[z, 0.58]], $MachinePrecision]], t$95$0, N[(x * -3.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot y\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{+156}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -4.6 \cdot 10^{+73}:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -42000 \lor \neg \left(z \leq 0.58\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if z < -1.7e156 or -4.6e73 < z < -42000 or 0.57999999999999996 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around inf 61.3%
Taylor expanded in z around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -1.7e156 < z < -4.6e73Initial program 99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 99.8%
Taylor expanded in x around inf 79.5%
Taylor expanded in z around inf 79.5%
if -42000 < z < 0.57999999999999996Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 97.1%
Taylor expanded in x around inf 53.6%
*-commutative53.6%
Simplified53.6%
Final simplification57.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z y))))
(if (<= z -42000.0)
t_0
(if (<= z -3e-260)
(* x -3.0)
(if (<= z -3.3e-288) (* y 4.0) (if (<= z 0.55) (* x -3.0) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (z * y);
double tmp;
if (z <= -42000.0) {
tmp = t_0;
} else if (z <= -3e-260) {
tmp = x * -3.0;
} else if (z <= -3.3e-288) {
tmp = y * 4.0;
} else if (z <= 0.55) {
tmp = x * -3.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) * (z * y)
if (z <= (-42000.0d0)) then
tmp = t_0
else if (z <= (-3d-260)) then
tmp = x * (-3.0d0)
else if (z <= (-3.3d-288)) then
tmp = y * 4.0d0
else if (z <= 0.55d0) then
tmp = x * (-3.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 * (z * y);
double tmp;
if (z <= -42000.0) {
tmp = t_0;
} else if (z <= -3e-260) {
tmp = x * -3.0;
} else if (z <= -3.3e-288) {
tmp = y * 4.0;
} else if (z <= 0.55) {
tmp = x * -3.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (z * y) tmp = 0 if z <= -42000.0: tmp = t_0 elif z <= -3e-260: tmp = x * -3.0 elif z <= -3.3e-288: tmp = y * 4.0 elif z <= 0.55: tmp = x * -3.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(z * y)) tmp = 0.0 if (z <= -42000.0) tmp = t_0; elseif (z <= -3e-260) tmp = Float64(x * -3.0); elseif (z <= -3.3e-288) tmp = Float64(y * 4.0); elseif (z <= 0.55) tmp = Float64(x * -3.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (z * y); tmp = 0.0; if (z <= -42000.0) tmp = t_0; elseif (z <= -3e-260) tmp = x * -3.0; elseif (z <= -3.3e-288) tmp = y * 4.0; elseif (z <= 0.55) tmp = x * -3.0; else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -42000.0], t$95$0, If[LessEqual[z, -3e-260], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, -3.3e-288], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.55], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(z \cdot y\right)\\
\mathbf{if}\;z \leq -42000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-260}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq -3.3 \cdot 10^{-288}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.55:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -42000 or 0.55000000000000004 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in y around inf 57.6%
Taylor expanded in z around inf 57.1%
*-commutative57.1%
Simplified57.1%
if -42000 < z < -3.0000000000000001e-260 or -3.29999999999999988e-288 < z < 0.55000000000000004Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.9%
Taylor expanded in x around inf 56.4%
*-commutative56.4%
Simplified56.4%
if -3.0000000000000001e-260 < z < -3.29999999999999988e-288Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 99.9%
Taylor expanded in x around 0 79.2%
*-commutative79.2%
Simplified79.2%
Final simplification57.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.3e-69) (not (<= y 3e-27))) (* y (+ 4.0 (* -6.0 z))) (* x (- (* z 6.0) 3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e-69) || !(y <= 3e-27)) {
tmp = y * (4.0 + (-6.0 * z));
} else {
tmp = x * ((z * 6.0) - 3.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 <= (-1.3d-69)) .or. (.not. (y <= 3d-27))) then
tmp = y * (4.0d0 + ((-6.0d0) * z))
else
tmp = x * ((z * 6.0d0) - 3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.3e-69) || !(y <= 3e-27)) {
tmp = y * (4.0 + (-6.0 * z));
} else {
tmp = x * ((z * 6.0) - 3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.3e-69) or not (y <= 3e-27): tmp = y * (4.0 + (-6.0 * z)) else: tmp = x * ((z * 6.0) - 3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.3e-69) || !(y <= 3e-27)) tmp = Float64(y * Float64(4.0 + Float64(-6.0 * z))); else tmp = Float64(x * Float64(Float64(z * 6.0) - 3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.3e-69) || ~((y <= 3e-27))) tmp = y * (4.0 + (-6.0 * z)); else tmp = x * ((z * 6.0) - 3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.3e-69], N[Not[LessEqual[y, 3e-27]], $MachinePrecision]], N[(y * N[(4.0 + N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(z * 6.0), $MachinePrecision] - 3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.3 \cdot 10^{-69} \lor \neg \left(y \leq 3 \cdot 10^{-27}\right):\\
\;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 6 - 3\right)\\
\end{array}
\end{array}
if y < -1.3000000000000001e-69 or 3.0000000000000001e-27 < y Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around inf 81.4%
if -1.3000000000000001e-69 < y < 3.0000000000000001e-27Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 99.7%
Taylor expanded in x around inf 81.2%
Final simplification81.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.6) (not (<= z 0.54))) (* -6.0 (* z (- y x))) (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.6) || !(z <= 0.54)) {
tmp = -6.0 * (z * (y - x));
} else {
tmp = x + ((y - x) * 4.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.6d0)) .or. (.not. (z <= 0.54d0))) then
tmp = (-6.0d0) * (z * (y - x))
else
tmp = x + ((y - x) * 4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.6) || !(z <= 0.54)) {
tmp = -6.0 * (z * (y - x));
} else {
tmp = x + ((y - x) * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.6) or not (z <= 0.54): tmp = -6.0 * (z * (y - x)) else: tmp = x + ((y - x) * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.6) || !(z <= 0.54)) tmp = Float64(-6.0 * Float64(z * Float64(y - x))); else tmp = Float64(x + Float64(Float64(y - x) * 4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.6) || ~((z <= 0.54))) tmp = -6.0 * (z * (y - x)); else tmp = x + ((y - x) * 4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.6], N[Not[LessEqual[z, 0.54]], $MachinePrecision]], N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.6 \lor \neg \left(z \leq 0.54\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\end{array}
\end{array}
if z < -0.599999999999999978 or 0.54000000000000004 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 96.9%
if -0.599999999999999978 < z < 0.54000000000000004Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 98.9%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.54) (not (<= z 0.65))) (* -6.0 (* z (- y x))) (+ (* y 4.0) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.54) || !(z <= 0.65)) {
tmp = -6.0 * (z * (y - x));
} else {
tmp = (y * 4.0) + (x * -3.0);
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((z <= (-0.54d0)) .or. (.not. (z <= 0.65d0))) then
tmp = (-6.0d0) * (z * (y - x))
else
tmp = (y * 4.0d0) + (x * (-3.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.54) || !(z <= 0.65)) {
tmp = -6.0 * (z * (y - x));
} else {
tmp = (y * 4.0) + (x * -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.54) or not (z <= 0.65): tmp = -6.0 * (z * (y - x)) else: tmp = (y * 4.0) + (x * -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.54) || !(z <= 0.65)) tmp = Float64(-6.0 * Float64(z * Float64(y - x))); else tmp = Float64(Float64(y * 4.0) + Float64(x * -3.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.54) || ~((z <= 0.65))) tmp = -6.0 * (z * (y - x)); else tmp = (y * 4.0) + (x * -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.54], N[Not[LessEqual[z, 0.65]], $MachinePrecision]], N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * 4.0), $MachinePrecision] + N[(x * -3.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.54 \lor \neg \left(z \leq 0.65\right):\\
\;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\end{array}
\end{array}
if z < -0.54000000000000004 or 0.650000000000000022 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 96.9%
if -0.54000000000000004 < z < 0.650000000000000022Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 98.9%
Taylor expanded in x around 0 99.0%
Final simplification98.0%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.95e-76) (not (<= y 2.7e-38))) (* y 4.0) (* x -3.0)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.95e-76) || !(y <= 2.7e-38)) {
tmp = y * 4.0;
} else {
tmp = x * -3.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 <= (-1.95d-76)) .or. (.not. (y <= 2.7d-38))) then
tmp = y * 4.0d0
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.95e-76) || !(y <= 2.7e-38)) {
tmp = y * 4.0;
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.95e-76) or not (y <= 2.7e-38): tmp = y * 4.0 else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.95e-76) || !(y <= 2.7e-38)) tmp = Float64(y * 4.0); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.95e-76) || ~((y <= 2.7e-38))) tmp = y * 4.0; else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.95e-76], N[Not[LessEqual[y, 2.7e-38]], $MachinePrecision]], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.95 \cdot 10^{-76} \lor \neg \left(y \leq 2.7 \cdot 10^{-38}\right):\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if y < -1.95000000000000013e-76 or 2.70000000000000005e-38 < y Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 49.9%
Taylor expanded in x around 0 39.8%
*-commutative39.8%
Simplified39.8%
if -1.95000000000000013e-76 < y < 2.70000000000000005e-38Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 60.0%
Taylor expanded in x around inf 51.0%
*-commutative51.0%
Simplified51.0%
Final simplification45.0%
(FPCore (x y z) :precision binary64 (+ x (* (- 0.6666666666666666 z) (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + ((0.6666666666666666 - 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 + ((0.6666666666666666d0 - z) * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((0.6666666666666666 - z) * ((y - x) * 6.0));
}
def code(x, y, z): return x + ((0.6666666666666666 - z) * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(Float64(0.6666666666666666 - z) * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + ((0.6666666666666666 - z) * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (+ x (* (- y x) (* 6.0 (- 0.6666666666666666 z)))))
double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * (0.6666666666666666 - 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 * (0.6666666666666666d0 - z)))
end function
public static double code(double x, double y, double z) {
return x + ((y - x) * (6.0 * (0.6666666666666666 - z)));
}
def code(x, y, z): return x + ((y - x) * (6.0 * (0.6666666666666666 - z)))
function code(x, y, z) return Float64(x + Float64(Float64(y - x) * Float64(6.0 * Float64(0.6666666666666666 - z)))) end
function tmp = code(x, y, z) tmp = x + ((y - x) * (6.0 * (0.6666666666666666 - z))); end
code[x_, y_, z_] := N[(x + N[(N[(y - x), $MachinePrecision] * N[(6.0 * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(y - x\right) \cdot \left(6 \cdot \left(0.6666666666666666 - z\right)\right)
\end{array}
Initial program 99.6%
+-commutative99.6%
associate-*l*99.7%
fma-define99.7%
metadata-eval99.7%
Simplified99.7%
fma-undefine99.7%
Applied egg-rr99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (* x -3.0))
double code(double x, double y, double z) {
return x * -3.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 * (-3.0d0)
end function
public static double code(double x, double y, double z) {
return x * -3.0;
}
def code(x, y, z): return x * -3.0
function code(x, y, z) return Float64(x * -3.0) end
function tmp = code(x, y, z) tmp = x * -3.0; end
code[x_, y_, z_] := N[(x * -3.0), $MachinePrecision]
\begin{array}{l}
\\
x \cdot -3
\end{array}
Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 54.6%
Taylor expanded in x around inf 30.6%
*-commutative30.6%
Simplified30.6%
Final simplification30.6%
herbie shell --seed 2024066
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSL:hsl from colour-2.3.3, D"
:precision binary64
(+ x (* (* (- y x) 6.0) (- (/ 2.0 3.0) z))))