
(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 (fma (- y x) (fma z -6.0 4.0) x))
double code(double x, double y, double z) {
return fma((y - x), fma(z, -6.0, 4.0), x);
}
function code(x, y, z) return fma(Float64(y - x), fma(z, -6.0, 4.0), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(z * -6.0 + 4.0), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, \mathsf{fma}\left(z, -6, 4\right), x\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-def99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.7%
neg-mul-199.7%
associate-*r*99.7%
*-commutative99.7%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
(if (<= z -1.34e+85)
t_0
(if (<= z -1.52e+38)
t_1
(if (<= z -0.0152)
t_0
(if (<= z -1.26e-219)
(* y 4.0)
(if (<= z 4.4e-234)
(* x -3.0)
(if (<= z 3.5e-188)
(* y 4.0)
(if (<= z 0.5) (* x -3.0) (if (<= z 1.85e+204) t_0 t_1))))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double t_1 = 6.0 * (x * z);
double tmp;
if (z <= -1.34e+85) {
tmp = t_0;
} else if (z <= -1.52e+38) {
tmp = t_1;
} else if (z <= -0.0152) {
tmp = t_0;
} else if (z <= -1.26e-219) {
tmp = y * 4.0;
} else if (z <= 4.4e-234) {
tmp = x * -3.0;
} else if (z <= 3.5e-188) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.0;
} else if (z <= 1.85e+204) {
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 = (-6.0d0) * (y * z)
t_1 = 6.0d0 * (x * z)
if (z <= (-1.34d+85)) then
tmp = t_0
else if (z <= (-1.52d+38)) then
tmp = t_1
else if (z <= (-0.0152d0)) then
tmp = t_0
else if (z <= (-1.26d-219)) then
tmp = y * 4.0d0
else if (z <= 4.4d-234) then
tmp = x * (-3.0d0)
else if (z <= 3.5d-188) then
tmp = y * 4.0d0
else if (z <= 0.5d0) then
tmp = x * (-3.0d0)
else if (z <= 1.85d+204) 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 = -6.0 * (y * z);
double t_1 = 6.0 * (x * z);
double tmp;
if (z <= -1.34e+85) {
tmp = t_0;
} else if (z <= -1.52e+38) {
tmp = t_1;
} else if (z <= -0.0152) {
tmp = t_0;
} else if (z <= -1.26e-219) {
tmp = y * 4.0;
} else if (z <= 4.4e-234) {
tmp = x * -3.0;
} else if (z <= 3.5e-188) {
tmp = y * 4.0;
} else if (z <= 0.5) {
tmp = x * -3.0;
} else if (z <= 1.85e+204) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) t_1 = 6.0 * (x * z) tmp = 0 if z <= -1.34e+85: tmp = t_0 elif z <= -1.52e+38: tmp = t_1 elif z <= -0.0152: tmp = t_0 elif z <= -1.26e-219: tmp = y * 4.0 elif z <= 4.4e-234: tmp = x * -3.0 elif z <= 3.5e-188: tmp = y * 4.0 elif z <= 0.5: tmp = x * -3.0 elif z <= 1.85e+204: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) t_1 = Float64(6.0 * Float64(x * z)) tmp = 0.0 if (z <= -1.34e+85) tmp = t_0; elseif (z <= -1.52e+38) tmp = t_1; elseif (z <= -0.0152) tmp = t_0; elseif (z <= -1.26e-219) tmp = Float64(y * 4.0); elseif (z <= 4.4e-234) tmp = Float64(x * -3.0); elseif (z <= 3.5e-188) tmp = Float64(y * 4.0); elseif (z <= 0.5) tmp = Float64(x * -3.0); elseif (z <= 1.85e+204) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (y * z); t_1 = 6.0 * (x * z); tmp = 0.0; if (z <= -1.34e+85) tmp = t_0; elseif (z <= -1.52e+38) tmp = t_1; elseif (z <= -0.0152) tmp = t_0; elseif (z <= -1.26e-219) tmp = y * 4.0; elseif (z <= 4.4e-234) tmp = x * -3.0; elseif (z <= 3.5e-188) tmp = y * 4.0; elseif (z <= 0.5) tmp = x * -3.0; elseif (z <= 1.85e+204) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.34e+85], t$95$0, If[LessEqual[z, -1.52e+38], t$95$1, If[LessEqual[z, -0.0152], t$95$0, If[LessEqual[z, -1.26e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.4e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-188], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.5], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 1.85e+204], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.34 \cdot 10^{+85}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.52 \cdot 10^{+38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.0152:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.26 \cdot 10^{-219}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-234}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 1.85 \cdot 10^{+204}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.34000000000000008e85 or -1.51999999999999996e38 < z < -0.0152 or 0.5 < z < 1.85e204Initial program 99.6%
+-commutative99.6%
associate-*l*99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.7%
neg-mul-199.7%
associate-*r*99.7%
*-commutative99.7%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 63.3%
Taylor expanded in z around inf 60.7%
*-commutative60.7%
Simplified60.7%
if -1.34000000000000008e85 < z < -1.51999999999999996e38 or 1.85e204 < z Initial program 99.5%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 67.6%
if -0.0152 < z < -1.26000000000000003e-219 or 4.3999999999999998e-234 < z < 3.5e-188Initial program 99.3%
+-commutative99.3%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 62.9%
Taylor expanded in z around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -1.26000000000000003e-219 < z < 4.3999999999999998e-234 or 3.5e-188 < z < 0.5Initial program 99.4%
Taylor expanded in x around inf 68.9%
*-commutative68.9%
+-commutative68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
neg-mul-168.9%
*-commutative68.9%
associate-*l*68.9%
distribute-rgt-in68.9%
+-commutative68.9%
distribute-lft-in68.9%
associate-+r+68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
distribute-lft-in68.9%
+-commutative68.9%
distribute-rgt-in68.9%
*-commutative68.9%
associate-*l*68.9%
metadata-eval68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification64.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))) (t_1 (* 6.0 (* x z))))
(if (<= z -1.2e+86)
t_0
(if (<= z -1.65e+38)
t_1
(if (<= z -0.0152)
(* z (* y -6.0))
(if (<= z -4.4e-219)
(* y 4.0)
(if (<= z 1.15e-234)
(* x -3.0)
(if (<= z 2e-186)
(* y 4.0)
(if (<= z 0.65) (* x -3.0) (if (<= z 3.3e+209) t_0 t_1))))))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double t_1 = 6.0 * (x * z);
double tmp;
if (z <= -1.2e+86) {
tmp = t_0;
} else if (z <= -1.65e+38) {
tmp = t_1;
} else if (z <= -0.0152) {
tmp = z * (y * -6.0);
} else if (z <= -4.4e-219) {
tmp = y * 4.0;
} else if (z <= 1.15e-234) {
tmp = x * -3.0;
} else if (z <= 2e-186) {
tmp = y * 4.0;
} else if (z <= 0.65) {
tmp = x * -3.0;
} else if (z <= 3.3e+209) {
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 = (-6.0d0) * (y * z)
t_1 = 6.0d0 * (x * z)
if (z <= (-1.2d+86)) then
tmp = t_0
else if (z <= (-1.65d+38)) then
tmp = t_1
else if (z <= (-0.0152d0)) then
tmp = z * (y * (-6.0d0))
else if (z <= (-4.4d-219)) then
tmp = y * 4.0d0
else if (z <= 1.15d-234) then
tmp = x * (-3.0d0)
else if (z <= 2d-186) then
tmp = y * 4.0d0
else if (z <= 0.65d0) then
tmp = x * (-3.0d0)
else if (z <= 3.3d+209) 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 = -6.0 * (y * z);
double t_1 = 6.0 * (x * z);
double tmp;
if (z <= -1.2e+86) {
tmp = t_0;
} else if (z <= -1.65e+38) {
tmp = t_1;
} else if (z <= -0.0152) {
tmp = z * (y * -6.0);
} else if (z <= -4.4e-219) {
tmp = y * 4.0;
} else if (z <= 1.15e-234) {
tmp = x * -3.0;
} else if (z <= 2e-186) {
tmp = y * 4.0;
} else if (z <= 0.65) {
tmp = x * -3.0;
} else if (z <= 3.3e+209) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) t_1 = 6.0 * (x * z) tmp = 0 if z <= -1.2e+86: tmp = t_0 elif z <= -1.65e+38: tmp = t_1 elif z <= -0.0152: tmp = z * (y * -6.0) elif z <= -4.4e-219: tmp = y * 4.0 elif z <= 1.15e-234: tmp = x * -3.0 elif z <= 2e-186: tmp = y * 4.0 elif z <= 0.65: tmp = x * -3.0 elif z <= 3.3e+209: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y, z) t_0 = Float64(-6.0 * Float64(y * z)) t_1 = Float64(6.0 * Float64(x * z)) tmp = 0.0 if (z <= -1.2e+86) tmp = t_0; elseif (z <= -1.65e+38) tmp = t_1; elseif (z <= -0.0152) tmp = Float64(z * Float64(y * -6.0)); elseif (z <= -4.4e-219) tmp = Float64(y * 4.0); elseif (z <= 1.15e-234) tmp = Float64(x * -3.0); elseif (z <= 2e-186) tmp = Float64(y * 4.0); elseif (z <= 0.65) tmp = Float64(x * -3.0); elseif (z <= 3.3e+209) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z) t_0 = -6.0 * (y * z); t_1 = 6.0 * (x * z); tmp = 0.0; if (z <= -1.2e+86) tmp = t_0; elseif (z <= -1.65e+38) tmp = t_1; elseif (z <= -0.0152) tmp = z * (y * -6.0); elseif (z <= -4.4e-219) tmp = y * 4.0; elseif (z <= 1.15e-234) tmp = x * -3.0; elseif (z <= 2e-186) tmp = y * 4.0; elseif (z <= 0.65) tmp = x * -3.0; elseif (z <= 3.3e+209) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(6.0 * N[(x * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.2e+86], t$95$0, If[LessEqual[z, -1.65e+38], t$95$1, If[LessEqual[z, -0.0152], N[(z * N[(y * -6.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.4e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 1.15e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2e-186], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.65], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.3e+209], t$95$0, t$95$1]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
t_1 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -1.2 \cdot 10^{+86}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.65 \cdot 10^{+38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -0.0152:\\
\;\;\;\;z \cdot \left(y \cdot -6\right)\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-219}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-234}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-186}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+209}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -1.2e86 or 0.650000000000000022 < z < 3.2999999999999998e209Initial program 99.6%
+-commutative99.6%
associate-*l*99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.7%
neg-mul-199.7%
associate-*r*99.7%
*-commutative99.7%
fma-def99.7%
metadata-eval99.7%
metadata-eval99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in y around inf 64.4%
Taylor expanded in z around inf 61.9%
*-commutative61.9%
Simplified61.9%
if -1.2e86 < z < -1.65e38 or 3.2999999999999998e209 < z Initial program 99.5%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 99.8%
Taylor expanded in y around 0 67.6%
if -1.65e38 < z < -0.0152Initial program 99.5%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 79.0%
Taylor expanded in y around inf 55.1%
associate-*r*55.1%
Simplified55.1%
if -0.0152 < z < -4.3999999999999999e-219 or 1.14999999999999995e-234 < z < 1.9999999999999998e-186Initial program 99.3%
+-commutative99.3%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 62.9%
Taylor expanded in z around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -4.3999999999999999e-219 < z < 1.14999999999999995e-234 or 1.9999999999999998e-186 < z < 0.650000000000000022Initial program 99.4%
Taylor expanded in x around inf 68.9%
*-commutative68.9%
+-commutative68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
neg-mul-168.9%
*-commutative68.9%
associate-*l*68.9%
distribute-rgt-in68.9%
+-commutative68.9%
distribute-lft-in68.9%
associate-+r+68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
distribute-lft-in68.9%
+-commutative68.9%
distribute-rgt-in68.9%
*-commutative68.9%
associate-*l*68.9%
metadata-eval68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification64.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -130000.0)
t_0
(if (<= z -1.12e-160)
(* x (+ (* z 6.0) -3.0))
(if (<= z -4.2e-218)
(* y 4.0)
(if (<= z 4.1e-234)
(* x -3.0)
(if (<= z 3.2e-188) (* 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 <= -130000.0) {
tmp = t_0;
} else if (z <= -1.12e-160) {
tmp = x * ((z * 6.0) + -3.0);
} else if (z <= -4.2e-218) {
tmp = y * 4.0;
} else if (z <= 4.1e-234) {
tmp = x * -3.0;
} else if (z <= 3.2e-188) {
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 <= (-130000.0d0)) then
tmp = t_0
else if (z <= (-1.12d-160)) then
tmp = x * ((z * 6.0d0) + (-3.0d0))
else if (z <= (-4.2d-218)) then
tmp = y * 4.0d0
else if (z <= 4.1d-234) then
tmp = x * (-3.0d0)
else if (z <= 3.2d-188) 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 <= -130000.0) {
tmp = t_0;
} else if (z <= -1.12e-160) {
tmp = x * ((z * 6.0) + -3.0);
} else if (z <= -4.2e-218) {
tmp = y * 4.0;
} else if (z <= 4.1e-234) {
tmp = x * -3.0;
} else if (z <= 3.2e-188) {
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 <= -130000.0: tmp = t_0 elif z <= -1.12e-160: tmp = x * ((z * 6.0) + -3.0) elif z <= -4.2e-218: tmp = y * 4.0 elif z <= 4.1e-234: tmp = x * -3.0 elif z <= 3.2e-188: 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 <= -130000.0) tmp = t_0; elseif (z <= -1.12e-160) tmp = Float64(x * Float64(Float64(z * 6.0) + -3.0)); elseif (z <= -4.2e-218) tmp = Float64(y * 4.0); elseif (z <= 4.1e-234) tmp = Float64(x * -3.0); elseif (z <= 3.2e-188) 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 <= -130000.0) tmp = t_0; elseif (z <= -1.12e-160) tmp = x * ((z * 6.0) + -3.0); elseif (z <= -4.2e-218) tmp = y * 4.0; elseif (z <= 4.1e-234) tmp = x * -3.0; elseif (z <= 3.2e-188) 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, -130000.0], t$95$0, If[LessEqual[z, -1.12e-160], N[(x * N[(N[(z * 6.0), $MachinePrecision] + -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.2e-218], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 4.1e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.2e-188], 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 -130000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.12 \cdot 10^{-160}:\\
\;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\
\mathbf{elif}\;z \leq -4.2 \cdot 10^{-218}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 4.1 \cdot 10^{-234}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{-188}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -1.3e5 or 0.5 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 97.3%
if -1.3e5 < z < -1.11999999999999997e-160Initial program 99.3%
Taylor expanded in x around inf 60.5%
*-commutative60.5%
+-commutative60.5%
sub-neg60.5%
distribute-lft-in60.5%
metadata-eval60.5%
metadata-eval60.5%
neg-mul-160.5%
*-commutative60.5%
associate-*l*60.5%
distribute-rgt-in60.5%
+-commutative60.5%
distribute-lft-in60.5%
associate-+r+60.6%
metadata-eval60.6%
metadata-eval60.6%
metadata-eval60.6%
distribute-lft-in60.6%
+-commutative60.6%
distribute-rgt-in60.6%
*-commutative60.6%
associate-*l*60.6%
metadata-eval60.6%
metadata-eval60.6%
Simplified60.6%
if -1.11999999999999997e-160 < z < -4.19999999999999988e-218 or 4.10000000000000011e-234 < z < 3.20000000000000022e-188Initial program 99.3%
+-commutative99.3%
associate-*l*99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
distribute-lft-in99.9%
neg-mul-199.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 81.3%
Taylor expanded in z around 0 81.3%
*-commutative81.3%
Simplified81.3%
if -4.19999999999999988e-218 < z < 4.10000000000000011e-234 or 3.20000000000000022e-188 < z < 0.5Initial program 99.4%
Taylor expanded in x around inf 68.9%
*-commutative68.9%
+-commutative68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
neg-mul-168.9%
*-commutative68.9%
associate-*l*68.9%
distribute-rgt-in68.9%
+-commutative68.9%
distribute-lft-in68.9%
associate-+r+68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
distribute-lft-in68.9%
+-commutative68.9%
distribute-rgt-in68.9%
*-commutative68.9%
associate-*l*68.9%
metadata-eval68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification82.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -0.0042)
t_0
(if (<= z -9.6e-219)
(* y 4.0)
(if (<= z 3.5e-235)
(* x -3.0)
(if (<= z 3.5e-188) (* 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.0042) {
tmp = t_0;
} else if (z <= -9.6e-219) {
tmp = y * 4.0;
} else if (z <= 3.5e-235) {
tmp = x * -3.0;
} else if (z <= 3.5e-188) {
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.0042d0)) then
tmp = t_0
else if (z <= (-9.6d-219)) then
tmp = y * 4.0d0
else if (z <= 3.5d-235) then
tmp = x * (-3.0d0)
else if (z <= 3.5d-188) 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.0042) {
tmp = t_0;
} else if (z <= -9.6e-219) {
tmp = y * 4.0;
} else if (z <= 3.5e-235) {
tmp = x * -3.0;
} else if (z <= 3.5e-188) {
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.0042: tmp = t_0 elif z <= -9.6e-219: tmp = y * 4.0 elif z <= 3.5e-235: tmp = x * -3.0 elif z <= 3.5e-188: 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.0042) tmp = t_0; elseif (z <= -9.6e-219) tmp = Float64(y * 4.0); elseif (z <= 3.5e-235) tmp = Float64(x * -3.0); elseif (z <= 3.5e-188) 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.0042) tmp = t_0; elseif (z <= -9.6e-219) tmp = y * 4.0; elseif (z <= 3.5e-235) tmp = x * -3.0; elseif (z <= 3.5e-188) 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.0042], t$95$0, If[LessEqual[z, -9.6e-219], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 3.5e-235], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 3.5e-188], 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.0042:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -9.6 \cdot 10^{-219}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-235}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 3.5 \cdot 10^{-188}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -0.00419999999999999974 or 0.5 < z Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 95.2%
if -0.00419999999999999974 < z < -9.60000000000000056e-219 or 3.4999999999999999e-235 < z < 3.5e-188Initial program 99.3%
+-commutative99.3%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 62.9%
Taylor expanded in z around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -9.60000000000000056e-219 < z < 3.4999999999999999e-235 or 3.5e-188 < z < 0.5Initial program 99.4%
Taylor expanded in x around inf 68.9%
*-commutative68.9%
+-commutative68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
neg-mul-168.9%
*-commutative68.9%
associate-*l*68.9%
distribute-rgt-in68.9%
+-commutative68.9%
distribute-lft-in68.9%
associate-+r+68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
distribute-lft-in68.9%
+-commutative68.9%
distribute-rgt-in68.9%
*-commutative68.9%
associate-*l*68.9%
metadata-eval68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification80.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -0.0152)
t_0
(if (<= z -1e-216)
(* y 4.0)
(if (<= z 2.4e-234)
(* x -3.0)
(if (<= z 2e-184) (* y 4.0) (if (<= z 0.65) (* 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.0152) {
tmp = t_0;
} else if (z <= -1e-216) {
tmp = y * 4.0;
} else if (z <= 2.4e-234) {
tmp = x * -3.0;
} else if (z <= 2e-184) {
tmp = y * 4.0;
} else if (z <= 0.65) {
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.0152d0)) then
tmp = t_0
else if (z <= (-1d-216)) then
tmp = y * 4.0d0
else if (z <= 2.4d-234) then
tmp = x * (-3.0d0)
else if (z <= 2d-184) then
tmp = y * 4.0d0
else if (z <= 0.65d0) 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.0152) {
tmp = t_0;
} else if (z <= -1e-216) {
tmp = y * 4.0;
} else if (z <= 2.4e-234) {
tmp = x * -3.0;
} else if (z <= 2e-184) {
tmp = y * 4.0;
} else if (z <= 0.65) {
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.0152: tmp = t_0 elif z <= -1e-216: tmp = y * 4.0 elif z <= 2.4e-234: tmp = x * -3.0 elif z <= 2e-184: tmp = y * 4.0 elif z <= 0.65: 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.0152) tmp = t_0; elseif (z <= -1e-216) tmp = Float64(y * 4.0); elseif (z <= 2.4e-234) tmp = Float64(x * -3.0); elseif (z <= 2e-184) tmp = Float64(y * 4.0); elseif (z <= 0.65) 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.0152) tmp = t_0; elseif (z <= -1e-216) tmp = y * 4.0; elseif (z <= 2.4e-234) tmp = x * -3.0; elseif (z <= 2e-184) tmp = y * 4.0; elseif (z <= 0.65) 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.0152], t$95$0, If[LessEqual[z, -1e-216], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.4e-234], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 2e-184], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 0.65], 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.0152:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1 \cdot 10^{-216}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-234}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-184}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 0.65:\\
\;\;\;\;x \cdot -3\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -0.0152 or 0.650000000000000022 < z Initial program 99.6%
+-commutative99.6%
associate-*l*99.6%
fma-def99.6%
sub-neg99.6%
+-commutative99.6%
distribute-lft-in99.7%
neg-mul-199.7%
associate-*r*99.7%
*-commutative99.7%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 56.0%
Taylor expanded in z around inf 54.1%
*-commutative54.1%
Simplified54.1%
if -0.0152 < z < -1e-216 or 2.3999999999999999e-234 < z < 2.0000000000000001e-184Initial program 99.3%
+-commutative99.3%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 62.9%
Taylor expanded in z around 0 62.6%
*-commutative62.6%
Simplified62.6%
if -1e-216 < z < 2.3999999999999999e-234 or 2.0000000000000001e-184 < z < 0.650000000000000022Initial program 99.4%
Taylor expanded in x around inf 68.9%
*-commutative68.9%
+-commutative68.9%
sub-neg68.9%
distribute-lft-in68.9%
metadata-eval68.9%
metadata-eval68.9%
neg-mul-168.9%
*-commutative68.9%
associate-*l*68.9%
distribute-rgt-in68.9%
+-commutative68.9%
distribute-lft-in68.9%
associate-+r+68.9%
metadata-eval68.9%
metadata-eval68.9%
metadata-eval68.9%
distribute-lft-in68.9%
+-commutative68.9%
distribute-rgt-in68.9%
*-commutative68.9%
associate-*l*68.9%
metadata-eval68.9%
metadata-eval68.9%
Simplified68.9%
Taylor expanded in z around 0 68.9%
*-commutative68.9%
Simplified68.9%
Final simplification60.2%
(FPCore (x y z)
:precision binary64
(if (or (<= (- 0.6666666666666666 z) -20.0)
(not (<= (- 0.6666666666666666 z) 1.0)))
(* -6.0 (* (- y x) z))
(+ x (* (- y x) 4.0))))
double code(double x, double y, double z) {
double tmp;
if (((0.6666666666666666 - z) <= -20.0) || !((0.6666666666666666 - z) <= 1.0)) {
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 (((0.6666666666666666d0 - z) <= (-20.0d0)) .or. (.not. ((0.6666666666666666d0 - z) <= 1.0d0))) 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 (((0.6666666666666666 - z) <= -20.0) || !((0.6666666666666666 - z) <= 1.0)) {
tmp = -6.0 * ((y - x) * z);
} else {
tmp = x + ((y - x) * 4.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if ((0.6666666666666666 - z) <= -20.0) or not ((0.6666666666666666 - z) <= 1.0): tmp = -6.0 * ((y - x) * z) else: tmp = x + ((y - x) * 4.0) return tmp
function code(x, y, z) tmp = 0.0 if ((Float64(0.6666666666666666 - z) <= -20.0) || !(Float64(0.6666666666666666 - z) <= 1.0)) 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 (((0.6666666666666666 - z) <= -20.0) || ~(((0.6666666666666666 - z) <= 1.0))) 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[N[(0.6666666666666666 - z), $MachinePrecision], -20.0], N[Not[LessEqual[N[(0.6666666666666666 - z), $MachinePrecision], 1.0]], $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}\;0.6666666666666666 - z \leq -20 \lor \neg \left(0.6666666666666666 - z \leq 1\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 (-.f64 (/.f64 2 3) z) < -20 or 1 < (-.f64 (/.f64 2 3) z) Initial program 99.6%
Taylor expanded in z around 0 99.7%
Taylor expanded in z around inf 95.8%
if -20 < (-.f64 (/.f64 2 3) z) < 1Initial program 99.3%
Taylor expanded in z around 0 98.4%
Final simplification97.1%
(FPCore (x y z) :precision binary64 (+ (* (- y x) 4.0) (+ x (* -6.0 (* (- y x) z)))))
double code(double x, double y, double z) {
return ((y - x) * 4.0) + (x + (-6.0 * ((y - x) * z)));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = ((y - x) * 4.0d0) + (x + ((-6.0d0) * ((y - x) * z)))
end function
public static double code(double x, double y, double z) {
return ((y - x) * 4.0) + (x + (-6.0 * ((y - x) * z)));
}
def code(x, y, z): return ((y - x) * 4.0) + (x + (-6.0 * ((y - x) * z)))
function code(x, y, z) return Float64(Float64(Float64(y - x) * 4.0) + Float64(x + Float64(-6.0 * Float64(Float64(y - x) * z)))) end
function tmp = code(x, y, z) tmp = ((y - x) * 4.0) + (x + (-6.0 * ((y - x) * z))); end
code[x_, y_, z_] := N[(N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision] + N[(x + N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(y - x\right) \cdot 4 + \left(x + -6 \cdot \left(\left(y - x\right) \cdot z\right)\right)
\end{array}
Initial program 99.5%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.35e+61) (not (<= y 2.1e+55))) (* y (+ 4.0 (* z -6.0))) (* x (+ (* z 6.0) -3.0))))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.35e+61) || !(y <= 2.1e+55)) {
tmp = y * (4.0 + (z * -6.0));
} 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.35d+61)) .or. (.not. (y <= 2.1d+55))) then
tmp = y * (4.0d0 + (z * (-6.0d0)))
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.35e+61) || !(y <= 2.1e+55)) {
tmp = y * (4.0 + (z * -6.0));
} else {
tmp = x * ((z * 6.0) + -3.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.35e+61) or not (y <= 2.1e+55): tmp = y * (4.0 + (z * -6.0)) else: tmp = x * ((z * 6.0) + -3.0) return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.35e+61) || !(y <= 2.1e+55)) tmp = Float64(y * Float64(4.0 + Float64(z * -6.0))); 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.35e+61) || ~((y <= 2.1e+55))) tmp = y * (4.0 + (z * -6.0)); else tmp = x * ((z * 6.0) + -3.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.35e+61], N[Not[LessEqual[y, 2.1e+55]], $MachinePrecision]], N[(y * N[(4.0 + N[(z * -6.0), $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.35 \cdot 10^{+61} \lor \neg \left(y \leq 2.1 \cdot 10^{+55}\right):\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(z \cdot 6 + -3\right)\\
\end{array}
\end{array}
if y < -1.3500000000000001e61 or 2.1000000000000001e55 < y Initial program 99.5%
+-commutative99.5%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
distribute-lft-in99.9%
neg-mul-199.9%
associate-*r*99.9%
*-commutative99.9%
fma-def99.9%
metadata-eval99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 87.5%
if -1.3500000000000001e61 < y < 2.1000000000000001e55Initial program 99.4%
Taylor expanded in x around inf 71.2%
*-commutative71.2%
+-commutative71.2%
sub-neg71.2%
distribute-lft-in71.2%
metadata-eval71.2%
metadata-eval71.2%
neg-mul-171.2%
*-commutative71.2%
associate-*l*71.2%
distribute-rgt-in71.2%
+-commutative71.2%
distribute-lft-in71.2%
associate-+r+71.2%
metadata-eval71.2%
metadata-eval71.2%
metadata-eval71.2%
distribute-lft-in71.2%
+-commutative71.2%
distribute-rgt-in71.2%
*-commutative71.2%
associate-*l*71.2%
metadata-eval71.2%
metadata-eval71.2%
Simplified71.2%
Final simplification77.1%
(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.5%
associate-*l*99.7%
metadata-eval99.7%
Simplified99.7%
Final simplification99.7%
(FPCore (x y z) :precision binary64 (if (<= x -3.6e-45) (* x -3.0) (if (<= x 2.2e-121) (* y 4.0) (* x -3.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= -3.6e-45) {
tmp = x * -3.0;
} else if (x <= 2.2e-121) {
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 (x <= (-3.6d-45)) then
tmp = x * (-3.0d0)
else if (x <= 2.2d-121) 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 (x <= -3.6e-45) {
tmp = x * -3.0;
} else if (x <= 2.2e-121) {
tmp = y * 4.0;
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= -3.6e-45: tmp = x * -3.0 elif x <= 2.2e-121: tmp = y * 4.0 else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if (x <= -3.6e-45) tmp = Float64(x * -3.0); elseif (x <= 2.2e-121) 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 (x <= -3.6e-45) tmp = x * -3.0; elseif (x <= 2.2e-121) tmp = y * 4.0; else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, -3.6e-45], N[(x * -3.0), $MachinePrecision], If[LessEqual[x, 2.2e-121], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.6 \cdot 10^{-45}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-121}:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if x < -3.60000000000000001e-45 or 2.20000000000000021e-121 < x Initial program 99.4%
Taylor expanded in x around inf 72.3%
*-commutative72.3%
+-commutative72.3%
sub-neg72.3%
distribute-lft-in72.3%
metadata-eval72.3%
metadata-eval72.3%
neg-mul-172.3%
*-commutative72.3%
associate-*l*72.3%
distribute-rgt-in72.3%
+-commutative72.3%
distribute-lft-in72.3%
associate-+r+72.3%
metadata-eval72.3%
metadata-eval72.3%
metadata-eval72.3%
distribute-lft-in72.3%
+-commutative72.3%
distribute-rgt-in72.3%
*-commutative72.3%
associate-*l*72.3%
metadata-eval72.3%
metadata-eval72.3%
Simplified72.3%
Taylor expanded in z around 0 43.2%
*-commutative43.2%
Simplified43.2%
if -3.60000000000000001e-45 < x < 2.20000000000000021e-121Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-def99.7%
sub-neg99.7%
+-commutative99.7%
distribute-lft-in99.8%
neg-mul-199.8%
associate-*r*99.8%
*-commutative99.8%
fma-def99.8%
metadata-eval99.8%
metadata-eval99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in y around inf 83.6%
Taylor expanded in z around 0 39.1%
*-commutative39.1%
Simplified39.1%
Final simplification41.6%
(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.5%
Taylor expanded in x around inf 51.2%
*-commutative51.2%
+-commutative51.2%
sub-neg51.2%
distribute-lft-in51.2%
metadata-eval51.2%
metadata-eval51.2%
neg-mul-151.2%
*-commutative51.2%
associate-*l*51.2%
distribute-rgt-in51.2%
+-commutative51.2%
distribute-lft-in51.2%
associate-+r+51.2%
metadata-eval51.2%
metadata-eval51.2%
metadata-eval51.2%
distribute-lft-in51.2%
+-commutative51.2%
distribute-rgt-in51.2%
*-commutative51.2%
associate-*l*51.2%
metadata-eval51.2%
metadata-eval51.2%
Simplified51.2%
Taylor expanded in z around 0 29.9%
*-commutative29.9%
Simplified29.9%
Final simplification29.9%
herbie shell --seed 2023257
(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))))