
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (y * 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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (* x (- 1.0 (* y z))))
double code(double x, double y, double z) {
return x * (1.0 - (y * 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 * (1.0d0 - (y * z))
end function
public static double code(double x, double y, double z) {
return x * (1.0 - (y * z));
}
def code(x, y, z): return x * (1.0 - (y * z))
function code(x, y, z) return Float64(x * Float64(1.0 - Float64(y * z))) end
function tmp = code(x, y, z) tmp = x * (1.0 - (y * z)); end
code[x_, y_, z_] := N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(1 - y \cdot z\right)
\end{array}
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= (* y z) -5e+219) (* y (/ z (/ -1.0 x))) (if (<= (* y z) 2e+222) (* x (- 1.0 (* y z))) (* (- 0.0 z) (* y x)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -5e+219) {
tmp = y * (z / (-1.0 / x));
} else if ((y * z) <= 2e+222) {
tmp = x * (1.0 - (y * z));
} else {
tmp = (0.0 - z) * (y * x);
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 * z) <= (-5d+219)) then
tmp = y * (z / ((-1.0d0) / x))
else if ((y * z) <= 2d+222) then
tmp = x * (1.0d0 - (y * z))
else
tmp = (0.0d0 - z) * (y * x)
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if ((y * z) <= -5e+219) {
tmp = y * (z / (-1.0 / x));
} else if ((y * z) <= 2e+222) {
tmp = x * (1.0 - (y * z));
} else {
tmp = (0.0 - z) * (y * x);
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if (y * z) <= -5e+219: tmp = y * (z / (-1.0 / x)) elif (y * z) <= 2e+222: tmp = x * (1.0 - (y * z)) else: tmp = (0.0 - z) * (y * x) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (Float64(y * z) <= -5e+219) tmp = Float64(y * Float64(z / Float64(-1.0 / x))); elseif (Float64(y * z) <= 2e+222) tmp = Float64(x * Float64(1.0 - Float64(y * z))); else tmp = Float64(Float64(0.0 - z) * Float64(y * x)); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if ((y * z) <= -5e+219)
tmp = y * (z / (-1.0 / x));
elseif ((y * z) <= 2e+222)
tmp = x * (1.0 - (y * z));
else
tmp = (0.0 - z) * (y * x);
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[N[(y * z), $MachinePrecision], -5e+219], N[(y * N[(z / N[(-1.0 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * z), $MachinePrecision], 2e+222], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.0 - z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+219}:\\
\;\;\;\;y \cdot \frac{z}{\frac{-1}{x}}\\
\mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+222}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(0 - z\right) \cdot \left(y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 y z) < -5e219Initial program 77.1%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6499.9%
Simplified99.9%
sub0-negN/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f6499.9%
Applied egg-rr99.9%
*-commutativeN/A
distribute-rgt-neg-outN/A
distribute-lft-neg-inN/A
*-lowering-*.f64N/A
remove-double-divN/A
un-div-invN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
distribute-neg-fracN/A
metadata-evalN/A
/-lowering-/.f6499.8%
Applied egg-rr99.8%
if -5e219 < (*.f64 y z) < 2.0000000000000001e222Initial program 99.8%
if 2.0000000000000001e222 < (*.f64 y z) Initial program 74.2%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6499.8%
Simplified99.8%
sub0-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
associate-*l*N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.8%
Applied egg-rr99.8%
Final simplification99.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -2.55e+113) (fma (- 0.0 z) (* y x) x) (- x (* x (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2.55e+113) {
tmp = fma((0.0 - z), (y * x), x);
} else {
tmp = x - (x * (y * z));
}
return tmp;
}
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2.55e+113) tmp = fma(Float64(0.0 - z), Float64(y * x), x); else tmp = Float64(x - Float64(x * Float64(y * z))); end return tmp end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -2.55e+113], N[(N[(0.0 - z), $MachinePrecision] * N[(y * x), $MachinePrecision] + x), $MachinePrecision], N[(x - N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.55 \cdot 10^{+113}:\\
\;\;\;\;\mathsf{fma}\left(0 - z, y \cdot x, x\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.54999999999999997e113Initial program 92.1%
sub-negN/A
+-commutativeN/A
distribute-rgt-inN/A
*-lft-identityN/A
*-commutativeN/A
distribute-lft-neg-inN/A
associate-*l*N/A
fma-defineN/A
fma-lowering-fma.f64N/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
if -2.54999999999999997e113 < y Initial program 95.1%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6495.2%
Applied egg-rr95.2%
Final simplification95.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- 0.0 z) (* y x))))
(if (<= (* y z) -500.0)
t_0
(if (<= (* y z) 1.0)
x
(if (<= (* y z) 2e+222) (* x (* y (- 0.0 z))) t_0)))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if ((y * z) <= -500.0) {
tmp = t_0;
} else if ((y * z) <= 1.0) {
tmp = x;
} else if ((y * z) <= 2e+222) {
tmp = x * (y * (0.0 - z));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = (0.0d0 - z) * (y * x)
if ((y * z) <= (-500.0d0)) then
tmp = t_0
else if ((y * z) <= 1.0d0) then
tmp = x
else if ((y * z) <= 2d+222) then
tmp = x * (y * (0.0d0 - z))
else
tmp = t_0
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if ((y * z) <= -500.0) {
tmp = t_0;
} else if ((y * z) <= 1.0) {
tmp = x;
} else if ((y * z) <= 2e+222) {
tmp = x * (y * (0.0 - z));
} else {
tmp = t_0;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = (0.0 - z) * (y * x) tmp = 0 if (y * z) <= -500.0: tmp = t_0 elif (y * z) <= 1.0: tmp = x elif (y * z) <= 2e+222: tmp = x * (y * (0.0 - z)) else: tmp = t_0 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(Float64(0.0 - z) * Float64(y * x)) tmp = 0.0 if (Float64(y * z) <= -500.0) tmp = t_0; elseif (Float64(y * z) <= 1.0) tmp = x; elseif (Float64(y * z) <= 2e+222) tmp = Float64(x * Float64(y * Float64(0.0 - z))); else tmp = t_0; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = (0.0 - z) * (y * x);
tmp = 0.0;
if ((y * z) <= -500.0)
tmp = t_0;
elseif ((y * z) <= 1.0)
tmp = x;
elseif ((y * z) <= 2e+222)
tmp = x * (y * (0.0 - z));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.0 - z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -500.0], t$95$0, If[LessEqual[N[(y * z), $MachinePrecision], 1.0], x, If[LessEqual[N[(y * z), $MachinePrecision], 2e+222], N[(x * N[(y * N[(0.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \left(0 - z\right) \cdot \left(y \cdot x\right)\\
\mathbf{if}\;y \cdot z \leq -500:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \cdot z \leq 1:\\
\;\;\;\;x\\
\mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+222}:\\
\;\;\;\;x \cdot \left(y \cdot \left(0 - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 y z) < -500 or 2.0000000000000001e222 < (*.f64 y z) Initial program 84.1%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6491.0%
Simplified91.0%
sub0-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
associate-*l*N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.8%
Applied egg-rr92.8%
if -500 < (*.f64 y z) < 1Initial program 100.0%
Taylor expanded in y around 0
Simplified97.9%
if 1 < (*.f64 y z) < 2.0000000000000001e222Initial program 99.6%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6489.1%
Simplified89.1%
sub0-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
associate-*l*N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6479.0%
Applied egg-rr79.0%
associate-*r*N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6495.5%
Applied egg-rr95.5%
Final simplification95.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function.
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* (- 0.0 z) (* y x))))
(if (<= (* y z) -5e+231)
t_0
(if (<= (* y z) 2e+222) (* x (- 1.0 (* y z))) t_0))))assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if ((y * z) <= -5e+231) {
tmp = t_0;
} else if ((y * z) <= 2e+222) {
tmp = x * (1.0 - (y * z));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = (0.0d0 - z) * (y * x)
if ((y * z) <= (-5d+231)) then
tmp = t_0
else if ((y * z) <= 2d+222) then
tmp = x * (1.0d0 - (y * z))
else
tmp = t_0
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if ((y * z) <= -5e+231) {
tmp = t_0;
} else if ((y * z) <= 2e+222) {
tmp = x * (1.0 - (y * z));
} else {
tmp = t_0;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = (0.0 - z) * (y * x) tmp = 0 if (y * z) <= -5e+231: tmp = t_0 elif (y * z) <= 2e+222: tmp = x * (1.0 - (y * z)) else: tmp = t_0 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(Float64(0.0 - z) * Float64(y * x)) tmp = 0.0 if (Float64(y * z) <= -5e+231) tmp = t_0; elseif (Float64(y * z) <= 2e+222) tmp = Float64(x * Float64(1.0 - Float64(y * z))); else tmp = t_0; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = (0.0 - z) * (y * x);
tmp = 0.0;
if ((y * z) <= -5e+231)
tmp = t_0;
elseif ((y * z) <= 2e+222)
tmp = x * (1.0 - (y * z));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.0 - z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * z), $MachinePrecision], -5e+231], t$95$0, If[LessEqual[N[(y * z), $MachinePrecision], 2e+222], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \left(0 - z\right) \cdot \left(y \cdot x\right)\\
\mathbf{if}\;y \cdot z \leq -5 \cdot 10^{+231}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \cdot z \leq 2 \cdot 10^{+222}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 y z) < -5.00000000000000028e231 or 2.0000000000000001e222 < (*.f64 y z) Initial program 75.6%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6499.8%
Simplified99.8%
sub0-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
associate-*l*N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.8%
Applied egg-rr99.8%
if -5.00000000000000028e231 < (*.f64 y z) < 2.0000000000000001e222Initial program 99.8%
Final simplification99.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (let* ((t_0 (* (- 0.0 z) (* y x)))) (if (<= y -6.3e+63) t_0 (if (<= y 6.8e-105) x t_0))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if (y <= -6.3e+63) {
tmp = t_0;
} else if (y <= 6.8e-105) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 = (0.0d0 - z) * (y * x)
if (y <= (-6.3d+63)) then
tmp = t_0
else if (y <= 6.8d-105) then
tmp = x
else
tmp = t_0
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double t_0 = (0.0 - z) * (y * x);
double tmp;
if (y <= -6.3e+63) {
tmp = t_0;
} else if (y <= 6.8e-105) {
tmp = x;
} else {
tmp = t_0;
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): t_0 = (0.0 - z) * (y * x) tmp = 0 if y <= -6.3e+63: tmp = t_0 elif y <= 6.8e-105: tmp = x else: tmp = t_0 return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) t_0 = Float64(Float64(0.0 - z) * Float64(y * x)) tmp = 0.0 if (y <= -6.3e+63) tmp = t_0; elseif (y <= 6.8e-105) tmp = x; else tmp = t_0; end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
t_0 = (0.0 - z) * (y * x);
tmp = 0.0;
if (y <= -6.3e+63)
tmp = t_0;
elseif (y <= 6.8e-105)
tmp = x;
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function.
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(0.0 - z), $MachinePrecision] * N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.3e+63], t$95$0, If[LessEqual[y, 6.8e-105], x, t$95$0]]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
t_0 := \left(0 - z\right) \cdot \left(y \cdot x\right)\\
\mathbf{if}\;y \leq -6.3 \cdot 10^{+63}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 6.8 \cdot 10^{-105}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -6.2999999999999998e63 or 6.79999999999999984e-105 < y Initial program 89.6%
Taylor expanded in y around inf
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-lowering-*.f64N/A
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6468.8%
Simplified68.8%
sub0-negN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
associate-*l*N/A
neg-lowering-neg.f64N/A
*-commutativeN/A
associate-*l*N/A
*-lowering-*.f64N/A
*-lowering-*.f6469.7%
Applied egg-rr69.7%
if -6.2999999999999998e63 < y < 6.79999999999999984e-105Initial program 99.9%
Taylor expanded in y around 0
Simplified69.8%
Final simplification69.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -2.55e+113) (- x (* z (* y x))) (- x (* x (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2.55e+113) {
tmp = x - (z * (y * x));
} else {
tmp = x - (x * (y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-2.55d+113)) then
tmp = x - (z * (y * x))
else
tmp = x - (x * (y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.55e+113) {
tmp = x - (z * (y * x));
} else {
tmp = x - (x * (y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -2.55e+113: tmp = x - (z * (y * x)) else: tmp = x - (x * (y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2.55e+113) tmp = Float64(x - Float64(z * Float64(y * x))); else tmp = Float64(x - Float64(x * Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -2.55e+113)
tmp = x - (z * (y * x));
else
tmp = x - (x * (y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -2.55e+113], N[(x - N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(x * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.55 \cdot 10^{+113}:\\
\;\;\;\;x - z \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x - x \cdot \left(y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.54999999999999997e113Initial program 92.1%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.1%
Applied egg-rr92.1%
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
if -2.54999999999999997e113 < y Initial program 95.1%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6495.2%
Applied egg-rr95.2%
Final simplification95.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 (if (<= y -2.9e+113) (- x (* z (* y x))) (* x (- 1.0 (* y z)))))
assert(x < y && y < z);
double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e+113) {
tmp = x - (z * (y * x));
} else {
tmp = x * (1.0 - (y * z));
}
return tmp;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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 <= (-2.9d+113)) then
tmp = x - (z * (y * x))
else
tmp = x * (1.0d0 - (y * z))
end if
code = tmp
end function
assert x < y && y < z;
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.9e+113) {
tmp = x - (z * (y * x));
} else {
tmp = x * (1.0 - (y * z));
}
return tmp;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): tmp = 0 if y <= -2.9e+113: tmp = x - (z * (y * x)) else: tmp = x * (1.0 - (y * z)) return tmp
x, y, z = sort([x, y, z]) function code(x, y, z) tmp = 0.0 if (y <= -2.9e+113) tmp = Float64(x - Float64(z * Float64(y * x))); else tmp = Float64(x * Float64(1.0 - Float64(y * z))); end return tmp end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp_2 = code(x, y, z)
tmp = 0.0;
if (y <= -2.9e+113)
tmp = x - (z * (y * x));
else
tmp = x * (1.0 - (y * z));
end
tmp_2 = tmp;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := If[LessEqual[y, -2.9e+113], N[(x - N[(z * N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 - N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{+113}:\\
\;\;\;\;x - z \cdot \left(y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 - y \cdot z\right)\\
\end{array}
\end{array}
if y < -2.89999999999999984e113Initial program 92.1%
sub-negN/A
distribute-rgt-inN/A
fma-defineN/A
distribute-lft-neg-outN/A
fmm-undefN/A
*-lft-identityN/A
--lowering--.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.1%
Applied egg-rr92.1%
associate-*l*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
if -2.89999999999999984e113 < y Initial program 95.1%
Final simplification95.8%
NOTE: x, y, and z should be sorted in increasing order before calling this function. (FPCore (x y z) :precision binary64 x)
assert(x < y && y < z);
double code(double x, double y, double z) {
return x;
}
NOTE: x, y, and z should be sorted in increasing order before calling this function.
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
assert x < y && y < z;
public static double code(double x, double y, double z) {
return x;
}
[x, y, z] = sort([x, y, z]) def code(x, y, z): return x
x, y, z = sort([x, y, z]) function code(x, y, z) return x end
x, y, z = num2cell(sort([x, y, z])){:}
function tmp = code(x, y, z)
tmp = x;
end
NOTE: x, y, and z should be sorted in increasing order before calling this function. code[x_, y_, z_] := x
\begin{array}{l}
[x, y, z] = \mathsf{sort}([x, y, z])\\
\\
x
\end{array}
Initial program 94.7%
Taylor expanded in y around 0
Simplified49.5%
herbie shell --seed 2024170
(FPCore (x y z)
:name "Data.Colour.RGBSpace.HSV:hsv from colour-2.3.3, I"
:precision binary64
(* x (- 1.0 (* y z))))