
(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 (fma (- y x) (+ 4.0 (* z -6.0)) x))
double code(double x, double y, double z) {
return fma((y - x), (4.0 + (z * -6.0)), x);
}
function code(x, y, z) return fma(Float64(y - x), Float64(4.0 + Float64(z * -6.0)), x) end
code[x_, y_, z_] := N[(N[(y - x), $MachinePrecision] * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y - x, 4 + z \cdot -6, x\right)
\end{array}
Initial program 99.5%
+-commutative99.5%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* 6.0 (* x z))))
(if (<= z -210000000.0)
t_0
(if (<= z -3.9e-44)
(* y 4.0)
(if (<= z -5.6e-61)
(* x -3.0)
(if (<= z 0.0245)
(* y 4.0)
(if (<= z 2.45e+240) (* -6.0 (* y z)) t_0)))))))
double code(double x, double y, double z) {
double t_0 = 6.0 * (x * z);
double tmp;
if (z <= -210000000.0) {
tmp = t_0;
} else if (z <= -3.9e-44) {
tmp = y * 4.0;
} else if (z <= -5.6e-61) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.0;
} else if (z <= 2.45e+240) {
tmp = -6.0 * (y * z);
} 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 <= (-210000000.0d0)) then
tmp = t_0
else if (z <= (-3.9d-44)) then
tmp = y * 4.0d0
else if (z <= (-5.6d-61)) then
tmp = x * (-3.0d0)
else if (z <= 0.0245d0) then
tmp = y * 4.0d0
else if (z <= 2.45d+240) then
tmp = (-6.0d0) * (y * z)
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 <= -210000000.0) {
tmp = t_0;
} else if (z <= -3.9e-44) {
tmp = y * 4.0;
} else if (z <= -5.6e-61) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.0;
} else if (z <= 2.45e+240) {
tmp = -6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = 6.0 * (x * z) tmp = 0 if z <= -210000000.0: tmp = t_0 elif z <= -3.9e-44: tmp = y * 4.0 elif z <= -5.6e-61: tmp = x * -3.0 elif z <= 0.0245: tmp = y * 4.0 elif z <= 2.45e+240: tmp = -6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(6.0 * Float64(x * z)) tmp = 0.0 if (z <= -210000000.0) tmp = t_0; elseif (z <= -3.9e-44) tmp = Float64(y * 4.0); elseif (z <= -5.6e-61) tmp = Float64(x * -3.0); elseif (z <= 0.0245) tmp = Float64(y * 4.0); elseif (z <= 2.45e+240) tmp = Float64(-6.0 * Float64(y * z)); 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 <= -210000000.0) tmp = t_0; elseif (z <= -3.9e-44) tmp = y * 4.0; elseif (z <= -5.6e-61) tmp = x * -3.0; elseif (z <= 0.0245) tmp = y * 4.0; elseif (z <= 2.45e+240) tmp = -6.0 * (y * z); 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, -210000000.0], t$95$0, If[LessEqual[z, -3.9e-44], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5.6e-61], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.0245], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 2.45e+240], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 6 \cdot \left(x \cdot z\right)\\
\mathbf{if}\;z \leq -210000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.9 \cdot 10^{-44}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -5.6 \cdot 10^{-61}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.0245:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 2.45 \cdot 10^{+240}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.1e8 or 2.45e240 < z Initial program 99.7%
+-commutative99.7%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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 x around -inf 97.1%
Taylor expanded in z around inf 99.1%
Taylor expanded in y around 0 61.5%
if -2.1e8 < z < -3.9000000000000002e-44 or -5.6000000000000002e-61 < z < 0.024500000000000001Initial program 99.4%
+-commutative99.4%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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 inf 61.7%
Taylor expanded in z around 0 59.1%
if -3.9000000000000002e-44 < z < -5.6000000000000002e-61Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
neg-mul-173.3%
associate-*r*73.3%
*-commutative73.3%
distribute-lft-in73.3%
distribute-lft-in73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-+r+73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-*r*73.3%
metadata-eval73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in z around 0 73.3%
*-commutative73.3%
Simplified73.3%
if 0.024500000000000001 < z < 2.45e240Initial program 99.6%
+-commutative99.6%
associate-*l*99.6%
fma-def99.6%
sub-neg99.6%
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 x around -inf 96.0%
Taylor expanded in z around inf 94.5%
Taylor expanded in y around inf 60.3%
*-commutative60.3%
Simplified60.3%
Final simplification60.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (* z 6.0))))
(if (<= z -210000000.0)
t_0
(if (<= z -2.25e-43)
(* y 4.0)
(if (<= z -1.35e-60)
(* x -3.0)
(if (<= z 0.0245)
(* y 4.0)
(if (<= z 6.4e+241) (* -6.0 (* y z)) t_0)))))))
double code(double x, double y, double z) {
double t_0 = x * (z * 6.0);
double tmp;
if (z <= -210000000.0) {
tmp = t_0;
} else if (z <= -2.25e-43) {
tmp = y * 4.0;
} else if (z <= -1.35e-60) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.0;
} else if (z <= 6.4e+241) {
tmp = -6.0 * (y * z);
} 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 <= (-210000000.0d0)) then
tmp = t_0
else if (z <= (-2.25d-43)) then
tmp = y * 4.0d0
else if (z <= (-1.35d-60)) then
tmp = x * (-3.0d0)
else if (z <= 0.0245d0) then
tmp = y * 4.0d0
else if (z <= 6.4d+241) then
tmp = (-6.0d0) * (y * z)
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 <= -210000000.0) {
tmp = t_0;
} else if (z <= -2.25e-43) {
tmp = y * 4.0;
} else if (z <= -1.35e-60) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.0;
} else if (z <= 6.4e+241) {
tmp = -6.0 * (y * z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = x * (z * 6.0) tmp = 0 if z <= -210000000.0: tmp = t_0 elif z <= -2.25e-43: tmp = y * 4.0 elif z <= -1.35e-60: tmp = x * -3.0 elif z <= 0.0245: tmp = y * 4.0 elif z <= 6.4e+241: tmp = -6.0 * (y * z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(x * Float64(z * 6.0)) tmp = 0.0 if (z <= -210000000.0) tmp = t_0; elseif (z <= -2.25e-43) tmp = Float64(y * 4.0); elseif (z <= -1.35e-60) tmp = Float64(x * -3.0); elseif (z <= 0.0245) tmp = Float64(y * 4.0); elseif (z <= 6.4e+241) tmp = Float64(-6.0 * Float64(y * z)); 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 <= -210000000.0) tmp = t_0; elseif (z <= -2.25e-43) tmp = y * 4.0; elseif (z <= -1.35e-60) tmp = x * -3.0; elseif (z <= 0.0245) tmp = y * 4.0; elseif (z <= 6.4e+241) tmp = -6.0 * (y * z); 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, -210000000.0], t$95$0, If[LessEqual[z, -2.25e-43], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -1.35e-60], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.0245], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, 6.4e+241], N[(-6.0 * N[(y * z), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \left(z \cdot 6\right)\\
\mathbf{if}\;z \leq -210000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-43}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -1.35 \cdot 10^{-60}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.0245:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{+241}:\\
\;\;\;\;-6 \cdot \left(y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -2.1e8 or 6.40000000000000009e241 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in x around inf 62.2%
sub-neg62.2%
distribute-rgt-in62.2%
metadata-eval62.2%
metadata-eval62.2%
neg-mul-162.2%
associate-*r*62.2%
*-commutative62.2%
distribute-lft-in62.2%
distribute-lft-in62.2%
metadata-eval62.2%
metadata-eval62.2%
associate-+r+62.2%
metadata-eval62.2%
metadata-eval62.2%
associate-*r*62.2%
metadata-eval62.2%
*-commutative62.2%
Simplified62.2%
Taylor expanded in z around inf 61.6%
if -2.1e8 < z < -2.25000000000000012e-43 or -1.35e-60 < z < 0.024500000000000001Initial program 99.4%
+-commutative99.4%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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 inf 61.7%
Taylor expanded in z around 0 59.1%
if -2.25000000000000012e-43 < z < -1.35e-60Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
neg-mul-173.3%
associate-*r*73.3%
*-commutative73.3%
distribute-lft-in73.3%
distribute-lft-in73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-+r+73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-*r*73.3%
metadata-eval73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in z around 0 73.3%
*-commutative73.3%
Simplified73.3%
if 0.024500000000000001 < z < 6.40000000000000009e241Initial program 99.6%
+-commutative99.6%
associate-*l*99.6%
fma-def99.6%
sub-neg99.6%
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 x around -inf 96.0%
Taylor expanded in z around inf 94.5%
Taylor expanded in y around inf 60.3%
*-commutative60.3%
Simplified60.3%
Final simplification60.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -7e-5)
t_0
(if (<= z -3.4e-39)
(* y 4.0)
(if (<= z -4.1e-61) (* x -3.0) (if (<= z 0.66) (* y 4.0) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7e-5) {
tmp = t_0;
} else if (z <= -3.4e-39) {
tmp = y * 4.0;
} else if (z <= -4.1e-61) {
tmp = x * -3.0;
} else if (z <= 0.66) {
tmp = y * 4.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 <= (-7d-5)) then
tmp = t_0
else if (z <= (-3.4d-39)) then
tmp = y * 4.0d0
else if (z <= (-4.1d-61)) then
tmp = x * (-3.0d0)
else if (z <= 0.66d0) then
tmp = y * 4.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 <= -7e-5) {
tmp = t_0;
} else if (z <= -3.4e-39) {
tmp = y * 4.0;
} else if (z <= -4.1e-61) {
tmp = x * -3.0;
} else if (z <= 0.66) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * ((y - x) * z) tmp = 0 if z <= -7e-5: tmp = t_0 elif z <= -3.4e-39: tmp = y * 4.0 elif z <= -4.1e-61: tmp = x * -3.0 elif z <= 0.66: tmp = y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -3.4e-39) tmp = Float64(y * 4.0); elseif (z <= -4.1e-61) tmp = Float64(x * -3.0); elseif (z <= 0.66) tmp = Float64(y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -3.4e-39) tmp = y * 4.0; elseif (z <= -4.1e-61) tmp = x * -3.0; elseif (z <= 0.66) tmp = y * 4.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, -7e-5], t$95$0, If[LessEqual[z, -3.4e-39], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -4.1e-61], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.66], N[(y * 4.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 -7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -3.4 \cdot 10^{-39}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -4.1 \cdot 10^{-61}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -6.9999999999999994e-5 or 0.660000000000000031 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 97.0%
if -6.9999999999999994e-5 < z < -3.3999999999999999e-39 or -4.09999999999999999e-61 < z < 0.660000000000000031Initial program 99.4%
+-commutative99.4%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 61.3%
Taylor expanded in z around 0 59.4%
if -3.3999999999999999e-39 < z < -4.09999999999999999e-61Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
neg-mul-173.3%
associate-*r*73.3%
*-commutative73.3%
distribute-lft-in73.3%
distribute-lft-in73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-+r+73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-*r*73.3%
metadata-eval73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in z around 0 73.3%
*-commutative73.3%
Simplified73.3%
Final simplification78.4%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* (- y x) z))))
(if (<= z -7e-5)
t_0
(if (<= z -1.52e-37)
(* y 4.0)
(if (<= z -5e-61)
(* x (+ -3.0 (* z 6.0)))
(if (<= z 0.66) (* y 4.0) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * ((y - x) * z);
double tmp;
if (z <= -7e-5) {
tmp = t_0;
} else if (z <= -1.52e-37) {
tmp = y * 4.0;
} else if (z <= -5e-61) {
tmp = x * (-3.0 + (z * 6.0));
} else if (z <= 0.66) {
tmp = y * 4.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 <= (-7d-5)) then
tmp = t_0
else if (z <= (-1.52d-37)) then
tmp = y * 4.0d0
else if (z <= (-5d-61)) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else if (z <= 0.66d0) then
tmp = y * 4.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 <= -7e-5) {
tmp = t_0;
} else if (z <= -1.52e-37) {
tmp = y * 4.0;
} else if (z <= -5e-61) {
tmp = x * (-3.0 + (z * 6.0));
} else if (z <= 0.66) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * ((y - x) * z) tmp = 0 if z <= -7e-5: tmp = t_0 elif z <= -1.52e-37: tmp = y * 4.0 elif z <= -5e-61: tmp = x * (-3.0 + (z * 6.0)) elif z <= 0.66: tmp = y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -1.52e-37) tmp = Float64(y * 4.0); elseif (z <= -5e-61) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); elseif (z <= 0.66) tmp = Float64(y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -1.52e-37) tmp = y * 4.0; elseif (z <= -5e-61) tmp = x * (-3.0 + (z * 6.0)); elseif (z <= 0.66) tmp = y * 4.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, -7e-5], t$95$0, If[LessEqual[z, -1.52e-37], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -5e-61], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.66], N[(y * 4.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 -7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.52 \cdot 10^{-37}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-61}:\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{elif}\;z \leq 0.66:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -6.9999999999999994e-5 or 0.660000000000000031 < z Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 97.0%
if -6.9999999999999994e-5 < z < -1.52e-37 or -4.9999999999999999e-61 < z < 0.660000000000000031Initial program 99.4%
+-commutative99.4%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
distribute-rgt-in99.9%
metadata-eval99.9%
metadata-eval99.9%
distribute-lft-neg-out99.9%
distribute-rgt-neg-in99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in y around inf 61.3%
Taylor expanded in z around 0 59.4%
if -1.52e-37 < z < -4.9999999999999999e-61Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
neg-mul-173.3%
associate-*r*73.3%
*-commutative73.3%
distribute-lft-in73.3%
distribute-lft-in73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-+r+73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-*r*73.3%
metadata-eval73.3%
*-commutative73.3%
Simplified73.3%
Final simplification78.4%
(FPCore (x y z) :precision binary64 (+ x (+ (* -6.0 (* (- y x) z)) (* (- y x) 4.0))))
double code(double x, double y, double z) {
return x + ((-6.0 * ((y - x) * z)) + ((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) * ((y - x) * z)) + ((y - x) * 4.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0));
}
def code(x, y, z): return x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0))
function code(x, y, z) return Float64(x + Float64(Float64(-6.0 * Float64(Float64(y - x) * z)) + Float64(Float64(y - x) * 4.0))) end
function tmp = code(x, y, z) tmp = x + ((-6.0 * ((y - x) * z)) + ((y - x) * 4.0)); end
code[x_, y_, z_] := N[(x + N[(N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(-6 \cdot \left(\left(y - x\right) \cdot z\right) + \left(y - x\right) \cdot 4\right)
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* -6.0 (* y z))))
(if (<= z -7e-5)
t_0
(if (<= z -1.3e-36)
(* y 4.0)
(if (<= z -9.4e-61) (* x -3.0) (if (<= z 0.0245) (* y 4.0) t_0))))))
double code(double x, double y, double z) {
double t_0 = -6.0 * (y * z);
double tmp;
if (z <= -7e-5) {
tmp = t_0;
} else if (z <= -1.3e-36) {
tmp = y * 4.0;
} else if (z <= -9.4e-61) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.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 <= (-7d-5)) then
tmp = t_0
else if (z <= (-1.3d-36)) then
tmp = y * 4.0d0
else if (z <= (-9.4d-61)) then
tmp = x * (-3.0d0)
else if (z <= 0.0245d0) then
tmp = y * 4.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 <= -7e-5) {
tmp = t_0;
} else if (z <= -1.3e-36) {
tmp = y * 4.0;
} else if (z <= -9.4e-61) {
tmp = x * -3.0;
} else if (z <= 0.0245) {
tmp = y * 4.0;
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = -6.0 * (y * z) tmp = 0 if z <= -7e-5: tmp = t_0 elif z <= -1.3e-36: tmp = y * 4.0 elif z <= -9.4e-61: tmp = x * -3.0 elif z <= 0.0245: tmp = y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -1.3e-36) tmp = Float64(y * 4.0); elseif (z <= -9.4e-61) tmp = Float64(x * -3.0); elseif (z <= 0.0245) tmp = Float64(y * 4.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 <= -7e-5) tmp = t_0; elseif (z <= -1.3e-36) tmp = y * 4.0; elseif (z <= -9.4e-61) tmp = x * -3.0; elseif (z <= 0.0245) tmp = y * 4.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, -7e-5], t$95$0, If[LessEqual[z, -1.3e-36], N[(y * 4.0), $MachinePrecision], If[LessEqual[z, -9.4e-61], N[(x * -3.0), $MachinePrecision], If[LessEqual[z, 0.0245], N[(y * 4.0), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := -6 \cdot \left(y \cdot z\right)\\
\mathbf{if}\;z \leq -7 \cdot 10^{-5}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq -1.3 \cdot 10^{-36}:\\
\;\;\;\;y \cdot 4\\
\mathbf{elif}\;z \leq -9.4 \cdot 10^{-61}:\\
\;\;\;\;x \cdot -3\\
\mathbf{elif}\;z \leq 0.0245:\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if z < -6.9999999999999994e-5 or 0.024500000000000001 < z Initial program 99.7%
+-commutative99.7%
associate-*l*99.7%
fma-def99.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 x around -inf 96.6%
Taylor expanded in z around inf 96.2%
Taylor expanded in y around inf 51.1%
*-commutative51.1%
Simplified51.1%
if -6.9999999999999994e-5 < z < -1.3e-36 or -9.3999999999999993e-61 < z < 0.024500000000000001Initial program 99.4%
+-commutative99.4%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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 inf 61.8%
Taylor expanded in z around 0 59.9%
if -1.3e-36 < z < -9.3999999999999993e-61Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 73.3%
sub-neg73.3%
distribute-rgt-in73.3%
metadata-eval73.3%
metadata-eval73.3%
neg-mul-173.3%
associate-*r*73.3%
*-commutative73.3%
distribute-lft-in73.3%
distribute-lft-in73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-+r+73.3%
metadata-eval73.3%
metadata-eval73.3%
associate-*r*73.3%
metadata-eval73.3%
*-commutative73.3%
Simplified73.3%
Taylor expanded in z around 0 73.3%
*-commutative73.3%
Simplified73.3%
Final simplification56.0%
(FPCore (x y z) :precision binary64 (if (<= z -0.58) (* -6.0 (* (- y x) z)) (if (<= z 0.62) (+ x (* (- y x) 4.0)) (* z (+ (* y -6.0) (* x 6.0))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.58) {
tmp = -6.0 * ((y - x) * z);
} else if (z <= 0.62) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = z * ((y * -6.0) + (x * 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 (z <= (-0.58d0)) then
tmp = (-6.0d0) * ((y - x) * z)
else if (z <= 0.62d0) then
tmp = x + ((y - x) * 4.0d0)
else
tmp = z * ((y * (-6.0d0)) + (x * 6.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.58) {
tmp = -6.0 * ((y - x) * z);
} else if (z <= 0.62) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = z * ((y * -6.0) + (x * 6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.58: tmp = -6.0 * ((y - x) * z) elif z <= 0.62: tmp = x + ((y - x) * 4.0) else: tmp = z * ((y * -6.0) + (x * 6.0)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.58) tmp = Float64(-6.0 * Float64(Float64(y - x) * z)); elseif (z <= 0.62) tmp = Float64(x + Float64(Float64(y - x) * 4.0)); else tmp = Float64(z * Float64(Float64(y * -6.0) + Float64(x * 6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.58) tmp = -6.0 * ((y - x) * z); elseif (z <= 0.62) tmp = x + ((y - x) * 4.0); else tmp = z * ((y * -6.0) + (x * 6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.58], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.62], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(N[(y * -6.0), $MachinePrecision] + N[(x * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.58:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 0.62:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot -6 + x \cdot 6\right)\\
\end{array}
\end{array}
if z < -0.57999999999999996Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.5%
if -0.57999999999999996 < z < 0.619999999999999996Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.5%
if 0.619999999999999996 < z Initial program 99.6%
+-commutative99.6%
associate-*l*99.7%
fma-def99.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 x around -inf 95.0%
Taylor expanded in z around inf 96.9%
Final simplification97.1%
(FPCore (x y z) :precision binary64 (if (or (<= x -7.5e+34) (not (<= x 8e-23))) (* x (+ -3.0 (* z 6.0))) (* y (+ 4.0 (* z -6.0)))))
double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e+34) || !(x <= 8e-23)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.0 + (z * -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 <= (-7.5d+34)) .or. (.not. (x <= 8d-23))) then
tmp = x * ((-3.0d0) + (z * 6.0d0))
else
tmp = y * (4.0d0 + (z * (-6.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((x <= -7.5e+34) || !(x <= 8e-23)) {
tmp = x * (-3.0 + (z * 6.0));
} else {
tmp = y * (4.0 + (z * -6.0));
}
return tmp;
}
def code(x, y, z): tmp = 0 if (x <= -7.5e+34) or not (x <= 8e-23): tmp = x * (-3.0 + (z * 6.0)) else: tmp = y * (4.0 + (z * -6.0)) return tmp
function code(x, y, z) tmp = 0.0 if ((x <= -7.5e+34) || !(x <= 8e-23)) tmp = Float64(x * Float64(-3.0 + Float64(z * 6.0))); else tmp = Float64(y * Float64(4.0 + Float64(z * -6.0))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((x <= -7.5e+34) || ~((x <= 8e-23))) tmp = x * (-3.0 + (z * 6.0)); else tmp = y * (4.0 + (z * -6.0)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[x, -7.5e+34], N[Not[LessEqual[x, 8e-23]], $MachinePrecision]], N[(x * N[(-3.0 + N[(z * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(4.0 + N[(z * -6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7.5 \cdot 10^{+34} \lor \neg \left(x \leq 8 \cdot 10^{-23}\right):\\
\;\;\;\;x \cdot \left(-3 + z \cdot 6\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(4 + z \cdot -6\right)\\
\end{array}
\end{array}
if x < -7.49999999999999976e34 or 7.99999999999999968e-23 < x Initial program 99.6%
metadata-eval99.6%
Simplified99.6%
Taylor expanded in x around inf 80.0%
sub-neg80.0%
distribute-rgt-in80.0%
metadata-eval80.0%
metadata-eval80.0%
neg-mul-180.0%
associate-*r*80.0%
*-commutative80.0%
distribute-lft-in80.0%
distribute-lft-in80.0%
metadata-eval80.0%
metadata-eval80.0%
associate-+r+80.0%
metadata-eval80.0%
metadata-eval80.0%
associate-*r*80.0%
metadata-eval80.0%
*-commutative80.0%
Simplified80.0%
if -7.49999999999999976e34 < x < 7.99999999999999968e-23Initial program 99.5%
+-commutative99.5%
associate-*l*99.7%
fma-def99.8%
sub-neg99.8%
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 inf 80.7%
Final simplification80.4%
(FPCore (x y z) :precision binary64 (if (<= z -0.6) (* -6.0 (* (- y x) z)) (if (<= z 0.5) (+ x (* (- y x) 4.0)) (* z (* 6.0 (- x y))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.6) {
tmp = -6.0 * ((y - x) * z);
} else if (z <= 0.5) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = z * (6.0 * (x - y));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.6d0)) then
tmp = (-6.0d0) * ((y - x) * z)
else if (z <= 0.5d0) then
tmp = x + ((y - x) * 4.0d0)
else
tmp = z * (6.0d0 * (x - y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.6) {
tmp = -6.0 * ((y - x) * z);
} else if (z <= 0.5) {
tmp = x + ((y - x) * 4.0);
} else {
tmp = z * (6.0 * (x - y));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.6: tmp = -6.0 * ((y - x) * z) elif z <= 0.5: tmp = x + ((y - x) * 4.0) else: tmp = z * (6.0 * (x - y)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.6) tmp = Float64(-6.0 * Float64(Float64(y - x) * z)); elseif (z <= 0.5) tmp = Float64(x + Float64(Float64(y - x) * 4.0)); else tmp = Float64(z * Float64(6.0 * Float64(x - y))); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.6) tmp = -6.0 * ((y - x) * z); elseif (z <= 0.5) tmp = x + ((y - x) * 4.0); else tmp = z * (6.0 * (x - y)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.6], N[(-6.0 * N[(N[(y - x), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.5], N[(x + N[(N[(y - x), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision], N[(z * N[(6.0 * N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.6:\\
\;\;\;\;-6 \cdot \left(\left(y - x\right) \cdot z\right)\\
\mathbf{elif}\;z \leq 0.5:\\
\;\;\;\;x + \left(y - x\right) \cdot 4\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(6 \cdot \left(x - y\right)\right)\\
\end{array}
\end{array}
if z < -0.599999999999999978Initial program 99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around 0 99.8%
Taylor expanded in z around inf 98.5%
if -0.599999999999999978 < z < 0.5Initial program 99.4%
metadata-eval99.4%
Simplified99.4%
Taylor expanded in z around 0 96.5%
if 0.5 < z Initial program 99.6%
+-commutative99.6%
associate-*l*99.7%
fma-def99.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 x around -inf 95.0%
Taylor expanded in z around inf 96.9%
Taylor expanded in y around 0 92.2%
associate-*r*92.1%
associate-*r*92.1%
distribute-rgt-in96.9%
+-commutative96.9%
*-commutative96.9%
metadata-eval96.9%
cancel-sign-sub-inv96.9%
*-commutative96.9%
distribute-rgt-out--96.9%
Simplified96.9%
Final simplification97.1%
(FPCore (x y z) :precision binary64 (+ x (* (- 0.6666666666666666 z) (* (- y x) 6.0))))
double code(double x, double y, double z) {
return x + ((0.6666666666666666 - z) * ((y - x) * 6.0));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = x + ((0.6666666666666666d0 - z) * ((y - x) * 6.0d0))
end function
public static double code(double x, double y, double z) {
return x + ((0.6666666666666666 - z) * ((y - x) * 6.0));
}
def code(x, y, z): return x + ((0.6666666666666666 - z) * ((y - x) * 6.0))
function code(x, y, z) return Float64(x + Float64(Float64(0.6666666666666666 - z) * Float64(Float64(y - x) * 6.0))) end
function tmp = code(x, y, z) tmp = x + ((0.6666666666666666 - z) * ((y - x) * 6.0)); end
code[x_, y_, z_] := N[(x + N[(N[(0.6666666666666666 - z), $MachinePrecision] * N[(N[(y - x), $MachinePrecision] * 6.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(0.6666666666666666 - z\right) \cdot \left(\left(y - x\right) \cdot 6\right)
\end{array}
Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Final simplification99.5%
(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%
+-commutative99.5%
associate-*l*99.8%
fma-def99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.2e-56) (not (<= y 5.3e-79))) (* y 4.0) (* x -3.0)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.2e-56) || !(y <= 5.3e-79)) {
tmp = y * 4.0;
} else {
tmp = x * -3.0;
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if ((y <= (-1.2d-56)) .or. (.not. (y <= 5.3d-79))) then
tmp = y * 4.0d0
else
tmp = x * (-3.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -1.2e-56) || !(y <= 5.3e-79)) {
tmp = y * 4.0;
} else {
tmp = x * -3.0;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.2e-56) or not (y <= 5.3e-79): tmp = y * 4.0 else: tmp = x * -3.0 return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.2e-56) || !(y <= 5.3e-79)) tmp = Float64(y * 4.0); else tmp = Float64(x * -3.0); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.2e-56) || ~((y <= 5.3e-79))) tmp = y * 4.0; else tmp = x * -3.0; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.2e-56], N[Not[LessEqual[y, 5.3e-79]], $MachinePrecision]], N[(y * 4.0), $MachinePrecision], N[(x * -3.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.2 \cdot 10^{-56} \lor \neg \left(y \leq 5.3 \cdot 10^{-79}\right):\\
\;\;\;\;y \cdot 4\\
\mathbf{else}:\\
\;\;\;\;x \cdot -3\\
\end{array}
\end{array}
if y < -1.2e-56 or 5.2999999999999998e-79 < y Initial program 99.6%
+-commutative99.6%
associate-*l*99.8%
fma-def99.8%
sub-neg99.8%
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 inf 75.8%
Taylor expanded in z around 0 41.1%
if -1.2e-56 < y < 5.2999999999999998e-79Initial program 99.5%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 81.1%
sub-neg81.1%
distribute-rgt-in81.1%
metadata-eval81.1%
metadata-eval81.1%
neg-mul-181.1%
associate-*r*81.1%
*-commutative81.1%
distribute-lft-in81.1%
distribute-lft-in81.1%
metadata-eval81.1%
metadata-eval81.1%
associate-+r+81.1%
metadata-eval81.1%
metadata-eval81.1%
associate-*r*81.1%
metadata-eval81.1%
*-commutative81.1%
Simplified81.1%
Taylor expanded in z around 0 40.9%
*-commutative40.9%
Simplified40.9%
Final simplification41.0%
(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%
metadata-eval99.5%
Simplified99.5%
Taylor expanded in x around inf 47.2%
sub-neg47.2%
distribute-rgt-in47.2%
metadata-eval47.2%
metadata-eval47.2%
neg-mul-147.2%
associate-*r*47.2%
*-commutative47.2%
distribute-lft-in47.2%
distribute-lft-in47.2%
metadata-eval47.2%
metadata-eval47.2%
associate-+r+47.2%
metadata-eval47.2%
metadata-eval47.2%
associate-*r*47.2%
metadata-eval47.2%
*-commutative47.2%
Simplified47.2%
Taylor expanded in z around 0 22.6%
*-commutative22.6%
Simplified22.6%
Final simplification22.6%
herbie shell --seed 2024010
(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))))