
(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 14 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 (* (* (- 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%
(FPCore (x y z)
:precision binary64
(if (<= z -2.8e+203)
(* -6.0 (* y z))
(if (<= z -3.8)
(* 6.0 (* x z))
(if (<= z -1.5e-148)
(* y 4.0)
(if (<= z 7.2e-219)
(* x -3.0)
(if (<= z 5e-146)
(* y 4.0)
(if (<= z 0.5) (* x -3.0) (* x (* 6.0 z)))))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e+203) {
tmp = -6.0 * (y * z);
} else if (z <= -3.8) {
tmp = 6.0 * (x * z);
} else if (z <= -1.5e-148) {
tmp = y * 4.0;
} else if (z <= 7.2e-219) {
tmp = x * -3.0;
} else if (z <= 5e-146) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.0;
} else {
tmp = x * (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 (z <= (-2.8d+203)) then
tmp = (-6.0d0) * (y * z)
else if (z <= (-3.8d0)) then
tmp = 6.0d0 * (x * z)
else if (z <= (-1.5d-148)) then
tmp = y * 4.0d0
else if (z <= 7.2d-219) then
tmp = x * (-3.0d0)
else if (z <= 5d-146) then
tmp = y * 4.0d0
else if (z <= 0.5d0) then
tmp = x * (-3.0d0)
else
tmp = x * (6.0d0 * z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -2.8e+203) {
tmp = -6.0 * (y * z);
} else if (z <= -3.8) {
tmp = 6.0 * (x * z);
} else if (z <= -1.5e-148) {
tmp = y * 4.0;
} else if (z <= 7.2e-219) {
tmp = x * -3.0;
} else if (z <= 5e-146) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.0;
} else {
tmp = x * (6.0 * z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -2.8e+203: tmp = -6.0 * (y * z) elif z <= -3.8: tmp = 6.0 * (x * z) elif z <= -1.5e-148: tmp = y * 4.0 elif z <= 7.2e-219: tmp = x * -3.0 elif z <= 5e-146: tmp = y * 4.0 elif z <= 0.5: tmp = x * -3.0 else: tmp = x * (6.0 * z) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -2.8e+203) tmp = Float64(-6.0 * Float64(y * z)); elseif (z <= -3.8) tmp = Float64(6.0 * Float64(x * z)); elseif (z <= -1.5e-148) tmp = Float64(y * 4.0); elseif (z <= 7.2e-219) tmp = Float64(x * -3.0); elseif (z <= 5e-146) tmp = Float64(y * 4.0); elseif (z <= 0.5) tmp = Float64(x * -3.0); else tmp = Float64(x * Float64(6.0 * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -2.8e+203) tmp = -6.0 * (y * z); elseif (z <= -3.8) tmp = 6.0 * (x * z); elseif (z <= -1.5e-148) tmp = y * 4.0; elseif (z <= 7.2e-219) tmp = x * -3.0; elseif (z <= 5e-146) tmp = y * 4.0; elseif (z <= 0.5) tmp = x * -3.0; else tmp = x * (6.0 * z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -2.8e+203], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.8], N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.5e-148], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 7.2e-219], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 5e-146], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], N[(x * N[(6.0 * z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{+203}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -3.8:\\
\;\;\;\;6 \cdot \left(x \cdot z\right)\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-148}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-219}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-146}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(6 \cdot z\right)\\
\end{array}
\end{array}
if z < -2.7999999999999999e203Initial program 100.0%
metadata-eval100.0%
Simplified100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*99.9%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 68.8%
Taylor expanded in z around inf 68.8%
if -2.7999999999999999e203 < z < -3.7999999999999998Initial program 99.7%
+-commutative99.7%
associate-*l*99.6%
fma-define99.6%
sub-neg99.6%
distribute-rgt-in99.6%
metadata-eval99.6%
metadata-eval99.6%
distribute-lft-neg-out99.6%
distribute-rgt-neg-in99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in y around 0 67.0%
*-lft-identity67.0%
*-commutative67.0%
+-commutative67.0%
*-commutative67.0%
fma-define67.0%
associate-*r*67.0%
neg-mul-167.0%
fma-define67.0%
distribute-neg-in67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
metadata-eval67.0%
distribute-rgt-in67.0%
+-commutative67.0%
sub-neg67.0%
distribute-rgt-in67.0%
sub-neg67.0%
distribute-rgt-in67.0%
metadata-eval67.0%
distribute-lft-neg-in67.0%
associate-+r+67.0%
Simplified67.0%
Taylor expanded in z around inf 64.8%
if -3.7999999999999998 < z < -1.49999999999999999e-148 or 7.19999999999999947e-219 < z < 4.99999999999999957e-146Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
Taylor expanded in z around 0 93.6%
Taylor expanded in x around 0 60.9%
*-commutative60.9%
Simplified60.9%
if -1.49999999999999999e-148 < z < 7.19999999999999947e-219 or 4.99999999999999957e-146 < z < 0.5Initial program 99.4%
+-commutative99.4%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.8%
*-lft-identity61.8%
*-commutative61.8%
+-commutative61.8%
*-commutative61.8%
fma-define61.8%
associate-*r*61.8%
neg-mul-161.8%
fma-define61.8%
distribute-neg-in61.8%
distribute-lft-neg-in61.8%
metadata-eval61.8%
metadata-eval61.8%
distribute-rgt-in61.8%
+-commutative61.8%
sub-neg61.8%
distribute-rgt-in61.8%
sub-neg61.8%
distribute-rgt-in61.8%
metadata-eval61.8%
distribute-lft-neg-in61.8%
associate-+r+61.8%
Simplified61.8%
Taylor expanded in z around 0 61.2%
*-commutative61.2%
Simplified61.2%
if 0.5 < z Initial program 99.8%
+-commutative99.8%
associate-*l*99.7%
fma-define99.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 0 59.9%
*-lft-identity59.9%
*-commutative59.9%
+-commutative59.9%
*-commutative59.9%
fma-define60.0%
associate-*r*60.0%
neg-mul-160.0%
fma-define59.9%
distribute-neg-in59.9%
distribute-lft-neg-in59.9%
metadata-eval59.9%
metadata-eval59.9%
distribute-rgt-in59.9%
+-commutative59.9%
sub-neg59.9%
distribute-rgt-in59.9%
sub-neg59.9%
distribute-rgt-in59.9%
metadata-eval59.9%
distribute-lft-neg-in59.9%
associate-+r+59.9%
Simplified59.9%
Taylor expanded in z around inf 59.2%
associate-*r*59.3%
*-commutative59.3%
associate-*r*59.3%
Simplified59.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* x z))))
(if (<= z -3.65e+202)
(* -6.0 (* y z))
(if (<= z -9.5)
t_0
(if (<= z -8e-153)
(* y 4.0)
(if (<= z 9.6e-219)
(* x -3.0)
(if (<= z 4e-146) (* 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 * (x * z);
double tmp;
if (z <= -3.65e+202) {
tmp = -6.0 * (y * z);
} else if (z <= -9.5) {
tmp = t_0;
} else if (z <= -8e-153) {
tmp = y * 4.0;
} else if (z <= 9.6e-219) {
tmp = x * -3.0;
} else if (z <= 4e-146) {
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 * (x * z)
if (z <= (-3.65d+202)) then
tmp = (-6.0d0) * (y * z)
else if (z <= (-9.5d0)) then
tmp = t_0
else if (z <= (-8d-153)) then
tmp = y * 4.0d0
else if (z <= 9.6d-219) then
tmp = x * (-3.0d0)
else if (z <= 4d-146) 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 * (x * z);
double tmp;
if (z <= -3.65e+202) {
tmp = -6.0 * (y * z);
} else if (z <= -9.5) {
tmp = t_0;
} else if (z <= -8e-153) {
tmp = y * 4.0;
} else if (z <= 9.6e-219) {
tmp = x * -3.0;
} else if (z <= 4e-146) {
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 * (x * z) tmp = 0 if z <= -3.65e+202: tmp = -6.0 * (y * z) elif z <= -9.5: tmp = t_0 elif z <= -8e-153: tmp = y * 4.0 elif z <= 9.6e-219: tmp = x * -3.0 elif z <= 4e-146: 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(x * z)) tmp = 0.0 if (z <= -3.65e+202) tmp = Float64(-6.0 * Float64(y * z)); elseif (z <= -9.5) tmp = t_0; elseif (z <= -8e-153) tmp = Float64(y * 4.0); elseif (z <= 9.6e-219) tmp = Float64(x * -3.0); elseif (z <= 4e-146) 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 * (x * z); tmp = 0.0; if (z <= -3.65e+202) tmp = -6.0 * (y * z); elseif (z <= -9.5) tmp = t_0; elseif (z <= -8e-153) tmp = y * 4.0; elseif (z <= 9.6e-219) tmp = x * -3.0; elseif (z <= 4e-146) 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[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.65e+202], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9.5], t$95$0, If[LessEqual[z, -8e-153], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 9.6e-219], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 4e-146], 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(x \cdot z\right)\\
\mathbf{if}\;z \leq -3.65 \cdot 10^{+202}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{elif}\;z \leq -9.5:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -8 \cdot 10^{-153}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-219}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 4 \cdot 10^{-146}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -3.65000000000000019e202Initial program 100.0%
metadata-eval100.0%
Simplified100.0%
+-commutative100.0%
*-commutative100.0%
associate-*r*99.9%
fma-define100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 68.8%
Taylor expanded in z around inf 68.8%
if -3.65000000000000019e202 < z < -9.5 or 0.5 < z Initial program 99.8%
+-commutative99.8%
associate-*l*99.7%
fma-define99.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 0 63.2%
*-lft-identity63.2%
*-commutative63.2%
+-commutative63.2%
*-commutative63.2%
fma-define63.2%
associate-*r*63.2%
neg-mul-163.2%
fma-define63.2%
distribute-neg-in63.2%
distribute-lft-neg-in63.2%
metadata-eval63.2%
metadata-eval63.2%
distribute-rgt-in63.2%
+-commutative63.2%
sub-neg63.2%
distribute-rgt-in63.1%
sub-neg63.1%
distribute-rgt-in63.2%
metadata-eval63.2%
distribute-lft-neg-in63.2%
associate-+r+63.2%
Simplified63.2%
Taylor expanded in z around inf 61.8%
if -9.5 < z < -8.00000000000000031e-153 or 9.60000000000000056e-219 < z < 4.0000000000000001e-146Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
Taylor expanded in z around 0 93.6%
Taylor expanded in x around 0 60.9%
*-commutative60.9%
Simplified60.9%
if -8.00000000000000031e-153 < z < 9.60000000000000056e-219 or 4.0000000000000001e-146 < z < 0.5Initial program 99.4%
+-commutative99.4%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.8%
*-lft-identity61.8%
*-commutative61.8%
+-commutative61.8%
*-commutative61.8%
fma-define61.8%
associate-*r*61.8%
neg-mul-161.8%
fma-define61.8%
distribute-neg-in61.8%
distribute-lft-neg-in61.8%
metadata-eval61.8%
metadata-eval61.8%
distribute-rgt-in61.8%
+-commutative61.8%
sub-neg61.8%
distribute-rgt-in61.8%
sub-neg61.8%
distribute-rgt-in61.8%
metadata-eval61.8%
distribute-lft-neg-in61.8%
associate-+r+61.8%
Simplified61.8%
Taylor expanded in z around 0 61.2%
*-commutative61.2%
Simplified61.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -22.0)
t_0
(if (<= z -8.5e-156)
(* 6.0 (* y (- 0.6666666666666666 z)))
(if (<= z 9.6e-219)
(* x -3.0)
(if (<= z 3.5e-144) (* 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 * ((y - x) * z);
double tmp;
if (z <= -22.0) {
tmp = t_0;
} else if (z <= -8.5e-156) {
tmp = 6.0 * (y * (0.6666666666666666 - z));
} else if (z <= 9.6e-219) {
tmp = x * -3.0;
} else if (z <= 3.5e-144) {
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) * ((y - x) * z)
if (z <= (-22.0d0)) then
tmp = t_0
else if (z <= (-8.5d-156)) then
tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
else if (z <= 9.6d-219) then
tmp = x * (-3.0d0)
else if (z <= 3.5d-144) 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 * ((y - x) * z);
double tmp;
if (z <= -22.0) {
tmp = t_0;
} else if (z <= -8.5e-156) {
tmp = 6.0 * (y * (0.6666666666666666 - z));
} else if (z <= 9.6e-219) {
tmp = x * -3.0;
} else if (z <= 3.5e-144) {
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 * ((y - x) * z) tmp = 0 if z <= -22.0: tmp = t_0 elif z <= -8.5e-156: tmp = 6.0 * (y * (0.6666666666666666 - z)) elif z <= 9.6e-219: tmp = x * -3.0 elif z <= 3.5e-144: 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(Float64(y - x) * z)) tmp = 0.0 if (z <= -22.0) tmp = t_0; elseif (z <= -8.5e-156) tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))); elseif (z <= 9.6e-219) tmp = Float64(x * -3.0); elseif (z <= 3.5e-144) 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 * ((y - x) * z); tmp = 0.0; if (z <= -22.0) tmp = t_0; elseif (z <= -8.5e-156) tmp = 6.0 * (y * (0.6666666666666666 - z)); elseif (z <= 9.6e-219) tmp = x * -3.0; elseif (z <= 3.5e-144) 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -22.0], t$95$0, If[LessEqual[z, -8.5e-156], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.6e-219], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-144], 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(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -22:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -8.5 \cdot 10^{-156}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-219}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-144}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -22 or 0.5 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 98.3%
if -22 < z < -8.5e-156Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
+-commutative99.3%
*-commutative99.3%
associate-*r*99.3%
fma-define99.3%
Applied egg-rr99.3%
Taylor expanded in y around inf 59.6%
if -8.5e-156 < z < 9.60000000000000056e-219 or 3.4999999999999998e-144 < z < 0.5Initial program 99.4%
+-commutative99.4%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.8%
*-lft-identity61.8%
*-commutative61.8%
+-commutative61.8%
*-commutative61.8%
fma-define61.8%
associate-*r*61.8%
neg-mul-161.8%
fma-define61.8%
distribute-neg-in61.8%
distribute-lft-neg-in61.8%
metadata-eval61.8%
metadata-eval61.8%
distribute-rgt-in61.8%
+-commutative61.8%
sub-neg61.8%
distribute-rgt-in61.8%
sub-neg61.8%
distribute-rgt-in61.8%
metadata-eval61.8%
distribute-lft-neg-in61.8%
associate-+r+61.8%
Simplified61.8%
Taylor expanded in z around 0 61.2%
*-commutative61.2%
Simplified61.2%
if 9.60000000000000056e-219 < z < 3.4999999999999998e-144Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 99.4%
Taylor expanded in z around 0 99.4%
Taylor expanded in x around 0 85.0%
*-commutative85.0%
Simplified85.0%
Final simplification79.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -0.0132)
t_0
(if (<= z -6e-150)
(* y 4.0)
(if (<= z 5e-219)
(* x -3.0)
(if (<= z 9.2e-147) (* 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 * ((y - x) * z);
double tmp;
if (z <= -0.0132) {
tmp = t_0;
} else if (z <= -6e-150) {
tmp = y * 4.0;
} else if (z <= 5e-219) {
tmp = x * -3.0;
} else if (z <= 9.2e-147) {
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) * ((y - x) * z)
if (z <= (-0.0132d0)) then
tmp = t_0
else if (z <= (-6d-150)) then
tmp = y * 4.0d0
else if (z <= 5d-219) then
tmp = x * (-3.0d0)
else if (z <= 9.2d-147) 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 * ((y - x) * z);
double tmp;
if (z <= -0.0132) {
tmp = t_0;
} else if (z <= -6e-150) {
tmp = y * 4.0;
} else if (z <= 5e-219) {
tmp = x * -3.0;
} else if (z <= 9.2e-147) {
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 * ((y - x) * z) tmp = 0 if z <= -0.0132: tmp = t_0 elif z <= -6e-150: tmp = y * 4.0 elif z <= 5e-219: tmp = x * -3.0 elif z <= 9.2e-147: 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(Float64(y - x) * z)) tmp = 0.0 if (z <= -0.0132) tmp = t_0; elseif (z <= -6e-150) tmp = Float64(y * 4.0); elseif (z <= 5e-219) tmp = Float64(x * -3.0); elseif (z <= 9.2e-147) 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 * ((y - x) * z); tmp = 0.0; if (z <= -0.0132) tmp = t_0; elseif (z <= -6e-150) tmp = y * 4.0; elseif (z <= 5e-219) tmp = x * -3.0; elseif (z <= 9.2e-147) 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[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.0132], t$95$0, If[LessEqual[z, -6e-150], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 5e-219], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 9.2e-147], 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(\left(y - x\right) \cdot z\right)\\
\mathbf{if}\;z \leq -0.0132:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-150}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-219}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{-147}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.0132 or 0.5 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 97.7%
if -0.0132 < z < -6.0000000000000003e-150 or 5.0000000000000002e-219 < z < 9.19999999999999962e-147Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
Taylor expanded in z around 0 95.1%
Taylor expanded in x around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -6.0000000000000003e-150 < z < 5.0000000000000002e-219 or 9.19999999999999962e-147 < z < 0.5Initial program 99.4%
+-commutative99.4%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.8%
*-lft-identity61.8%
*-commutative61.8%
+-commutative61.8%
*-commutative61.8%
fma-define61.8%
associate-*r*61.8%
neg-mul-161.8%
fma-define61.8%
distribute-neg-in61.8%
distribute-lft-neg-in61.8%
metadata-eval61.8%
metadata-eval61.8%
distribute-rgt-in61.8%
+-commutative61.8%
sub-neg61.8%
distribute-rgt-in61.8%
sub-neg61.8%
distribute-rgt-in61.8%
metadata-eval61.8%
distribute-lft-neg-in61.8%
associate-+r+61.8%
Simplified61.8%
Taylor expanded in z around 0 61.2%
*-commutative61.2%
Simplified61.2%
Final simplification78.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -0.68)
t_0
(if (<= z -2.2e-148)
(* y 4.0)
(if (<= z 1.4e-218)
(* x -3.0)
(if (<= z 2.7e-144) (* y 4.0) (if (<= z 0.52) (* x -3.0) t_0)))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -0.68) {
tmp = t_0;
} else if (z <= -2.2e-148) {
tmp = y * 4.0;
} else if (z <= 1.4e-218) {
tmp = x * -3.0;
} else if (z <= 2.7e-144) {
tmp = y * 4.0;
} else if (z <= 0.52) {
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) * (y * z)
if (z <= (-0.68d0)) then
tmp = t_0
else if (z <= (-2.2d-148)) then
tmp = y * 4.0d0
else if (z <= 1.4d-218) then
tmp = x * (-3.0d0)
else if (z <= 2.7d-144) then
tmp = y * 4.0d0
else if (z <= 0.52d0) 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 * (y * z);
double tmp;
if (z <= -0.68) {
tmp = t_0;
} else if (z <= -2.2e-148) {
tmp = y * 4.0;
} else if (z <= 1.4e-218) {
tmp = x * -3.0;
} else if (z <= 2.7e-144) {
tmp = y * 4.0;
} else if (z <= 0.52) {
tmp = x * -3.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) tmp = 0 if z <= -0.68: tmp = t_0 elif z <= -2.2e-148: tmp = y * 4.0 elif z <= 1.4e-218: tmp = x * -3.0 elif z <= 2.7e-144: tmp = y * 4.0 elif z <= 0.52: tmp = x * -3.0 else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) tmp = 0.0 if (z <= -0.68) tmp = t_0; elseif (z <= -2.2e-148) tmp = Float64(y * 4.0); elseif (z <= 1.4e-218) tmp = Float64(x * -3.0); elseif (z <= 2.7e-144) tmp = Float64(y * 4.0); elseif (z <= 0.52) tmp = Float64(x * -3.0); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (y * z); tmp = 0.0; if (z <= -0.68) tmp = t_0; elseif (z <= -2.2e-148) tmp = y * 4.0; elseif (z <= 1.4e-218) tmp = x * -3.0; elseif (z <= 2.7e-144) tmp = y * 4.0; elseif (z <= 0.52) 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[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.68], t$95$0, If[LessEqual[z, -2.2e-148], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.4e-218], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2.7e-144], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.52], N[(x * -3.0), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -0.68:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq -2.2 \cdot 10^{-148}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-218}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-144}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.52:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if z < -0.680000000000000049 or 0.52000000000000002 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in y around inf 45.4%
Taylor expanded in z around inf 44.5%
if -0.680000000000000049 < z < -2.20000000000000017e-148 or 1.40000000000000004e-218 < z < 2.69999999999999975e-144Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in y around 0 99.3%
Taylor expanded in z around 0 95.1%
Taylor expanded in x around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -2.20000000000000017e-148 < z < 1.40000000000000004e-218 or 2.69999999999999975e-144 < z < 0.52000000000000002Initial program 99.4%
+-commutative99.4%
associate-*l*99.7%
fma-define99.7%
sub-neg99.7%
distribute-rgt-in99.8%
metadata-eval99.8%
metadata-eval99.8%
distribute-lft-neg-out99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around 0 61.8%
*-lft-identity61.8%
*-commutative61.8%
+-commutative61.8%
*-commutative61.8%
fma-define61.8%
associate-*r*61.8%
neg-mul-161.8%
fma-define61.8%
distribute-neg-in61.8%
distribute-lft-neg-in61.8%
metadata-eval61.8%
metadata-eval61.8%
distribute-rgt-in61.8%
+-commutative61.8%
sub-neg61.8%
distribute-rgt-in61.8%
sub-neg61.8%
distribute-rgt-in61.8%
metadata-eval61.8%
distribute-lft-neg-in61.8%
associate-+r+61.8%
Simplified61.8%
Taylor expanded in z around 0 61.2%
*-commutative61.2%
Simplified61.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.55) (not (<= z 0.55))) (* z (+ (* y -6.0) (* x 6.0))) (+ (* x -3.0) (* y 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.55) || !(z <= 0.55)) {
tmp = z * ((y * -6.0) + (x * 6.0));
} else {
tmp = (x * -3.0) + (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 ((z <= (-0.55d0)) .or. (.not. (z <= 0.55d0))) then
tmp = z * ((y * (-6.0d0)) + (x * 6.0d0))
else
tmp = (x * (-3.0d0)) + (y * 4.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -0.55) || !(z <= 0.55)) {
tmp = z * ((y * -6.0) + (x * 6.0));
} else {
tmp = (x * -3.0) + (y * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.55) or not (z <= 0.55): tmp = z * ((y * -6.0) + (x * 6.0)) else: tmp = (x * -3.0) + (y * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.55) || !(z <= 0.55)) tmp = Float64(z * Float64(Float64(y * -6.0) + Float64(x * 6.0))); else tmp = Float64(Float64(x * -3.0) + Float64(y * 4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.55) || ~((z <= 0.55))) tmp = z * ((y * -6.0) + (x * 6.0)); else tmp = (x * -3.0) + (y * 4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.55], N[Not[LessEqual[z, 0.55]], $MachinePrecision]], N[(z * N[(N[(y * -6.0), $MachinePrecision] + N[(x * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * -3.0), $MachinePrecision] + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.55 \lor \neg \left(z \leq 0.55\right):\\
\;\;\;\;z \cdot \left(y \cdot -6 + x \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3 + y \cdot 4\\
\end{array}
\end{array}
if z < -0.55000000000000004 or 0.55000000000000004 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in x around 0 94.8%
Taylor expanded in z around inf 97.7%
if -0.55000000000000004 < z < 0.55000000000000004Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 99.4%
Taylor expanded in z around 0 97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.58) (not (<= z 0.5))) (* -6.0 (* (- y x) z)) (+ (* x -3.0) (* y 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.58) || !(z <= 0.5)) {
tmp = -6.0 * ((y - x) * z);
} else {
tmp = (x * -3.0) + (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 ((z <= (-0.58d0)) .or. (.not. (z <= 0.5d0))) then
tmp = (-6.0d0) * ((y - x) * z)
else
tmp = (x * (-3.0d0)) + (y * 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.5)) {
tmp = -6.0 * ((y - x) * z);
} else {
tmp = (x * -3.0) + (y * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.58) or not (z <= 0.5): tmp = -6.0 * ((y - x) * z) else: tmp = (x * -3.0) + (y * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.58) || !(z <= 0.5)) tmp = Float64(-6.0 * Float64(Float64(y - x) * z)); else tmp = Float64(Float64(x * -3.0) + Float64(y * 4.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -0.58) || ~((z <= 0.5))) tmp = -6.0 * ((y - x) * z); else tmp = (x * -3.0) + (y * 4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.58], N[Not[LessEqual[z, 0.5]], $MachinePrecision]], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(N[(x * -3.0), $MachinePrecision] + N[(y * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.58 \lor \neg \left(z \leq 0.5\right):\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3 + y \cdot 4\\
\end{array}
\end{array}
if z < -0.57999999999999996 or 0.5 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 97.7%
if -0.57999999999999996 < z < 0.5Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 99.4%
Taylor expanded in z around 0 97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.52) (not (<= z 0.58))) (* -6.0 (* (- y x) z)) (+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.52) || !(z <= 0.58)) {
tmp = -6.0 * ((y - x) * z);
} 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.52d0)) .or. (.not. (z <= 0.58d0))) then
tmp = (-6.0d0) * ((y - x) * z)
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.52) || !(z <= 0.58)) {
tmp = -6.0 * ((y - x) * z);
} else {
tmp = x + ((y - x) * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.52) or not (z <= 0.58): tmp = -6.0 * ((y - x) * z) else: tmp = x + ((y - x) * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.52) || !(z <= 0.58)) tmp = Float64(-6.0 * Float64(Float64(y - x) * z)); 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.52) || ~((z <= 0.58))) tmp = -6.0 * ((y - x) * z); else tmp = x + ((y - x) * 4.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.52], N[Not[LessEqual[z, 0.58]], $MachinePrecision]], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.52 \lor \neg \left(z \leq 0.58\right):\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\end{array}
\end{array}
if z < -0.52000000000000002 or 0.57999999999999996 < z Initial program 99.8%
metadata-eval99.8%
Simplified99.8%
+-commutative99.8%
*-commutative99.8%
associate-*r*99.7%
fma-define99.7%
Applied egg-rr99.7%
Taylor expanded in z around inf 97.7%
if -0.52000000000000002 < z < 0.57999999999999996Initial program 99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in z around 0 97.7%
Final simplification97.7%
(FPCore (x y z) :precision binary64 (if (or (<= x -1.15e-68) (not (<= x 7.5e-31))) (* x (+ -3.0 (* 6.0 z))) (* (- 0.6666666666666666 z) (* y 6.0))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -1.15e-68) || !(x <= 7.5e-31)) {
tmp = x * (-3.0 + (6.0 * z));
} else {
tmp = (0.6666666666666666 - z) * (y * 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 ((x <= (-1.15d-68)) .or. (.not. (x <= 7.5d-31))) then
tmp = x * ((-3.0d0) + (6.0d0 * z))
else
tmp = (0.6666666666666666d0 - z) * (y * 6.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -1.15e-68) || !(x <= 7.5e-31)) {
tmp = x * (-3.0 + (6.0 * z));
} else {
tmp = (0.6666666666666666 - z) * (y * 6.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -1.15e-68) or not (x <= 7.5e-31): tmp = x * (-3.0 + (6.0 * z)) else: tmp = (0.6666666666666666 - z) * (y * 6.0) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -1.15e-68) || !(x <= 7.5e-31)) tmp = Float64(x * Float64(-3.0 + Float64(6.0 * z))); else tmp = Float64(Float64(0.6666666666666666 - z) * Float64(y * 6.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -1.15e-68) || ~((x <= 7.5e-31))) tmp = x * (-3.0 + (6.0 * z)); else tmp = (0.6666666666666666 - z) * (y * 6.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -1.15e-68], N[Not[LessEqual[x, 7.5e-31]], $MachinePrecision]], N[(x * N[(-3.0 + N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(y * 6.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.15 \cdot 10^{-68} \lor \neg \left(x \leq 7.5 \cdot 10^{-31}\right):\\
\;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0.6666666666666666 - z\right) \cdot \left(y \cdot 6\right)\\
\end{array}
\end{array}
if x < -1.14999999999999998e-68 or 7.49999999999999975e-31 < x Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-define99.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 0 79.4%
*-lft-identity79.4%
*-commutative79.4%
+-commutative79.4%
*-commutative79.4%
fma-define79.4%
associate-*r*79.4%
neg-mul-179.4%
fma-define79.4%
distribute-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
metadata-eval79.4%
distribute-rgt-in79.4%
+-commutative79.4%
sub-neg79.4%
distribute-rgt-in79.4%
sub-neg79.4%
distribute-rgt-in79.4%
metadata-eval79.4%
distribute-lft-neg-in79.4%
associate-+r+79.4%
Simplified79.4%
if -1.14999999999999998e-68 < x < 7.49999999999999975e-31Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 96.8%
Taylor expanded in y around inf 86.5%
*-commutative86.5%
*-commutative86.5%
associate-*l*86.7%
Simplified86.7%
Final simplification82.2%
(FPCore (x y z) :precision binary64 (if (or (<= x -4.5e-68) (not (<= x 3.2e-31))) (* x (+ -3.0 (* 6.0 z))) (* 6.0 (* y (- 0.6666666666666666 z)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-68) || !(x <= 3.2e-31)) {
tmp = x * (-3.0 + (6.0 * z));
} else {
tmp = 6.0 * (y * (0.6666666666666666 - 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 <= (-4.5d-68)) .or. (.not. (x <= 3.2d-31))) then
tmp = x * ((-3.0d0) + (6.0d0 * z))
else
tmp = 6.0d0 * (y * (0.6666666666666666d0 - z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -4.5e-68) || !(x <= 3.2e-31)) {
tmp = x * (-3.0 + (6.0 * z));
} else {
tmp = 6.0 * (y * (0.6666666666666666 - z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -4.5e-68) or not (x <= 3.2e-31): tmp = x * (-3.0 + (6.0 * z)) else: tmp = 6.0 * (y * (0.6666666666666666 - z)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -4.5e-68) || !(x <= 3.2e-31)) tmp = Float64(x * Float64(-3.0 + Float64(6.0 * z))); else tmp = Float64(6.0 * Float64(y * Float64(0.6666666666666666 - z))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -4.5e-68) || ~((x <= 3.2e-31))) tmp = x * (-3.0 + (6.0 * z)); else tmp = 6.0 * (y * (0.6666666666666666 - z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -4.5e-68], N[Not[LessEqual[x, 3.2e-31]], $MachinePrecision]], N[(x * N[(-3.0 + N[(6.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 * N[(y * N[(0.6666666666666666 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-68} \lor \neg \left(x \leq 3.2 \cdot 10^{-31}\right):\\
\;\;\;\;x \cdot \left(-3 + 6 \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;6 \cdot \left(y \cdot \left(0.6666666666666666 - z\right)\right)\\
\end{array}
\end{array}
if x < -4.49999999999999999e-68 or 3.20000000000000018e-31 < x Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-define99.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 0 79.4%
*-lft-identity79.4%
*-commutative79.4%
+-commutative79.4%
*-commutative79.4%
fma-define79.4%
associate-*r*79.4%
neg-mul-179.4%
fma-define79.4%
distribute-neg-in79.4%
distribute-lft-neg-in79.4%
metadata-eval79.4%
metadata-eval79.4%
distribute-rgt-in79.4%
+-commutative79.4%
sub-neg79.4%
distribute-rgt-in79.4%
sub-neg79.4%
distribute-rgt-in79.4%
metadata-eval79.4%
distribute-lft-neg-in79.4%
associate-+r+79.4%
Simplified79.4%
if -4.49999999999999999e-68 < x < 3.20000000000000018e-31Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
+-commutative99.7%
*-commutative99.7%
associate-*r*99.5%
fma-define99.5%
Applied egg-rr99.5%
Taylor expanded in y around inf 86.5%
Final simplification82.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -3.5e-68) (not (<= x 4.6e+69))) (* x -3.0) (* y 4.0)))
double code(double x, double y, double z) {
double tmp;
if ((x <= -3.5e-68) || !(x <= 4.6e+69)) {
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 <= (-3.5d-68)) .or. (.not. (x <= 4.6d+69))) 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 <= -3.5e-68) || !(x <= 4.6e+69)) {
tmp = x * -3.0;
} else {
tmp = y * 4.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -3.5e-68) or not (x <= 4.6e+69): tmp = x * -3.0 else: tmp = y * 4.0 return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -3.5e-68) || !(x <= 4.6e+69)) 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 <= -3.5e-68) || ~((x <= 4.6e+69))) tmp = x * -3.0; else tmp = y * 4.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.5e-68], N[Not[LessEqual[x, 4.6e+69]], $MachinePrecision]], N[(x * -3.0), $MachinePrecision], N[(y * 4.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.5 \cdot 10^{-68} \lor \neg \left(x \leq 4.6 \cdot 10^{+69}\right):\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;y \cdot 4\\
\end{array}
\end{array}
if x < -3.50000000000000013e-68 or 4.60000000000000033e69 < x Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-define99.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 0 81.7%
*-lft-identity81.7%
*-commutative81.7%
+-commutative81.7%
*-commutative81.7%
fma-define81.7%
associate-*r*81.7%
neg-mul-181.7%
fma-define81.7%
distribute-neg-in81.7%
distribute-lft-neg-in81.7%
metadata-eval81.7%
metadata-eval81.7%
distribute-rgt-in81.6%
+-commutative81.6%
sub-neg81.6%
distribute-rgt-in81.6%
sub-neg81.6%
distribute-rgt-in81.7%
metadata-eval81.7%
distribute-lft-neg-in81.7%
associate-+r+81.7%
Simplified81.7%
Taylor expanded in z around 0 43.6%
*-commutative43.6%
Simplified43.6%
if -3.50000000000000013e-68 < x < 4.60000000000000033e69Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around 0 99.7%
Taylor expanded in z around 0 48.7%
Taylor expanded in x around 0 43.8%
*-commutative43.8%
Simplified43.8%
Final simplification43.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%
+-commutative99.6%
associate-*l*99.3%
fma-define99.3%
sub-neg99.3%
distribute-rgt-in99.4%
metadata-eval99.4%
metadata-eval99.4%
distribute-lft-neg-out99.4%
distribute-rgt-neg-in99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in y around 0 54.7%
*-lft-identity54.7%
*-commutative54.7%
+-commutative54.7%
*-commutative54.7%
fma-define54.8%
associate-*r*54.8%
neg-mul-154.8%
fma-define54.7%
distribute-neg-in54.7%
distribute-lft-neg-in54.7%
metadata-eval54.7%
metadata-eval54.7%
distribute-rgt-in54.7%
+-commutative54.7%
sub-neg54.7%
distribute-rgt-in54.7%
sub-neg54.7%
distribute-rgt-in54.7%
metadata-eval54.7%
distribute-lft-neg-in54.7%
associate-+r+54.8%
Simplified54.8%
Taylor expanded in z around 0 28.0%
*-commutative28.0%
Simplified28.0%
(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 y around 0 54.7%
Taylor expanded in z around inf 28.5%
neg-mul-128.5%
Simplified28.5%
Taylor expanded in z around 0 2.6%
herbie shell --seed 2024144
(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))))