
(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 11 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 (if (or (<= z -6.8e-12) (not (<= z 4.5e-29))) (* x (/ (+ (- y z) 1.0) z)) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e-12) || !(z <= 4.5e-29)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x * (y + 1.0)) / 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 <= (-6.8d-12)) .or. (.not. (z <= 4.5d-29))) then
tmp = x * (((y - z) + 1.0d0) / z)
else
tmp = (x * (y + 1.0d0)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -6.8e-12) || !(z <= 4.5e-29)) {
tmp = x * (((y - z) + 1.0) / z);
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -6.8e-12) or not (z <= 4.5e-29): tmp = x * (((y - z) + 1.0) / z) else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -6.8e-12) || !(z <= 4.5e-29)) tmp = Float64(x * Float64(Float64(Float64(y - z) + 1.0) / z)); else tmp = Float64(Float64(x * Float64(y + 1.0)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -6.8e-12) || ~((z <= 4.5e-29))) tmp = x * (((y - z) + 1.0) / z); else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -6.8e-12], N[Not[LessEqual[z, 4.5e-29]], $MachinePrecision]], N[(x * N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-12} \lor \neg \left(z \leq 4.5 \cdot 10^{-29}\right):\\
\;\;\;\;x \cdot \frac{\left(y - z\right) + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -6.8000000000000001e-12 or 4.4999999999999998e-29 < z Initial program 61.6%
associate-/l*99.9%
Simplified99.9%
if -6.8000000000000001e-12 < z < 4.4999999999999998e-29Initial program 99.9%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in z around 0 99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= z -7.5e+22)
(- x)
(if (<= z -6.8e-82)
t_0
(if (<= z 4.4e-29) (/ x z) (if (<= z 19000000.0) t_0 (- x)))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -7.5e+22) {
tmp = -x;
} else if (z <= -6.8e-82) {
tmp = t_0;
} else if (z <= 4.4e-29) {
tmp = x / z;
} else if (z <= 19000000.0) {
tmp = t_0;
} 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 = x * (y / z)
if (z <= (-7.5d+22)) then
tmp = -x
else if (z <= (-6.8d-82)) then
tmp = t_0
else if (z <= 4.4d-29) then
tmp = x / z
else if (z <= 19000000.0d0) then
tmp = t_0
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -7.5e+22) {
tmp = -x;
} else if (z <= -6.8e-82) {
tmp = t_0;
} else if (z <= 4.4e-29) {
tmp = x / z;
} else if (z <= 19000000.0) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if z <= -7.5e+22: tmp = -x elif z <= -6.8e-82: tmp = t_0 elif z <= 4.4e-29: tmp = x / z elif z <= 19000000.0: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -7.5e+22) tmp = Float64(-x); elseif (z <= -6.8e-82) tmp = t_0; elseif (z <= 4.4e-29) tmp = Float64(x / z); elseif (z <= 19000000.0) tmp = t_0; else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) t_0 = x * (y / z); tmp = 0.0; if (z <= -7.5e+22) tmp = -x; elseif (z <= -6.8e-82) tmp = t_0; elseif (z <= 4.4e-29) tmp = x / z; elseif (z <= 19000000.0) tmp = t_0; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.5e+22], (-x), If[LessEqual[z, -6.8e-82], t$95$0, If[LessEqual[z, 4.4e-29], N[(x / z), $MachinePrecision], If[LessEqual[z, 19000000.0], t$95$0, (-x)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -7.5 \cdot 10^{+22}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -6.8 \cdot 10^{-82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{-29}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 19000000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -7.5000000000000002e22 or 1.9e7 < z Initial program 57.8%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 83.7%
neg-mul-183.7%
Simplified83.7%
if -7.5000000000000002e22 < z < -6.7999999999999995e-82 or 4.39999999999999981e-29 < z < 1.9e7Initial program 99.6%
associate-/l*99.6%
Simplified99.6%
Taylor expanded in y around inf 69.2%
associate-/l*69.2%
Simplified69.2%
if -6.7999999999999995e-82 < z < 4.39999999999999981e-29Initial program 99.9%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in z around 0 99.9%
associate-/l*91.9%
Simplified91.9%
Taylor expanded in y around 0 63.3%
(FPCore (x y z) :precision binary64 (if (<= z -4.1e+23) (- x) (if (<= z 70000.0) (/ (* x (+ y 1.0)) z) (- (/ x z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -4.1e+23) {
tmp = -x;
} else if (z <= 70000.0) {
tmp = (x * (y + 1.0)) / 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 (z <= (-4.1d+23)) then
tmp = -x
else if (z <= 70000.0d0) then
tmp = (x * (y + 1.0d0)) / 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 (z <= -4.1e+23) {
tmp = -x;
} else if (z <= 70000.0) {
tmp = (x * (y + 1.0)) / z;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -4.1e+23: tmp = -x elif z <= 70000.0: tmp = (x * (y + 1.0)) / z else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -4.1e+23) tmp = Float64(-x); elseif (z <= 70000.0) tmp = Float64(Float64(x * Float64(y + 1.0)) / z); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -4.1e+23) tmp = -x; elseif (z <= 70000.0) tmp = (x * (y + 1.0)) / z; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -4.1e+23], (-x), If[LessEqual[z, 70000.0], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+23}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 70000:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if z < -4.09999999999999996e23Initial program 55.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 83.5%
neg-mul-183.5%
Simplified83.5%
if -4.09999999999999996e23 < z < 7e4Initial program 99.9%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in z around 0 98.3%
if 7e4 < z Initial program 59.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 53.8%
Taylor expanded in z around inf 85.2%
+-commutative85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
Final simplification91.8%
(FPCore (x y z) :precision binary64 (if (<= z -5.5e+21) (- x) (if (<= z 12000.0) (* x (/ (+ y 1.0) z)) (- (/ x z) x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -5.5e+21) {
tmp = -x;
} else if (z <= 12000.0) {
tmp = x * ((y + 1.0) / 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 (z <= (-5.5d+21)) then
tmp = -x
else if (z <= 12000.0d0) then
tmp = x * ((y + 1.0d0) / 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 (z <= -5.5e+21) {
tmp = -x;
} else if (z <= 12000.0) {
tmp = x * ((y + 1.0) / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -5.5e+21: tmp = -x elif z <= 12000.0: tmp = x * ((y + 1.0) / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -5.5e+21) tmp = Float64(-x); elseif (z <= 12000.0) tmp = Float64(x * Float64(Float64(y + 1.0) / z)); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -5.5e+21) tmp = -x; elseif (z <= 12000.0) tmp = x * ((y + 1.0) / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -5.5e+21], (-x), If[LessEqual[z, 12000.0], N[(x * N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+21}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 12000:\\
\;\;\;\;x \cdot \frac{y + 1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if z < -5.5e21Initial program 55.5%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 83.5%
neg-mul-183.5%
Simplified83.5%
if -5.5e21 < z < 12000Initial program 99.9%
associate-/l*93.5%
Simplified93.5%
Taylor expanded in z around 0 98.3%
associate-/l*91.9%
Simplified91.9%
if 12000 < z Initial program 59.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around 0 53.8%
Taylor expanded in z around inf 85.2%
+-commutative85.2%
mul-1-neg85.2%
unsub-neg85.2%
Simplified85.2%
Final simplification88.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -2.9e+16) (not (<= y 1.25e+50))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -2.9e+16) || !(y <= 1.25e+50)) {
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 <= (-2.9d+16)) .or. (.not. (y <= 1.25d+50))) 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 <= -2.9e+16) || !(y <= 1.25e+50)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -2.9e+16) or not (y <= 1.25e+50): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -2.9e+16) || !(y <= 1.25e+50)) 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 <= -2.9e+16) || ~((y <= 1.25e+50))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -2.9e+16], N[Not[LessEqual[y, 1.25e+50]], $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 -2.9 \cdot 10^{+16} \lor \neg \left(y \leq 1.25 \cdot 10^{+50}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -2.9e16 or 1.25e50 < y Initial program 82.3%
associate-/l*92.8%
Simplified92.8%
clear-num92.8%
un-div-inv93.0%
Applied egg-rr93.0%
Taylor expanded in y around inf 67.3%
associate-*l/72.5%
*-commutative72.5%
Simplified72.5%
if -2.9e16 < y < 1.25e50Initial program 78.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 75.8%
Taylor expanded in z around inf 97.2%
+-commutative97.2%
mul-1-neg97.2%
unsub-neg97.2%
Simplified97.2%
Final simplification86.9%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+16) (/ y (/ z x)) (if (<= y 1.76e+50) (- (/ x z) x) (* y (/ x z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+16) {
tmp = y / (z / x);
} else if (y <= 1.76e+50) {
tmp = (x / z) - x;
} else {
tmp = y * (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 (y <= (-4.4d+16)) then
tmp = y / (z / x)
else if (y <= 1.76d+50) then
tmp = (x / z) - x
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+16) {
tmp = y / (z / x);
} else if (y <= 1.76e+50) {
tmp = (x / z) - x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+16: tmp = y / (z / x) elif y <= 1.76e+50: tmp = (x / z) - x else: tmp = y * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+16) tmp = Float64(y / Float64(z / x)); elseif (y <= 1.76e+50) tmp = Float64(Float64(x / z) - x); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e+16) tmp = y / (z / x); elseif (y <= 1.76e+50) tmp = (x / z) - x; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+16], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.76e+50], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 1.76 \cdot 10^{+50}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -4.4e16Initial program 81.6%
associate-/l*94.9%
Simplified94.9%
clear-num94.9%
un-div-inv95.1%
Applied egg-rr95.1%
Taylor expanded in y around inf 60.2%
associate-*l/68.2%
*-commutative68.2%
Simplified68.2%
clear-num68.3%
un-div-inv68.4%
Applied egg-rr68.4%
if -4.4e16 < y < 1.7600000000000001e50Initial program 78.6%
associate-/l*99.2%
Simplified99.2%
Taylor expanded in y around 0 75.8%
Taylor expanded in z around inf 97.2%
+-commutative97.2%
mul-1-neg97.2%
unsub-neg97.2%
Simplified97.2%
if 1.7600000000000001e50 < y Initial program 83.1%
associate-/l*90.4%
Simplified90.4%
clear-num90.4%
un-div-inv90.5%
Applied egg-rr90.5%
Taylor expanded in y around inf 75.3%
associate-*l/77.3%
*-commutative77.3%
Simplified77.3%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= x 200.0) (/ (* 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 <= 200.0) {
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 <= 200.0d0) 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 <= 200.0) {
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 <= 200.0: 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 <= 200.0) 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 <= 200.0) 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, 200.0], 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 200:\\
\;\;\;\;\frac{x \cdot t\_0}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t\_0}}\\
\end{array}
\end{array}
if x < 200Initial program 83.9%
if 200 < x Initial program 66.6%
associate-/l*100.0%
Simplified100.0%
clear-num100.0%
un-div-inv100.0%
Applied egg-rr100.0%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.2e-6) (not (<= z 2.6e-17))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.2e-6) || !(z <= 2.6e-17)) {
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 <= (-3.2d-6)) .or. (.not. (z <= 2.6d-17))) 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 <= -3.2e-6) || !(z <= 2.6e-17)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.2e-6) or not (z <= 2.6e-17): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.2e-6) || !(z <= 2.6e-17)) tmp = Float64(-x); else tmp = Float64(x / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.2e-6) || ~((z <= 2.6e-17))) tmp = -x; else tmp = x / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.2e-6], N[Not[LessEqual[z, 2.6e-17]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{-6} \lor \neg \left(z \leq 2.6 \cdot 10^{-17}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -3.1999999999999999e-6 or 2.60000000000000003e-17 < z Initial program 60.4%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 79.2%
neg-mul-179.2%
Simplified79.2%
if -3.1999999999999999e-6 < z < 2.60000000000000003e-17Initial program 99.9%
associate-/l*93.1%
Simplified93.1%
Taylor expanded in z around 0 99.6%
associate-/l*92.9%
Simplified92.9%
Taylor expanded in y around 0 58.6%
Final simplification68.9%
(FPCore (x y z) :precision binary64 (/ x (/ z (+ (- y z) 1.0))))
double code(double x, double y, double z) {
return x / (z / ((y - z) + 1.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 / (z / ((y - z) + 1.0d0))
end function
public static double code(double x, double y, double z) {
return x / (z / ((y - z) + 1.0));
}
def code(x, y, z): return x / (z / ((y - z) + 1.0))
function code(x, y, z) return Float64(x / Float64(z / Float64(Float64(y - z) + 1.0))) end
function tmp = code(x, y, z) tmp = x / (z / ((y - z) + 1.0)); end
code[x_, y_, z_] := N[(x / N[(z / N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{z}{\left(y - z\right) + 1}}
\end{array}
Initial program 80.2%
associate-/l*96.5%
Simplified96.5%
clear-num96.5%
un-div-inv96.9%
Applied egg-rr96.9%
(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 80.2%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around inf 41.1%
neg-mul-141.1%
Simplified41.1%
(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 x end
function tmp = code(x, y, z) tmp = x; end
code[x_, y_, z_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 80.2%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around inf 41.1%
neg-mul-141.1%
Simplified41.1%
neg-sub041.1%
sub-neg41.1%
add-sqr-sqrt22.6%
sqrt-unprod15.5%
sqr-neg15.5%
sqrt-unprod1.3%
add-sqr-sqrt2.8%
Applied egg-rr2.8%
Taylor expanded in x around 0 2.8%
(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 2024181
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:alt
(! :herbie-platform default (if (< x -67870776678359/25000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (* (+ 1 y) (/ x z)) x) (if (< x 1937054408219773/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* (* x (+ (- y z) 1)) (/ 1 z)) (- (* (+ 1 y) (/ x z)) x))))
(/ (* x (+ (- y z) 1.0)) z))