
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 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 = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z) :precision binary64 (/ (* x (+ (- y z) 1.0)) z))
double code(double x, double y, double z) {
return (x * ((y - z) + 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 = (x * ((y - z) + 1.0d0)) / z
end function
public static double code(double x, double y, double z) {
return (x * ((y - z) + 1.0)) / z;
}
def code(x, y, z): return (x * ((y - z) + 1.0)) / z
function code(x, y, z) return Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z) end
function tmp = code(x, y, z) tmp = (x * ((y - z) + 1.0)) / z; end
code[x_, y_, z_] := N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}
\end{array}
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- y z) 1.0)))
(if (or (<= z -2.45e+48) (not (<= z 1.25e-132)))
(/ x (/ z t_0))
(* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if ((z <= -2.45e+48) || !(z <= 1.25e-132)) {
tmp = x / (z / t_0);
} else {
tmp = t_0 * (x / 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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if ((z <= (-2.45d+48)) .or. (.not. (z <= 1.25d-132))) then
tmp = x / (z / t_0)
else
tmp = t_0 * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if ((z <= -2.45e+48) || !(z <= 1.25e-132)) {
tmp = x / (z / t_0);
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if (z <= -2.45e+48) or not (z <= 1.25e-132): tmp = x / (z / t_0) else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if ((z <= -2.45e+48) || !(z <= 1.25e-132)) tmp = Float64(x / Float64(z / t_0)); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if ((z <= -2.45e+48) || ~((z <= 1.25e-132))) tmp = x / (z / t_0); else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[Or[LessEqual[z, -2.45e+48], N[Not[LessEqual[z, 1.25e-132]], $MachinePrecision]], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;z \leq -2.45 \cdot 10^{+48} \lor \neg \left(z \leq 1.25 \cdot 10^{-132}\right):\\
\;\;\;\;\frac{x}{\frac{z}{t\_0}}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -2.45000000000000015e48 or 1.25e-132 < z Initial program 79.2%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
if -2.45000000000000015e48 < z < 1.25e-132Initial program 99.8%
associate-/l*89.1%
Simplified89.1%
Taylor expanded in x around 0 99.8%
associate--l+99.8%
+-commutative99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -67000000000000.0)
(- x)
(if (<= z -3.2e-235)
t_0
(if (<= z 1.52e-186)
(/ x z)
(if (<= z 9.6e-113) t_0 (if (<= z 1.0) (/ x z) (- x))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -67000000000000.0) {
tmp = -x;
} else if (z <= -3.2e-235) {
tmp = t_0;
} else if (z <= 1.52e-186) {
tmp = x / z;
} else if (z <= 9.6e-113) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x / z;
} else {
tmp = -x;
}
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 = y * (x / z)
if (z <= (-67000000000000.0d0)) then
tmp = -x
else if (z <= (-3.2d-235)) then
tmp = t_0
else if (z <= 1.52d-186) then
tmp = x / z
else if (z <= 9.6d-113) then
tmp = t_0
else if (z <= 1.0d0) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -67000000000000.0) {
tmp = -x;
} else if (z <= -3.2e-235) {
tmp = t_0;
} else if (z <= 1.52e-186) {
tmp = x / z;
} else if (z <= 9.6e-113) {
tmp = t_0;
} else if (z <= 1.0) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -67000000000000.0: tmp = -x elif z <= -3.2e-235: tmp = t_0 elif z <= 1.52e-186: tmp = x / z elif z <= 9.6e-113: tmp = t_0 elif z <= 1.0: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -67000000000000.0) tmp = Float64(-x); elseif (z <= -3.2e-235) tmp = t_0; elseif (z <= 1.52e-186) tmp = Float64(x / z); elseif (z <= 9.6e-113) tmp = t_0; elseif (z <= 1.0) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = y * (x / z); tmp = 0.0; if (z <= -67000000000000.0) tmp = -x; elseif (z <= -3.2e-235) tmp = t_0; elseif (z <= 1.52e-186) tmp = x / z; elseif (z <= 9.6e-113) tmp = t_0; elseif (z <= 1.0) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -67000000000000.0], (-x), If[LessEqual[z, -3.2e-235], t$95$0, If[LessEqual[z, 1.52e-186], N[(x / z), $MachinePrecision], If[LessEqual[z, 9.6e-113], t$95$0, If[LessEqual[z, 1.0], N[(x / z), $MachinePrecision], (-x)]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -67000000000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-235}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1.52 \cdot 10^{-186}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 9.6 \cdot 10^{-113}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -6.7e13 or 1 < z Initial program 75.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 75.7%
mul-1-neg75.7%
Simplified75.7%
if -6.7e13 < z < -3.2000000000000001e-235 or 1.5200000000000001e-186 < z < 9.60000000000000049e-113Initial program 99.8%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in y around inf 66.6%
*-commutative66.6%
associate-*r/68.6%
Simplified68.6%
if -3.2000000000000001e-235 < z < 1.5200000000000001e-186 or 9.60000000000000049e-113 < z < 1Initial program 99.9%
associate-/l*97.2%
Simplified97.2%
Taylor expanded in y around 0 70.5%
Taylor expanded in z around 0 68.4%
Final simplification72.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -116000.0) (not (<= z 6.6e-73))) (* x (/ (+ (- y z) 1.0) z)) (* (/ x z) (+ y 1.0))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -116000.0) || !(z <= 6.6e-73)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x / z) * (y + 1.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 <= (-116000.0d0)) .or. (.not. (z <= 6.6d-73))) then
tmp = x * (((y - z) + 1.0d0) / z)
else
tmp = (x / z) * (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -116000.0) || !(z <= 6.6e-73)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x / z) * (y + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -116000.0) or not (z <= 6.6e-73): tmp = x * (((y - z) + 1.0) / z) else: tmp = (x / z) * (y + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -116000.0) || !(z <= 6.6e-73)) tmp = Float64(x * Float64(Float64(Float64(y - z) + 1.0) / z)); else tmp = Float64(Float64(x / z) * Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -116000.0) || ~((z <= 6.6e-73))) tmp = x * (((y - z) + 1.0) / z); else tmp = (x / z) * (y + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -116000.0], N[Not[LessEqual[z, 6.6e-73]], $MachinePrecision]], N[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -116000 \lor \neg \left(z \leq 6.6 \cdot 10^{-73}\right):\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right)\\
\end{array}
\end{array}
if z < -116000 or 6.60000000000000007e-73 < z Initial program 78.4%
associate-/l*99.8%
Simplified99.8%
if -116000 < z < 6.60000000000000007e-73Initial program 99.8%
associate-/l*89.7%
Simplified89.7%
Taylor expanded in z around 0 99.8%
*-commutative99.8%
associate-/l*99.8%
Applied egg-rr99.8%
Final simplification99.8%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ (- y z) 1.0)))
(if (or (<= z -2.55e+48) (not (<= z 2.65e-77)))
(* x (/ t_0 z))
(* t_0 (/ x z)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if ((z <= -2.55e+48) || !(z <= 2.65e-77)) {
tmp = x * (t_0 / z);
} else {
tmp = t_0 * (x / 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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if ((z <= (-2.55d+48)) .or. (.not. (z <= 2.65d-77))) then
tmp = x * (t_0 / z)
else
tmp = t_0 * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if ((z <= -2.55e+48) || !(z <= 2.65e-77)) {
tmp = x * (t_0 / z);
} else {
tmp = t_0 * (x / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if (z <= -2.55e+48) or not (z <= 2.65e-77): tmp = x * (t_0 / z) else: tmp = t_0 * (x / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if ((z <= -2.55e+48) || !(z <= 2.65e-77)) tmp = Float64(x * Float64(t_0 / z)); else tmp = Float64(t_0 * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if ((z <= -2.55e+48) || ~((z <= 2.65e-77))) tmp = x * (t_0 / z); else tmp = t_0 * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[Or[LessEqual[z, -2.55e+48], N[Not[LessEqual[z, 2.65e-77]], $MachinePrecision]], N[(x * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;z \leq -2.55 \cdot 10^{+48} \lor \neg \left(z \leq 2.65 \cdot 10^{-77}\right):\\
\;\;\;\;x \cdot \frac{t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -2.5499999999999999e48 or 2.65000000000000007e-77 < z Initial program 77.4%
associate-/l*99.8%
Simplified99.8%
if -2.5499999999999999e48 < z < 2.65000000000000007e-77Initial program 99.8%
associate-/l*90.4%
Simplified90.4%
Taylor expanded in x around 0 99.8%
associate--l+99.8%
+-commutative99.8%
associate-*l/99.8%
+-commutative99.8%
Simplified99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (<= y -1.25e+88) (* y (/ x z)) (if (<= y 3.6e+58) (- (/ x z) x) (* (/ x z) (+ y 1.0)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+88) {
tmp = y * (x / z);
} else if (y <= 3.6e+58) {
tmp = (x / z) - x;
} else {
tmp = (x / z) * (y + 1.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.25d+88)) then
tmp = y * (x / z)
else if (y <= 3.6d+58) then
tmp = (x / z) - x
else
tmp = (x / z) * (y + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.25e+88) {
tmp = y * (x / z);
} else if (y <= 3.6e+58) {
tmp = (x / z) - x;
} else {
tmp = (x / z) * (y + 1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.25e+88: tmp = y * (x / z) elif y <= 3.6e+58: tmp = (x / z) - x else: tmp = (x / z) * (y + 1.0) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.25e+88) tmp = Float64(y * Float64(x / z)); elseif (y <= 3.6e+58) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x / z) * Float64(y + 1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.25e+88) tmp = y * (x / z); elseif (y <= 3.6e+58) tmp = (x / z) - x; else tmp = (x / z) * (y + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.25e+88], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+58], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * N[(y + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.25 \cdot 10^{+88}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+58}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \left(y + 1\right)\\
\end{array}
\end{array}
if y < -1.24999999999999999e88Initial program 87.4%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 79.8%
*-commutative79.8%
associate-*r/86.3%
Simplified86.3%
if -1.24999999999999999e88 < y < 3.59999999999999996e58Initial program 87.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 81.3%
Taylor expanded in z around inf 93.9%
neg-mul-193.9%
+-commutative93.9%
unsub-neg93.9%
Simplified93.9%
if 3.59999999999999996e58 < y Initial program 86.1%
associate-/l*87.7%
Simplified87.7%
Taylor expanded in z around 0 71.7%
*-commutative71.7%
associate-/l*79.4%
Applied egg-rr79.4%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (<= y -4.5e+87) (* y (/ x z)) (if (<= y 4.8e+57) (- (/ x z) x) (/ (/ x z) (/ 1.0 y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+87) {
tmp = y * (x / z);
} else if (y <= 4.8e+57) {
tmp = (x / z) - x;
} else {
tmp = (x / z) / (1.0 / 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 (y <= (-4.5d+87)) then
tmp = y * (x / z)
else if (y <= 4.8d+57) then
tmp = (x / z) - x
else
tmp = (x / z) / (1.0d0 / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.5e+87) {
tmp = y * (x / z);
} else if (y <= 4.8e+57) {
tmp = (x / z) - x;
} else {
tmp = (x / z) / (1.0 / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.5e+87: tmp = y * (x / z) elif y <= 4.8e+57: tmp = (x / z) - x else: tmp = (x / z) / (1.0 / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.5e+87) tmp = Float64(y * Float64(x / z)); elseif (y <= 4.8e+57) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x / z) / Float64(1.0 / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.5e+87) tmp = y * (x / z); elseif (y <= 4.8e+57) tmp = (x / z) - x; else tmp = (x / z) / (1.0 / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.5e+87], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.8e+57], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.5 \cdot 10^{+87}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 4.8 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{1}{y}}\\
\end{array}
\end{array}
if y < -4.5000000000000003e87Initial program 87.4%
associate-/l*89.6%
Simplified89.6%
Taylor expanded in y around inf 79.8%
*-commutative79.8%
associate-*r/86.3%
Simplified86.3%
if -4.5000000000000003e87 < y < 4.80000000000000009e57Initial program 87.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 81.3%
Taylor expanded in z around inf 93.9%
neg-mul-193.9%
+-commutative93.9%
unsub-neg93.9%
Simplified93.9%
if 4.80000000000000009e57 < y Initial program 86.1%
associate-*r/87.7%
*-commutative87.7%
div-inv87.6%
associate-*l*87.7%
Applied egg-rr87.7%
*-commutative87.7%
associate-*l/87.8%
*-un-lft-identity87.8%
associate-/r/87.8%
div-inv87.7%
associate-/r*87.8%
sub-neg87.8%
associate-+l+87.8%
+-commutative87.8%
sub-neg87.8%
Applied egg-rr87.8%
Taylor expanded in y around inf 79.4%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (if (or (<= y -4.2e+87) (not (<= y 1e+57))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -4.2e+87) || !(y <= 1e+57)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
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 <= (-4.2d+87)) .or. (.not. (y <= 1d+57))) then
tmp = y * (x / z)
else
tmp = (x / z) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((y <= -4.2e+87) || !(y <= 1e+57)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -4.2e+87) or not (y <= 1e+57): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -4.2e+87) || !(y <= 1e+57)) tmp = Float64(y * Float64(x / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -4.2e+87) || ~((y <= 1e+57))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -4.2e+87], N[Not[LessEqual[y, 1e+57]], $MachinePrecision]], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.2 \cdot 10^{+87} \lor \neg \left(y \leq 10^{+57}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -4.2e87 or 1.00000000000000005e57 < y Initial program 86.6%
associate-/l*88.5%
Simplified88.5%
Taylor expanded in y around inf 75.0%
*-commutative75.0%
associate-*r/82.2%
Simplified82.2%
if -4.2e87 < y < 1.00000000000000005e57Initial program 87.4%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 81.3%
Taylor expanded in z around inf 93.9%
neg-mul-193.9%
+-commutative93.9%
unsub-neg93.9%
Simplified93.9%
Final simplification89.7%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= x 1.2e-103) (/ (* x t_0) z) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 1.2e-103) {
tmp = (x * t_0) / z;
} else {
tmp = x / (z / 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 = (y - z) + 1.0d0
if (x <= 1.2d-103) then
tmp = (x * t_0) / z
else
tmp = x / (z / t_0)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (x <= 1.2e-103) {
tmp = (x * t_0) / z;
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if x <= 1.2e-103: tmp = (x * t_0) / z else: tmp = x / (z / t_0) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (x <= 1.2e-103) tmp = Float64(Float64(x * t_0) / z); else tmp = Float64(x / Float64(z / t_0)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (x <= 1.2e-103) tmp = (x * t_0) / z; else tmp = x / (z / t_0); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[x, 1.2e-103], N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], N[(x / N[(z / t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;x \leq 1.2 \cdot 10^{-103}:\\
\;\;\;\;\frac{x \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t\_0}}\\
\end{array}
\end{array}
if x < 1.2000000000000001e-103Initial program 89.7%
if 1.2000000000000001e-103 < x Initial program 81.6%
associate-/l*99.8%
Simplified99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification92.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / 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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = -x
else
tmp = x / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 76.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 74.5%
mul-1-neg74.5%
Simplified74.5%
if -1 < z < 1Initial program 99.8%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in y around 0 58.2%
Taylor expanded in z around 0 56.9%
Final simplification66.3%
(FPCore (x y z) :precision binary64 (- x))
double code(double x, double y, double z) {
return -x;
}
real(8) function code(x, y, z)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
code = -x
end function
public static double code(double x, double y, double z) {
return -x;
}
def code(x, y, z): return -x
function code(x, y, z) return Float64(-x) end
function tmp = code(x, y, z) tmp = -x; end
code[x_, y_, z_] := (-x)
\begin{array}{l}
\\
-x
\end{array}
Initial program 87.1%
associate-/l*95.7%
Simplified95.7%
Taylor expanded in z around inf 41.3%
mul-1-neg41.3%
Simplified41.3%
Final simplification41.3%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (- (* (+ 1.0 y) (/ x z)) x)))
(if (< x -2.71483106713436e-162)
t_0
(if (< x 3.874108816439546e-197)
(* (* x (+ (- y z) 1.0)) (/ 1.0 z))
t_0))))
double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / 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 = ((1.0d0 + y) * (x / z)) - x
if (x < (-2.71483106713436d-162)) then
tmp = t_0
else if (x < 3.874108816439546d-197) then
tmp = (x * ((y - z) + 1.0d0)) * (1.0d0 / z)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = ((1.0 + y) * (x / z)) - x;
double tmp;
if (x < -2.71483106713436e-162) {
tmp = t_0;
} else if (x < 3.874108816439546e-197) {
tmp = (x * ((y - z) + 1.0)) * (1.0 / z);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y, z): t_0 = ((1.0 + y) * (x / z)) - x tmp = 0 if x < -2.71483106713436e-162: tmp = t_0 elif x < 3.874108816439546e-197: tmp = (x * ((y - z) + 1.0)) * (1.0 / z) else: tmp = t_0 return tmp
function code(x, y, z) t_0 = Float64(Float64(Float64(1.0 + y) * Float64(x / z)) - x) tmp = 0.0 if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) * Float64(1.0 / z)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y, z) t_0 = ((1.0 + y) * (x / z)) - x; tmp = 0.0; if (x < -2.71483106713436e-162) tmp = t_0; elseif (x < 3.874108816439546e-197) tmp = (x * ((y - z) + 1.0)) * (1.0 / z); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(N[(1.0 + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]}, If[Less[x, -2.71483106713436e-162], t$95$0, If[Less[x, 3.874108816439546e-197], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / z), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(1 + y\right) \cdot \frac{x}{z} - x\\
\mathbf{if}\;x < -2.71483106713436 \cdot 10^{-162}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x < 3.874108816439546 \cdot 10^{-197}:\\
\;\;\;\;\left(x \cdot \left(\left(y - z\right) + 1\right)\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
herbie shell --seed 2024075
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(if (< x -2.71483106713436e-162) (- (* (+ 1.0 y) (/ x z)) x) (if (< x 3.874108816439546e-197) (* (* x (+ (- y z) 1.0)) (/ 1.0 z)) (- (* (+ 1.0 y) (/ x z)) x)))
(/ (* x (+ (- y z) 1.0)) z))