
(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 (* x (+ -3.0 (* z 6.0)))) (t_1 (* -6.0 (* z (- y x)))))
(if (<= z -1850000000000.0)
t_1
(if (<= z -5.5e-45)
t_0
(if (<= z -1.22e-204)
(* y 4.0)
(if (<= z -1.05e-304)
(* x -3.0)
(if (<= z 1.1e-170)
(* y 4.0)
(if (<= z 85000000000.0) t_0 t_1))))))))
double code(double x, double y, double z) {
double t_0 = x * (-3.0 + (z * 6.0));
double t_1 = -6.0 * (z * (y - x));
double tmp;
if (z <= -1850000000000.0) {
tmp = t_1;
} else if (z <= -5.5e-45) {
tmp = t_0;
} else if (z <= -1.22e-204) {
tmp = y * 4.0;
} else if (z <= -1.05e-304) {
tmp = x * -3.0;
} else if (z <= 1.1e-170) {
tmp = y * 4.0;
} else if (z <= 85000000000.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 * ((-3.0d0) + (z * 6.0d0))
t_1 = (-6.0d0) * (z * (y - x))
if (z <= (-1850000000000.0d0)) then
tmp = t_1
else if (z <= (-5.5d-45)) then
tmp = t_0
else if (z <= (-1.22d-204)) then
tmp = y * 4.0d0
else if (z <= (-1.05d-304)) then
tmp = x * (-3.0d0)
else if (z <= 1.1d-170) then
tmp = y * 4.0d0
else if (z <= 85000000000.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 * (-3.0 + (z * 6.0));
double t_1 = -6.0 * (z * (y - x));
double tmp;
if (z <= -1850000000000.0) {
tmp = t_1;
} else if (z <= -5.5e-45) {
tmp = t_0;
} else if (z <= -1.22e-204) {
tmp = y * 4.0;
} else if (z <= -1.05e-304) {
tmp = x * -3.0;
} else if (z <= 1.1e-170) {
tmp = y * 4.0;
} else if (z <= 85000000000.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = x * (-3.0 + (z * 6.0)) t_1 = -6.0 * (z * (y - x)) tmp = 0 if z <= -1850000000000.0: tmp = t_1 elif z <= -5.5e-45: tmp = t_0 elif z <= -1.22e-204: tmp = y * 4.0 elif z <= -1.05e-304: tmp = x * -3.0 elif z <= 1.1e-170: tmp = y * 4.0 elif z <= 85000000000.0: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(-3.0 + Float64(z * 6.0))) t_1 = Float64(-6.0 * Float64(z * Float64(y - x))) tmp = 0.0 if (z <= -1850000000000.0) tmp = t_1; elseif (z <= -5.5e-45) tmp = t_0; elseif (z <= -1.22e-204) tmp = Float64(y * 4.0); elseif (z <= -1.05e-304) tmp = Float64(x * -3.0); elseif (z <= 1.1e-170) tmp = Float64(y * 4.0); elseif (z <= 85000000000.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (-3.0 + (z * 6.0)); t_1 = -6.0 * (z * (y - x)); tmp = 0.0; if (z <= -1850000000000.0) tmp = t_1; elseif (z <= -5.5e-45) tmp = t_0; elseif (z <= -1.22e-204) tmp = y * 4.0; elseif (z <= -1.05e-304) tmp = x * -3.0; elseif (z <= 1.1e-170) tmp = y * 4.0; elseif (z <= 85000000000.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1850000000000.0], t$95$1, If[LessEqual[z, -5.5e-45], t$95$0, If[LessEqual[z, -1.22e-204], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.05e-304], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.1e-170], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 85000000000.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(-3 + z \cdot 6\right)\\
t_1 := -6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\mathbf{if}\;z \leq -1850000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -5.5 \cdot 10^{-45}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.22 \cdot 10^{-204}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-304}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-170}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 85000000000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.85e12 or 8.5e10 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 99.7%
if -1.85e12 < z < -5.5000000000000003e-45 or 1.10000000000000007e-170 < z < 8.5e10Initial program 99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around inf 66.1%
sub-neg66.1%
distribute-rgt-in66.2%
metadata-eval66.2%
metadata-eval66.2%
distribute-lft-neg-in66.2%
associate-+r+66.2%
metadata-eval66.2%
metadata-eval66.2%
distribute-rgt-neg-in66.2%
metadata-eval66.2%
Simplified66.2%
if -5.5000000000000003e-45 < z < -1.22000000000000005e-204 or -1.05000000000000004e-304 < z < 1.10000000000000007e-170Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around 0 63.9%
if -1.22000000000000005e-204 < z < -1.05000000000000004e-304Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 76.4%
sub-neg76.4%
distribute-rgt-in76.4%
metadata-eval76.4%
metadata-eval76.4%
distribute-lft-neg-in76.4%
associate-+r+76.4%
metadata-eval76.4%
metadata-eval76.4%
distribute-rgt-neg-in76.4%
metadata-eval76.4%
Simplified76.4%
Taylor expanded in z around 0 76.4%
*-commutative76.4%
Simplified76.4%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* z (- y x)))))
(if (<= z -5.8e-28)
t_0
(if (<= z -1.9e-201)
(* y 4.0)
(if (<= z -1.05e-304)
(* x -3.0)
(if (<= z 1.02e-171) (* 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 <= -5.8e-28) {
tmp = t_0;
} else if (z <= -1.9e-201) {
tmp = y * 4.0;
} else if (z <= -1.05e-304) {
tmp = x * -3.0;
} else if (z <= 1.02e-171) {
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 <= (-5.8d-28)) then
tmp = t_0
else if (z <= (-1.9d-201)) then
tmp = y * 4.0d0
else if (z <= (-1.05d-304)) then
tmp = x * (-3.0d0)
else if (z <= 1.02d-171) 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 <= -5.8e-28) {
tmp = t_0;
} else if (z <= -1.9e-201) {
tmp = y * 4.0;
} else if (z <= -1.05e-304) {
tmp = x * -3.0;
} else if (z <= 1.02e-171) {
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 <= -5.8e-28: tmp = t_0 elif z <= -1.9e-201: tmp = y * 4.0 elif z <= -1.05e-304: tmp = x * -3.0 elif z <= 1.02e-171: 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 <= -5.8e-28) tmp = t_0; elseif (z <= -1.9e-201) tmp = Float64(y * 4.0); elseif (z <= -1.05e-304) tmp = Float64(x * -3.0); elseif (z <= 1.02e-171) 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 <= -5.8e-28) tmp = t_0; elseif (z <= -1.9e-201) tmp = y * 4.0; elseif (z <= -1.05e-304) tmp = x * -3.0; elseif (z <= 1.02e-171) 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, -5.8e-28], t$95$0, If[LessEqual[z, -1.9e-201], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.05e-304], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.02e-171], 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 -5.8 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.9 \cdot 10^{-201}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-304}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-171}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -5.80000000000000026e-28 or 0.5 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 94.3%
if -5.80000000000000026e-28 < z < -1.9e-201 or -1.05000000000000004e-304 < z < 1.02e-171Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around 0 63.9%
if -1.9e-201 < z < -1.05000000000000004e-304 or 1.02e-171 < z < 0.5Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 66.4%
sub-neg66.4%
distribute-rgt-in66.4%
metadata-eval66.4%
metadata-eval66.4%
distribute-lft-neg-in66.4%
associate-+r+66.4%
metadata-eval66.4%
metadata-eval66.4%
distribute-rgt-neg-in66.4%
metadata-eval66.4%
Simplified66.4%
Taylor expanded in z around 0 63.6%
*-commutative63.6%
Simplified63.6%
Final simplification80.1%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z 6.0))))
(if (<= z -5.8e-28)
t_0
(if (<= z -3.55e-205)
(* y 4.0)
(if (<= z -1.06e-304)
(* x -3.0)
(if (<= z 3.15e-171) (* y 4.0) (if (<= z 0.5) (* x -3.0) t_0)))))))
double code(double x, double y, double z) {
double t_0 = x * (z * 6.0);
double tmp;
if (z <= -5.8e-28) {
tmp = t_0;
} else if (z <= -3.55e-205) {
tmp = y * 4.0;
} else if (z <= -1.06e-304) {
tmp = x * -3.0;
} else if (z <= 3.15e-171) {
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 = x * (z * 6.0d0)
if (z <= (-5.8d-28)) then
tmp = t_0
else if (z <= (-3.55d-205)) then
tmp = y * 4.0d0
else if (z <= (-1.06d-304)) then
tmp = x * (-3.0d0)
else if (z <= 3.15d-171) 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 = x * (z * 6.0);
double tmp;
if (z <= -5.8e-28) {
tmp = t_0;
} else if (z <= -3.55e-205) {
tmp = y * 4.0;
} else if (z <= -1.06e-304) {
tmp = x * -3.0;
} else if (z <= 3.15e-171) {
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 = x * (z * 6.0) tmp = 0 if z <= -5.8e-28: tmp = t_0 elif z <= -3.55e-205: tmp = y * 4.0 elif z <= -1.06e-304: tmp = x * -3.0 elif z <= 3.15e-171: 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(x * Float64(z * 6.0)) tmp = 0.0 if (z <= -5.8e-28) tmp = t_0; elseif (z <= -3.55e-205) tmp = Float64(y * 4.0); elseif (z <= -1.06e-304) tmp = Float64(x * -3.0); elseif (z <= 3.15e-171) 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 = x * (z * 6.0); tmp = 0.0; if (z <= -5.8e-28) tmp = t_0; elseif (z <= -3.55e-205) tmp = y * 4.0; elseif (z <= -1.06e-304) tmp = x * -3.0; elseif (z <= 3.15e-171) 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[(x * N[(z * 6.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.8e-28], t$95$0, If[LessEqual[z, -3.55e-205], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.06e-304], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.15e-171], 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 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -5.8 \cdot 10^{-28}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.55 \cdot 10^{-205}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.06 \cdot 10^{-304}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.15 \cdot 10^{-171}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -5.80000000000000026e-28 or 0.5 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 51.9%
sub-neg51.9%
distribute-rgt-in51.9%
metadata-eval51.9%
metadata-eval51.9%
distribute-lft-neg-in51.9%
associate-+r+51.9%
metadata-eval51.9%
metadata-eval51.9%
distribute-rgt-neg-in51.9%
metadata-eval51.9%
Simplified51.9%
Taylor expanded in z around inf 47.8%
if -5.80000000000000026e-28 < z < -3.5500000000000001e-205 or -1.06e-304 < z < 3.1500000000000001e-171Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 100.0%
Taylor expanded in x around 0 63.9%
if -3.5500000000000001e-205 < z < -1.06e-304 or 3.1500000000000001e-171 < z < 0.5Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in x around inf 66.4%
sub-neg66.4%
distribute-rgt-in66.4%
metadata-eval66.4%
metadata-eval66.4%
distribute-lft-neg-in66.4%
associate-+r+66.4%
metadata-eval66.4%
metadata-eval66.4%
distribute-rgt-neg-in66.4%
metadata-eval66.4%
Simplified66.4%
Taylor expanded in z around 0 63.6%
*-commutative63.6%
Simplified63.6%
Final simplification55.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -6.4e-18) (not (<= x 38000000000000.0))) (* x (+ -3.0 (* z 6.0))) (* y (+ 4.0 (* -6.0 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -6.4e-18) || !(x <= 38000000000000.0)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.0 + (-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) :: tmp
if ((x <= (-6.4d-18)) .or. (.not. (x <= 38000000000000.0d0))) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else
tmp = y * (4.0d0 + ((-6.0d0) * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -6.4e-18) || !(x <= 38000000000000.0)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.0 + (-6.0 * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -6.4e-18) or not (x <= 38000000000000.0): tmp = x * (-3.0 + (z * 6.0)) else: tmp = y * (4.0 + (-6.0 * z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -6.4e-18) || !(x <= 38000000000000.0)) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = Float64(y * Float64(4.0 + Float64(-6.0 * z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -6.4e-18) || ~((x <= 38000000000000.0))) tmp = x * (-3.0 + (z * 6.0)); else tmp = y * (4.0 + (-6.0 * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -6.4e-18], N[Not[LessEqual[x, 38000000000000.0]], $MachinePrecision]], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(4.0 + N[(-6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-18} \lor \neg \left(x \leq 38000000000000\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 + -6 \cdot z\right)\\
\end{array}
\end{array}
if x < -6.3999999999999998e-18 or 3.8e13 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 77.7%
sub-neg77.7%
distribute-rgt-in77.7%
metadata-eval77.7%
metadata-eval77.7%
distribute-lft-neg-in77.7%
associate-+r+77.7%
metadata-eval77.7%
metadata-eval77.7%
distribute-rgt-neg-in77.7%
metadata-eval77.7%
Simplified77.7%
if -6.3999999999999998e-18 < x < 3.8e13Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-def99.7%
sub-neg99.7%
distribute-rgt-in99.7%
metadata-eval99.7%
metadata-eval99.7%
distribute-lft-neg-out99.7%
distribute-rgt-neg-in99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 80.4%
Final simplification79.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.58) (not (<= z 0.52))) (* -6.0 (* z (- y x))) (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.58) || !(z <= 0.52)) {
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.58d0)) .or. (.not. (z <= 0.52d0))) 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.58) || !(z <= 0.52)) {
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.58) or not (z <= 0.52): 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.58) || !(z <= 0.52)) 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.58) || ~((z <= 0.52))) 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.58], N[Not[LessEqual[z, 0.52]], $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.58 \lor \neg \left(z \leq 0.52\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.57999999999999996 or 0.52000000000000002 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.4%
if -0.57999999999999996 < z < 0.52000000000000002Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.5%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.6) (not (<= z 0.5))) (* -6.0 (* z (- y x))) (+ (* y 4.0) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.6) || !(z <= 0.5)) {
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.6d0)) .or. (.not. (z <= 0.5d0))) 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.6) || !(z <= 0.5)) {
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.6) or not (z <= 0.5): 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.6) || !(z <= 0.5)) 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.6) || ~((z <= 0.5))) 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.6], N[Not[LessEqual[z, 0.5]], $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.6 \lor \neg \left(z \leq 0.5\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.599999999999999978 or 0.5 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.4%
if -0.599999999999999978 < z < 0.5Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.5%
Taylor expanded in x around 0 96.5%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.65) (+ x (* z (* -6.0 (- y x)))) (if (<= z 0.58) (+ (* y 4.0) (* x -3.0)) (* -6.0 (* z (- y x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.65) {
tmp = x + (z * (-6.0 * (y - x)));
} else if (z <= 0.58) {
tmp = (y * 4.0) + (x * -3.0);
} else {
tmp = -6.0 * (z * (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.65d0)) then
tmp = x + (z * ((-6.0d0) * (y - x)))
else if (z <= 0.58d0) then
tmp = (y * 4.0d0) + (x * (-3.0d0))
else
tmp = (-6.0d0) * (z * (y - x))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.65) {
tmp = x + (z * (-6.0 * (y - x)));
} else if (z <= 0.58) {
tmp = (y * 4.0) + (x * -3.0);
} else {
tmp = -6.0 * (z * (y - x));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.65: tmp = x + (z * (-6.0 * (y - x))) elif z <= 0.58: tmp = (y * 4.0) + (x * -3.0) else: tmp = -6.0 * (z * (y - x)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.65) tmp = Float64(x + Float64(z * Float64(-6.0 * Float64(y - x)))); elseif (z <= 0.58) tmp = Float64(Float64(y * 4.0) + Float64(x * -3.0)); else tmp = Float64(-6.0 * Float64(z * Float64(y - x))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.65) tmp = x + (z * (-6.0 * (y - x))); elseif (z <= 0.58) tmp = (y * 4.0) + (x * -3.0); else tmp = -6.0 * (z * (y - x)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.65], N[(x + N[(z * N[(-6.0 * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.58], N[(N[(y * 4.0), $MachinePrecision] + N[(x * -3.0), $MachinePrecision]), $MachinePrecision], N[(-6.0 * N[(z * N[(y - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.65:\\
\;\;\;\;x + z \cdot \left(-6 \cdot \left(y - x\right)\right)\\
\mathbf{elif}\;z \leq 0.58:\\
\;\;\;\;y \cdot 4 + x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;-6 \cdot \left(z \cdot \left(y - x\right)\right)\\
\end{array}
\end{array}
if z < -0.650000000000000022Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in z around inf 96.5%
Taylor expanded in y around 0 91.7%
metadata-eval91.7%
distribute-lft-neg-in91.7%
distribute-rgt-neg-in91.7%
distribute-lft-neg-out91.7%
*-commutative91.7%
distribute-lft-in91.7%
*-commutative91.7%
distribute-rgt-out96.5%
sub-neg96.5%
*-commutative96.5%
associate-*l*96.6%
Simplified96.6%
if -0.650000000000000022 < z < 0.57999999999999996Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.5%
Taylor expanded in x around 0 96.5%
if 0.57999999999999996 < z Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.3%
Final simplification97.0%
(FPCore (x y z) :precision binary64 (if (or (<= x -5.5e-20) (not (<= x 2700000000000.0))) (* x -3.0) (* y 4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e-20) || !(x <= 2700000000000.0)) {
tmp = x * -3.0;
} else {
tmp = y * 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 ((x <= (-5.5d-20)) .or. (.not. (x <= 2700000000000.0d0))) then
tmp = x * (-3.0d0)
else
tmp = y * 4.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -5.5e-20) || !(x <= 2700000000000.0)) {
tmp = x * -3.0;
} else {
tmp = y * 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -5.5e-20) or not (x <= 2700000000000.0): tmp = x * -3.0 else: tmp = y * 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -5.5e-20) || !(x <= 2700000000000.0)) tmp = Float64(x * -3.0); else tmp = Float64(y * 4.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -5.5e-20) || ~((x <= 2700000000000.0))) tmp = x * -3.0; else tmp = y * 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -5.5e-20], N[Not[LessEqual[x, 2700000000000.0]], $MachinePrecision]], N[(x * -3.0), $MachinePrecision], N[(y * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5.5 \cdot 10^{-20} \lor \neg \left(x \leq 2700000000000\right):\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\end{array}
if x < -5.4999999999999996e-20 or 2.7e12 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 77.7%
sub-neg77.7%
distribute-rgt-in77.7%
metadata-eval77.7%
metadata-eval77.7%
distribute-lft-neg-in77.7%
associate-+r+77.7%
metadata-eval77.7%
metadata-eval77.7%
distribute-rgt-neg-in77.7%
metadata-eval77.7%
Simplified77.7%
Taylor expanded in z around 0 39.1%
*-commutative39.1%
Simplified39.1%
if -5.4999999999999996e-20 < x < 2.7e12Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 47.1%
Taylor expanded in x around 0 38.9%
Final simplification39.0%
(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(Float64(y - x) * 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[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision] * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\left(y - x\right) \cdot 6\right) \cdot \left(0.6666666666666666 - z\right)
\end{array}
Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z) :precision binary64 (* y 4.0))
double code(double x, double y, double z) {
return y * 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 = y * 4.0d0
end function
public static double code(double x, double y, double z) {
return y * 4.0;
}
def code(x, y, z): return y * 4.0
function code(x, y, z) return Float64(y * 4.0) end
function tmp = code(x, y, z) tmp = y * 4.0; end
code[x_, y_, z_] := N[(y * 4.0), $MachinePrecision]
\begin{array}{l}
\\
y \cdot 4
\end{array}
Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around 0 48.5%
Taylor expanded in x around 0 24.9%
Final simplification24.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.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in z around inf 51.4%
Taylor expanded in y around 0 26.4%
*-commutative26.4%
*-commutative26.4%
associate-*l*26.4%
Simplified26.4%
Taylor expanded in z around 0 2.7%
Final simplification2.7%
herbie shell --seed 2024024
(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))))