
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))
double code(double x, double y, double z) {
return fabs((((x + 4.0) / y) - ((x / 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 = abs((((x + 4.0d0) / y) - ((x / y) * z)))
end function
public static double code(double x, double y, double z) {
return Math.abs((((x + 4.0) / y) - ((x / y) * z)));
}
def code(x, y, z): return math.fabs((((x + 4.0) / y) - ((x / y) * z)))
function code(x, y, z) return abs(Float64(Float64(Float64(x + 4.0) / y) - Float64(Float64(x / y) * z))) end
function tmp = code(x, y, z) tmp = abs((((x + 4.0) / y) - ((x / y) * z))); end
code[x_, y_, z_] := N[Abs[N[(N[(N[(x + 4.0), $MachinePrecision] / y), $MachinePrecision] - N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{x + 4}{y} - \frac{x}{y} \cdot z\right|
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* (/ x y) (- 1.0 z)))))
(if (<= x -2e+24)
t_0
(if (<= x 8e+15) (fabs (/ (- (+ 4.0 x) (* x z)) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fabs(((x / y) * (1.0 - z)));
double tmp;
if (x <= -2e+24) {
tmp = t_0;
} else if (x <= 8e+15) {
tmp = fabs((((4.0 + x) - (x * z)) / y));
} 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 = abs(((x / y) * (1.0d0 - z)))
if (x <= (-2d+24)) then
tmp = t_0
else if (x <= 8d+15) then
tmp = abs((((4.0d0 + x) - (x * z)) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((x / y) * (1.0 - z)));
double tmp;
if (x <= -2e+24) {
tmp = t_0;
} else if (x <= 8e+15) {
tmp = Math.abs((((4.0 + x) - (x * z)) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((x / y) * (1.0 - z))) tmp = 0 if x <= -2e+24: tmp = t_0 elif x <= 8e+15: tmp = math.fabs((((4.0 + x) - (x * z)) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(x / y) * Float64(1.0 - z))) tmp = 0.0 if (x <= -2e+24) tmp = t_0; elseif (x <= 8e+15) tmp = abs(Float64(Float64(Float64(4.0 + x) - Float64(x * z)) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((x / y) * (1.0 - z))); tmp = 0.0; if (x <= -2e+24) tmp = t_0; elseif (x <= 8e+15) tmp = abs((((4.0 + x) - (x * z)) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -2e+24], t$95$0, If[LessEqual[x, 8e+15], N[Abs[N[(N[(N[(4.0 + x), $MachinePrecision] - N[(x * z), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\mathbf{if}\;x \leq -2 \cdot 10^{+24}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 8 \cdot 10^{+15}:\\
\;\;\;\;\left|\frac{\left(4 + x\right) - x \cdot z}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -2e24 or 8e15 < x Initial program 91.1%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6491.1%
Applied egg-rr91.1%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-/l*N/A
associate-*r/N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6499.9%
Simplified99.9%
if -2e24 < x < 8e15Initial program 97.8%
fabs-lowering-fabs.f64N/A
associate-*l/N/A
sub-divN/A
flip3-+N/A
div-invN/A
fmm-defN/A
*-commutativeN/A
/-lowering-/.f64N/A
Applied egg-rr99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (fabs (* (/ x y) z))))
(if (<= x -1.05e-84)
t_0
(if (<= x 1.85e-27)
(fabs (/ 4.0 y))
(if (<= x 1.05e+237) t_0 (fabs (/ x y)))))))
double code(double x, double y, double z) {
double t_0 = fabs(((x / y) * z));
double tmp;
if (x <= -1.05e-84) {
tmp = t_0;
} else if (x <= 1.85e-27) {
tmp = fabs((4.0 / y));
} else if (x <= 1.05e+237) {
tmp = t_0;
} else {
tmp = fabs((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) :: t_0
real(8) :: tmp
t_0 = abs(((x / y) * z))
if (x <= (-1.05d-84)) then
tmp = t_0
else if (x <= 1.85d-27) then
tmp = abs((4.0d0 / y))
else if (x <= 1.05d+237) then
tmp = t_0
else
tmp = abs((x / y))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((x / y) * z));
double tmp;
if (x <= -1.05e-84) {
tmp = t_0;
} else if (x <= 1.85e-27) {
tmp = Math.abs((4.0 / y));
} else if (x <= 1.05e+237) {
tmp = t_0;
} else {
tmp = Math.abs((x / y));
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((x / y) * z)) tmp = 0 if x <= -1.05e-84: tmp = t_0 elif x <= 1.85e-27: tmp = math.fabs((4.0 / y)) elif x <= 1.05e+237: tmp = t_0 else: tmp = math.fabs((x / y)) return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(x / y) * z)) tmp = 0.0 if (x <= -1.05e-84) tmp = t_0; elseif (x <= 1.85e-27) tmp = abs(Float64(4.0 / y)); elseif (x <= 1.05e+237) tmp = t_0; else tmp = abs(Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((x / y) * z)); tmp = 0.0; if (x <= -1.05e-84) tmp = t_0; elseif (x <= 1.85e-27) tmp = abs((4.0 / y)); elseif (x <= 1.05e+237) tmp = t_0; else tmp = abs((x / y)); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.05e-84], t$95$0, If[LessEqual[x, 1.85e-27], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 1.05e+237], t$95$0, N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y} \cdot z\right|\\
\mathbf{if}\;x \leq -1.05 \cdot 10^{-84}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-27}:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+237}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y}\right|\\
\end{array}
\end{array}
if x < -1.04999999999999999e-84 or 1.85000000000000014e-27 < x < 1.05000000000000007e237Initial program 93.4%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6493.4%
Applied egg-rr93.4%
Taylor expanded in z around inf
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f6455.6%
Simplified55.6%
neg-fabsN/A
sub0-negN/A
associate-*r/N/A
distribute-neg-frac2N/A
remove-double-negN/A
associate-*l/N/A
associate-/r/N/A
fabs-lowering-fabs.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6456.2%
Applied egg-rr56.2%
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
clear-numN/A
/-lowering-/.f6461.8%
Applied egg-rr61.8%
if -1.04999999999999999e-84 < x < 1.85000000000000014e-27Initial program 97.2%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified97.2%
Taylor expanded in x around 0
/-lowering-/.f6484.2%
Simplified84.2%
if 1.05000000000000007e237 < x Initial program 86.6%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified99.8%
Taylor expanded in z around 0
/-lowering-/.f6484.4%
Simplified84.4%
Taylor expanded in x around inf
/-lowering-/.f6484.4%
Simplified84.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fabs (* (/ x y) (- 1.0 z))))) (if (<= x -5.6e+23) t_0 (if (<= x 5.0) (fabs (/ (- (* x z) 4.0) y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fabs(((x / y) * (1.0 - z)));
double tmp;
if (x <= -5.6e+23) {
tmp = t_0;
} else if (x <= 5.0) {
tmp = fabs((((x * z) - 4.0) / y));
} 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 = abs(((x / y) * (1.0d0 - z)))
if (x <= (-5.6d+23)) then
tmp = t_0
else if (x <= 5.0d0) then
tmp = abs((((x * z) - 4.0d0) / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs(((x / y) * (1.0 - z)));
double tmp;
if (x <= -5.6e+23) {
tmp = t_0;
} else if (x <= 5.0) {
tmp = Math.abs((((x * z) - 4.0) / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs(((x / y) * (1.0 - z))) tmp = 0 if x <= -5.6e+23: tmp = t_0 elif x <= 5.0: tmp = math.fabs((((x * z) - 4.0) / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(Float64(x / y) * Float64(1.0 - z))) tmp = 0.0 if (x <= -5.6e+23) tmp = t_0; elseif (x <= 5.0) tmp = abs(Float64(Float64(Float64(x * z) - 4.0) / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs(((x / y) * (1.0 - z))); tmp = 0.0; if (x <= -5.6e+23) tmp = t_0; elseif (x <= 5.0) tmp = abs((((x * z) - 4.0) / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -5.6e+23], t$95$0, If[LessEqual[x, 5.0], N[Abs[N[(N[(N[(x * z), $MachinePrecision] - 4.0), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5:\\
\;\;\;\;\left|\frac{x \cdot z - 4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -5.6e23 or 5 < x Initial program 91.4%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6491.4%
Applied egg-rr91.4%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-/l*N/A
associate-*r/N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6498.8%
Simplified98.8%
if -5.6e23 < x < 5Initial program 97.7%
Taylor expanded in x around 0
/-lowering-/.f6496.2%
Simplified96.2%
fabs-subN/A
fabs-lowering-fabs.f64N/A
associate-*l/N/A
sub-divN/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f6498.3%
Applied egg-rr98.3%
(FPCore (x y z) :precision binary64 (if (<= z -0.0073) (fabs (* (/ x y) (- 1.0 z))) (if (<= z 7e+70) (fabs (/ (+ 4.0 x) y)) (fabs (* (/ x y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -0.0073) {
tmp = fabs(((x / y) * (1.0 - z)));
} else if (z <= 7e+70) {
tmp = fabs(((4.0 + x) / y));
} else {
tmp = fabs(((x / y) * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-0.0073d0)) then
tmp = abs(((x / y) * (1.0d0 - z)))
else if (z <= 7d+70) then
tmp = abs(((4.0d0 + x) / y))
else
tmp = abs(((x / y) * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -0.0073) {
tmp = Math.abs(((x / y) * (1.0 - z)));
} else if (z <= 7e+70) {
tmp = Math.abs(((4.0 + x) / y));
} else {
tmp = Math.abs(((x / y) * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -0.0073: tmp = math.fabs(((x / y) * (1.0 - z))) elif z <= 7e+70: tmp = math.fabs(((4.0 + x) / y)) else: tmp = math.fabs(((x / y) * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -0.0073) tmp = abs(Float64(Float64(x / y) * Float64(1.0 - z))); elseif (z <= 7e+70) tmp = abs(Float64(Float64(4.0 + x) / y)); else tmp = abs(Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -0.0073) tmp = abs(((x / y) * (1.0 - z))); elseif (z <= 7e+70) tmp = abs(((4.0 + x) / y)); else tmp = abs(((x / y) * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -0.0073], N[Abs[N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 7e+70], N[Abs[N[(N[(4.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.0073:\\
\;\;\;\;\left|\frac{x}{y} \cdot \left(1 - z\right)\right|\\
\mathbf{elif}\;z \leq 7 \cdot 10^{+70}:\\
\;\;\;\;\left|\frac{4 + x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
\end{array}
\end{array}
if z < -0.00730000000000000007Initial program 96.9%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6496.9%
Applied egg-rr96.9%
Taylor expanded in x around inf
distribute-lft-out--N/A
associate-/l*N/A
associate-*r/N/A
*-rgt-identityN/A
*-commutativeN/A
associate-/l*N/A
cancel-sign-sub-invN/A
mul-1-negN/A
distribute-rgt1-inN/A
*-commutativeN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
+-commutativeN/A
mul-1-negN/A
sub-negN/A
--lowering--.f6476.9%
Simplified76.9%
if -0.00730000000000000007 < z < 7.00000000000000005e70Initial program 95.9%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified100.0%
Taylor expanded in z around 0
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
associate-*l/N/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-frac-negN/A
mul-1-negN/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
+-lowering-+.f6498.1%
Simplified98.1%
if 7.00000000000000005e70 < z Initial program 86.4%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6486.3%
Applied egg-rr86.3%
Taylor expanded in z around inf
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f6487.0%
Simplified87.0%
neg-fabsN/A
sub0-negN/A
associate-*r/N/A
distribute-neg-frac2N/A
remove-double-negN/A
associate-*l/N/A
associate-/r/N/A
fabs-lowering-fabs.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6486.9%
Applied egg-rr86.9%
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
clear-numN/A
/-lowering-/.f6489.4%
Applied egg-rr89.4%
(FPCore (x y z) :precision binary64 (if (<= z -1600.0) (fabs (/ x (/ y z))) (if (<= z 8.5e+71) (fabs (/ (+ 4.0 x) y)) (fabs (* (/ x y) z)))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1600.0) {
tmp = fabs((x / (y / z)));
} else if (z <= 8.5e+71) {
tmp = fabs(((4.0 + x) / y));
} else {
tmp = fabs(((x / y) * z));
}
return tmp;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8) :: tmp
if (z <= (-1600.0d0)) then
tmp = abs((x / (y / z)))
else if (z <= 8.5d+71) then
tmp = abs(((4.0d0 + x) / y))
else
tmp = abs(((x / y) * z))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1600.0) {
tmp = Math.abs((x / (y / z)));
} else if (z <= 8.5e+71) {
tmp = Math.abs(((4.0 + x) / y));
} else {
tmp = Math.abs(((x / y) * z));
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1600.0: tmp = math.fabs((x / (y / z))) elif z <= 8.5e+71: tmp = math.fabs(((4.0 + x) / y)) else: tmp = math.fabs(((x / y) * z)) return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1600.0) tmp = abs(Float64(x / Float64(y / z))); elseif (z <= 8.5e+71) tmp = abs(Float64(Float64(4.0 + x) / y)); else tmp = abs(Float64(Float64(x / y) * z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1600.0) tmp = abs((x / (y / z))); elseif (z <= 8.5e+71) tmp = abs(((4.0 + x) / y)); else tmp = abs(((x / y) * z)); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1600.0], N[Abs[N[(x / N[(y / z), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[z, 8.5e+71], N[Abs[N[(N[(4.0 + x), $MachinePrecision] / y), $MachinePrecision]], $MachinePrecision], N[Abs[N[(N[(x / y), $MachinePrecision] * z), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1600:\\
\;\;\;\;\left|\frac{x}{\frac{y}{z}}\right|\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+71}:\\
\;\;\;\;\left|\frac{4 + x}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;\left|\frac{x}{y} \cdot z\right|\\
\end{array}
\end{array}
if z < -1600Initial program 96.8%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6496.8%
Applied egg-rr96.8%
Taylor expanded in z around inf
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f6472.9%
Simplified72.9%
neg-fabsN/A
sub0-negN/A
associate-*r/N/A
distribute-neg-frac2N/A
remove-double-negN/A
associate-*l/N/A
associate-/r/N/A
fabs-lowering-fabs.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6474.3%
Applied egg-rr74.3%
if -1600 < z < 8.4999999999999996e71Initial program 95.9%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified100.0%
Taylor expanded in z around 0
*-rgt-identityN/A
associate-*r/N/A
distribute-rgt-outN/A
associate-*l/N/A
metadata-evalN/A
distribute-lft-neg-inN/A
distribute-frac-negN/A
mul-1-negN/A
distribute-frac-negN/A
remove-double-negN/A
/-lowering-/.f64N/A
+-lowering-+.f6497.1%
Simplified97.1%
if 8.4999999999999996e71 < z Initial program 86.4%
*-commutativeN/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6486.3%
Applied egg-rr86.3%
Taylor expanded in z around inf
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
neg-sub0N/A
--lowering--.f6487.0%
Simplified87.0%
neg-fabsN/A
sub0-negN/A
associate-*r/N/A
distribute-neg-frac2N/A
remove-double-negN/A
associate-*l/N/A
associate-/r/N/A
fabs-lowering-fabs.f64N/A
/-lowering-/.f64N/A
/-lowering-/.f6486.9%
Applied egg-rr86.9%
associate-/r/N/A
clear-numN/A
*-lowering-*.f64N/A
clear-numN/A
/-lowering-/.f6489.4%
Applied egg-rr89.4%
(FPCore (x y z) :precision binary64 (let* ((t_0 (fabs (/ x y)))) (if (<= x -1.52) t_0 (if (<= x 4.0) (fabs (/ 4.0 y)) t_0))))
double code(double x, double y, double z) {
double t_0 = fabs((x / y));
double tmp;
if (x <= -1.52) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = fabs((4.0 / y));
} 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 = abs((x / y))
if (x <= (-1.52d0)) then
tmp = t_0
else if (x <= 4.0d0) then
tmp = abs((4.0d0 / y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = Math.abs((x / y));
double tmp;
if (x <= -1.52) {
tmp = t_0;
} else if (x <= 4.0) {
tmp = Math.abs((4.0 / y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = math.fabs((x / y)) tmp = 0 if x <= -1.52: tmp = t_0 elif x <= 4.0: tmp = math.fabs((4.0 / y)) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = abs(Float64(x / y)) tmp = 0.0 if (x <= -1.52) tmp = t_0; elseif (x <= 4.0) tmp = abs(Float64(4.0 / y)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = abs((x / y)); tmp = 0.0; if (x <= -1.52) tmp = t_0; elseif (x <= 4.0) tmp = abs((4.0 / y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[Abs[N[(x / y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.52], t$95$0, If[LessEqual[x, 4.0], N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|\frac{x}{y}\right|\\
\mathbf{if}\;x \leq -1.52:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 4:\\
\;\;\;\;\left|\frac{4}{y}\right|\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.52 or 4 < x Initial program 91.5%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified99.9%
Taylor expanded in z around 0
/-lowering-/.f6460.6%
Simplified60.6%
Taylor expanded in x around inf
/-lowering-/.f6459.6%
Simplified59.6%
if -1.52 < x < 4Initial program 97.7%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified97.7%
Taylor expanded in x around 0
/-lowering-/.f6475.9%
Simplified75.9%
(FPCore (x y z) :precision binary64 (fabs (+ (/ 4.0 y) (* (/ x y) (- 1.0 z)))))
double code(double x, double y, double z) {
return fabs(((4.0 / y) + ((x / y) * (1.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 = abs(((4.0d0 / y) + ((x / y) * (1.0d0 - z))))
end function
public static double code(double x, double y, double z) {
return Math.abs(((4.0 / y) + ((x / y) * (1.0 - z))));
}
def code(x, y, z): return math.fabs(((4.0 / y) + ((x / y) * (1.0 - z))))
function code(x, y, z) return abs(Float64(Float64(4.0 / y) + Float64(Float64(x / y) * Float64(1.0 - z)))) end
function tmp = code(x, y, z) tmp = abs(((4.0 / y) + ((x / y) * (1.0 - z)))); end
code[x_, y_, z_] := N[Abs[N[(N[(4.0 / y), $MachinePrecision] + N[(N[(x / y), $MachinePrecision] * N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{4}{y} + \frac{x}{y} \cdot \left(1 - z\right)\right|
\end{array}
Initial program 94.5%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified98.8%
(FPCore (x y z) :precision binary64 (fabs (/ 4.0 y)))
double code(double x, double y, double z) {
return fabs((4.0 / y));
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = abs((4.0d0 / y))
end function
public static double code(double x, double y, double z) {
return Math.abs((4.0 / y));
}
def code(x, y, z): return math.fabs((4.0 / y))
function code(x, y, z) return abs(Float64(4.0 / y)) end
function tmp = code(x, y, z) tmp = abs((4.0 / y)); end
code[x_, y_, z_] := N[Abs[N[(4.0 / y), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\left|\frac{4}{y}\right|
\end{array}
Initial program 94.5%
fabs-lowering-fabs.f64N/A
sub-negN/A
+-commutativeN/A
neg-sub0N/A
associate-+l-N/A
sub0-negN/A
neg-mul-1N/A
distribute-rgt-out--N/A
*-commutativeN/A
neg-mul-1N/A
associate-*l/N/A
*-commutativeN/A
neg-mul-1N/A
distribute-neg-inN/A
sub-negN/A
div-subN/A
distribute-neg-fracN/A
associate--r-N/A
+-commutativeN/A
+-lowering-+.f64N/A
/-lowering-/.f64N/A
sub-negN/A
Simplified98.8%
Taylor expanded in x around 0
/-lowering-/.f6439.7%
Simplified39.7%
herbie shell --seed 2024141
(FPCore (x y z)
:name "fabs fraction 1"
:precision binary64
(fabs (- (/ (+ x 4.0) y) (* (/ x y) z))))