
(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 13 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 (<= z -1.42e+16)
(- (* x (/ y z)) x)
(if (<= z 6e-92) (* t_0 (/ x z)) (* x (/ t_0 z))))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (z <= -1.42e+16) {
tmp = (x * (y / z)) - x;
} else if (z <= 6e-92) {
tmp = t_0 * (x / z);
} else {
tmp = x * (t_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) :: t_0
real(8) :: tmp
t_0 = (y - z) + 1.0d0
if (z <= (-1.42d+16)) then
tmp = (x * (y / z)) - x
else if (z <= 6d-92) then
tmp = t_0 * (x / z)
else
tmp = x * (t_0 / 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 <= -1.42e+16) {
tmp = (x * (y / z)) - x;
} else if (z <= 6e-92) {
tmp = t_0 * (x / z);
} else {
tmp = x * (t_0 / z);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if z <= -1.42e+16: tmp = (x * (y / z)) - x elif z <= 6e-92: tmp = t_0 * (x / z) else: tmp = x * (t_0 / z) return tmp
function code(x, y, z) t_0 = Float64(Float64(y - z) + 1.0) tmp = 0.0 if (z <= -1.42e+16) tmp = Float64(Float64(x * Float64(y / z)) - x); elseif (z <= 6e-92) tmp = Float64(t_0 * Float64(x / z)); else tmp = Float64(x * Float64(t_0 / z)); end return tmp end
function tmp_2 = code(x, y, z) t_0 = (y - z) + 1.0; tmp = 0.0; if (z <= -1.42e+16) tmp = (x * (y / z)) - x; elseif (z <= 6e-92) tmp = t_0 * (x / z); else tmp = x * (t_0 / z); end tmp_2 = tmp; end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]}, If[LessEqual[z, -1.42e+16], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[z, 6e-92], N[(t$95$0 * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t$95$0 / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - z\right) + 1\\
\mathbf{if}\;z \leq -1.42 \cdot 10^{+16}:\\
\;\;\;\;x \cdot \frac{y}{z} - x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-92}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t_0}{z}\\
\end{array}
\end{array}
if z < -1.42e16Initial program 71.3%
Simplified88.2%
Taylor expanded in y around inf 88.2%
associate-/l*93.9%
associate-/r/99.9%
Applied egg-rr99.9%
if -1.42e16 < z < 6.00000000000000027e-92Initial program 99.1%
associate-/l*92.4%
Simplified92.4%
associate-/r/99.9%
Applied egg-rr99.9%
if 6.00000000000000027e-92 < z Initial program 79.1%
associate-/l*99.9%
Simplified99.9%
clear-num99.7%
associate-/r/99.7%
clear-num99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (let* ((t_0 (+ (- y z) 1.0))) (if (<= (/ (* x t_0) z) -1e+105) (* t_0 (/ x z)) (/ x (/ z t_0)))))
double code(double x, double y, double z) {
double t_0 = (y - z) + 1.0;
double tmp;
if (((x * t_0) / z) <= -1e+105) {
tmp = t_0 * (x / 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 * t_0) / z) <= (-1d+105)) then
tmp = t_0 * (x / 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 * t_0) / z) <= -1e+105) {
tmp = t_0 * (x / z);
} else {
tmp = x / (z / t_0);
}
return tmp;
}
def code(x, y, z): t_0 = (y - z) + 1.0 tmp = 0 if ((x * t_0) / z) <= -1e+105: tmp = t_0 * (x / 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 (Float64(Float64(x * t_0) / z) <= -1e+105) tmp = Float64(t_0 * Float64(x / 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 * t_0) / z) <= -1e+105) tmp = t_0 * (x / 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[N[(N[(x * t$95$0), $MachinePrecision] / z), $MachinePrecision], -1e+105], N[(t$95$0 * N[(x / z), $MachinePrecision]), $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}\;\frac{x \cdot t_0}{z} \leq -1 \cdot 10^{+105}:\\
\;\;\;\;t_0 \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t_0}}\\
\end{array}
\end{array}
if (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z) < -9.9999999999999994e104Initial program 72.5%
associate-/l*93.1%
Simplified93.1%
associate-/r/99.9%
Applied egg-rr99.9%
if -9.9999999999999994e104 < (/.f64 (*.f64 x (+.f64 (-.f64 y z) 1)) z) Initial program 92.9%
associate-/l*98.1%
Simplified98.1%
Final simplification98.7%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -220000000000.0)
(- x)
(if (<= z 3.7e-305)
t_0
(if (<= z 1.6e-235)
(/ x z)
(if (<= z 98000.0)
t_0
(if (<= z 4e+123)
(- x)
(if (<= z 7.5e+168) (* x (/ y z)) (- x)))))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -220000000000.0) {
tmp = -x;
} else if (z <= 3.7e-305) {
tmp = t_0;
} else if (z <= 1.6e-235) {
tmp = x / z;
} else if (z <= 98000.0) {
tmp = t_0;
} else if (z <= 4e+123) {
tmp = -x;
} else if (z <= 7.5e+168) {
tmp = x * (y / 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 <= (-220000000000.0d0)) then
tmp = -x
else if (z <= 3.7d-305) then
tmp = t_0
else if (z <= 1.6d-235) then
tmp = x / z
else if (z <= 98000.0d0) then
tmp = t_0
else if (z <= 4d+123) then
tmp = -x
else if (z <= 7.5d+168) then
tmp = x * (y / 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 <= -220000000000.0) {
tmp = -x;
} else if (z <= 3.7e-305) {
tmp = t_0;
} else if (z <= 1.6e-235) {
tmp = x / z;
} else if (z <= 98000.0) {
tmp = t_0;
} else if (z <= 4e+123) {
tmp = -x;
} else if (z <= 7.5e+168) {
tmp = x * (y / z);
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -220000000000.0: tmp = -x elif z <= 3.7e-305: tmp = t_0 elif z <= 1.6e-235: tmp = x / z elif z <= 98000.0: tmp = t_0 elif z <= 4e+123: tmp = -x elif z <= 7.5e+168: tmp = x * (y / z) else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -220000000000.0) tmp = Float64(-x); elseif (z <= 3.7e-305) tmp = t_0; elseif (z <= 1.6e-235) tmp = Float64(x / z); elseif (z <= 98000.0) tmp = t_0; elseif (z <= 4e+123) tmp = Float64(-x); elseif (z <= 7.5e+168) tmp = Float64(x * Float64(y / 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 <= -220000000000.0) tmp = -x; elseif (z <= 3.7e-305) tmp = t_0; elseif (z <= 1.6e-235) tmp = x / z; elseif (z <= 98000.0) tmp = t_0; elseif (z <= 4e+123) tmp = -x; elseif (z <= 7.5e+168) tmp = x * (y / 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, -220000000000.0], (-x), If[LessEqual[z, 3.7e-305], t$95$0, If[LessEqual[z, 1.6e-235], N[(x / z), $MachinePrecision], If[LessEqual[z, 98000.0], t$95$0, If[LessEqual[z, 4e+123], (-x), If[LessEqual[z, 7.5e+168], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], (-x)]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -220000000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{-305}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-235}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 98000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 4 \cdot 10^{+123}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+168}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -2.2e11 or 98000 < z < 3.99999999999999991e123 or 7.4999999999999999e168 < z Initial program 72.7%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 76.6%
neg-mul-176.6%
Simplified76.6%
if -2.2e11 < z < 3.69999999999999977e-305 or 1.6000000000000001e-235 < z < 98000Initial program 99.1%
associate-/l*94.7%
Simplified94.7%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 68.4%
if 3.69999999999999977e-305 < z < 1.6000000000000001e-235Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 78.2%
if 3.99999999999999991e123 < z < 7.4999999999999999e168Initial program 76.6%
associate-/l*100.0%
Simplified100.0%
clear-num99.2%
associate-/r/99.2%
clear-num99.6%
Applied egg-rr99.6%
Taylor expanded in y around inf 88.8%
Final simplification73.5%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* y (/ x z))))
(if (<= z -150000000000.0)
(- x)
(if (<= z 8.2e-305)
t_0
(if (<= z 3.3e-236) (/ x z) (if (<= z 98000.0) t_0 (- x)))))))
double code(double x, double y, double z) {
double t_0 = y * (x / z);
double tmp;
if (z <= -150000000000.0) {
tmp = -x;
} else if (z <= 8.2e-305) {
tmp = t_0;
} else if (z <= 3.3e-236) {
tmp = x / z;
} else if (z <= 98000.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 = y * (x / z)
if (z <= (-150000000000.0d0)) then
tmp = -x
else if (z <= 8.2d-305) then
tmp = t_0
else if (z <= 3.3d-236) then
tmp = x / z
else if (z <= 98000.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 = y * (x / z);
double tmp;
if (z <= -150000000000.0) {
tmp = -x;
} else if (z <= 8.2e-305) {
tmp = t_0;
} else if (z <= 3.3e-236) {
tmp = x / z;
} else if (z <= 98000.0) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = y * (x / z) tmp = 0 if z <= -150000000000.0: tmp = -x elif z <= 8.2e-305: tmp = t_0 elif z <= 3.3e-236: tmp = x / z elif z <= 98000.0: tmp = t_0 else: tmp = -x return tmp
function code(x, y, z) t_0 = Float64(y * Float64(x / z)) tmp = 0.0 if (z <= -150000000000.0) tmp = Float64(-x); elseif (z <= 8.2e-305) tmp = t_0; elseif (z <= 3.3e-236) tmp = Float64(x / z); elseif (z <= 98000.0) tmp = t_0; 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 <= -150000000000.0) tmp = -x; elseif (z <= 8.2e-305) tmp = t_0; elseif (z <= 3.3e-236) tmp = x / z; elseif (z <= 98000.0) tmp = t_0; 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, -150000000000.0], (-x), If[LessEqual[z, 8.2e-305], t$95$0, If[LessEqual[z, 3.3e-236], N[(x / z), $MachinePrecision], If[LessEqual[z, 98000.0], t$95$0, (-x)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \frac{x}{z}\\
\mathbf{if}\;z \leq -150000000000:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-305}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-236}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 98000:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1.5e11 or 98000 < z Initial program 72.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in z around inf 72.7%
neg-mul-172.7%
Simplified72.7%
if -1.5e11 < z < 8.2000000000000005e-305 or 3.3000000000000001e-236 < z < 98000Initial program 99.1%
associate-/l*94.7%
Simplified94.7%
associate-/r/99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 68.4%
if 8.2000000000000005e-305 < z < 3.3000000000000001e-236Initial program 99.9%
Taylor expanded in z around 0 99.9%
Taylor expanded in y around 0 78.2%
Final simplification71.2%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.42e+16) (not (<= z 2e+27))) (- (* x (/ y z)) x) (* (+ (- y z) 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.42e+16) || !(z <= 2e+27)) {
tmp = (x * (y / z)) - x;
} else {
tmp = ((y - z) + 1.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) :: tmp
if ((z <= (-1.42d+16)) .or. (.not. (z <= 2d+27))) then
tmp = (x * (y / z)) - x
else
tmp = ((y - z) + 1.0d0) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -1.42e+16) || !(z <= 2e+27)) {
tmp = (x * (y / z)) - x;
} else {
tmp = ((y - z) + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.42e+16) or not (z <= 2e+27): tmp = (x * (y / z)) - x else: tmp = ((y - z) + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.42e+16) || !(z <= 2e+27)) tmp = Float64(Float64(x * Float64(y / z)) - x); else tmp = Float64(Float64(Float64(y - z) + 1.0) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -1.42e+16) || ~((z <= 2e+27))) tmp = (x * (y / z)) - x; else tmp = ((y - z) + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -1.42e+16], N[Not[LessEqual[z, 2e+27]], $MachinePrecision]], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.42 \cdot 10^{+16} \lor \neg \left(z \leq 2 \cdot 10^{+27}\right):\\
\;\;\;\;x \cdot \frac{y}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -1.42e16 or 2e27 < z Initial program 70.6%
Simplified89.4%
Taylor expanded in y around inf 89.4%
associate-/l*93.8%
associate-/r/99.9%
Applied egg-rr99.9%
if -1.42e16 < z < 2e27Initial program 99.2%
associate-/l*93.7%
Simplified93.7%
associate-/r/99.8%
Applied egg-rr99.8%
Final simplification99.9%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 2.6e-24))) (- (* x (/ y z)) x) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 2.6e-24)) {
tmp = (x * (y / z)) - x;
} 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 <= (-1.0d0)) .or. (.not. (y <= 2.6d-24))) then
tmp = (x * (y / z)) - x
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 <= -1.0) || !(y <= 2.6e-24)) {
tmp = (x * (y / z)) - x;
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 2.6e-24): tmp = (x * (y / z)) - x else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 2.6e-24)) tmp = Float64(Float64(x * Float64(y / z)) - x); else tmp = Float64(Float64(x / z) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((y <= -1.0) || ~((y <= 2.6e-24))) tmp = (x * (y / z)) - x; else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 2.6e-24]], $MachinePrecision]], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 2.6 \cdot 10^{-24}\right):\\
\;\;\;\;x \cdot \frac{y}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -1 or 2.6e-24 < y Initial program 84.8%
Simplified90.4%
Taylor expanded in y around inf 89.4%
associate-/l*93.8%
associate-/r/92.1%
Applied egg-rr92.1%
if -1 < y < 2.6e-24Initial program 88.1%
Simplified100.0%
Taylor expanded in y around 0 98.9%
Final simplification95.3%
(FPCore (x y z) :precision binary64 (if (or (<= z -0.96) (not (<= z 6e-5))) (- (* x (/ y z)) x) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -0.96) || !(z <= 6e-5)) {
tmp = (x * (y / z)) - x;
} 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 <= (-0.96d0)) .or. (.not. (z <= 6d-5))) then
tmp = (x * (y / z)) - x
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 <= -0.96) || !(z <= 6e-5)) {
tmp = (x * (y / z)) - x;
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -0.96) or not (z <= 6e-5): tmp = (x * (y / z)) - x else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -0.96) || !(z <= 6e-5)) tmp = Float64(Float64(x * Float64(y / z)) - x); 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 <= -0.96) || ~((z <= 6e-5))) tmp = (x * (y / z)) - x; else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -0.96], N[Not[LessEqual[z, 6e-5]], $MachinePrecision]], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.96 \lor \neg \left(z \leq 6 \cdot 10^{-5}\right):\\
\;\;\;\;x \cdot \frac{y}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -0.95999999999999996 or 6.00000000000000015e-5 < z Initial program 73.1%
Simplified89.9%
Taylor expanded in y around inf 88.4%
associate-/l*93.0%
associate-/r/98.4%
Applied egg-rr98.4%
if -0.95999999999999996 < z < 6.00000000000000015e-5Initial program 99.9%
Taylor expanded in z around 0 99.1%
Final simplification98.7%
(FPCore (x y z) :precision binary64 (if (<= y -1.0) (- (/ y (/ z x)) x) (if (<= y 2.6e-24) (- (/ x z) x) (- (* x (/ y z)) x))))
double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = (y / (z / x)) - x;
} else if (y <= 2.6e-24) {
tmp = (x / z) - x;
} else {
tmp = (x * (y / 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 <= (-1.0d0)) then
tmp = (y / (z / x)) - x
else if (y <= 2.6d-24) then
tmp = (x / z) - x
else
tmp = (x * (y / z)) - x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -1.0) {
tmp = (y / (z / x)) - x;
} else if (y <= 2.6e-24) {
tmp = (x / z) - x;
} else {
tmp = (x * (y / z)) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -1.0: tmp = (y / (z / x)) - x elif y <= 2.6e-24: tmp = (x / z) - x else: tmp = (x * (y / z)) - x return tmp
function code(x, y, z) tmp = 0.0 if (y <= -1.0) tmp = Float64(Float64(y / Float64(z / x)) - x); elseif (y <= 2.6e-24) tmp = Float64(Float64(x / z) - x); else tmp = Float64(Float64(x * Float64(y / z)) - x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -1.0) tmp = (y / (z / x)) - x; elseif (y <= 2.6e-24) tmp = (x / z) - x; else tmp = (x * (y / z)) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -1.0], N[(N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision], If[LessEqual[y, 2.6e-24], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision] - x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1:\\
\;\;\;\;\frac{y}{\frac{z}{x}} - x\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{-24}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z} - x\\
\end{array}
\end{array}
if y < -1Initial program 83.6%
Simplified89.1%
Taylor expanded in y around inf 88.3%
associate-/l*93.0%
Simplified93.0%
if -1 < y < 2.6e-24Initial program 88.1%
Simplified100.0%
Taylor expanded in y around 0 98.9%
if 2.6e-24 < y Initial program 86.1%
Simplified91.6%
Taylor expanded in y around inf 90.6%
associate-/l*94.6%
associate-/r/96.1%
Applied egg-rr96.1%
Final simplification96.6%
(FPCore (x y z) :precision binary64 (if (<= y -2.7e+15) (* y (/ x z)) (if (<= y 5.8e+66) (- (/ x z) x) (* x (/ y z)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+15) {
tmp = y * (x / z);
} else if (y <= 5.8e+66) {
tmp = (x / z) - x;
} else {
tmp = 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 (y <= (-2.7d+15)) then
tmp = y * (x / z)
else if (y <= 5.8d+66) then
tmp = (x / z) - x
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -2.7e+15) {
tmp = y * (x / z);
} else if (y <= 5.8e+66) {
tmp = (x / z) - x;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -2.7e+15: tmp = y * (x / z) elif y <= 5.8e+66: tmp = (x / z) - x else: tmp = x * (y / z) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -2.7e+15) tmp = Float64(y * Float64(x / z)); elseif (y <= 5.8e+66) tmp = Float64(Float64(x / z) - x); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -2.7e+15) tmp = y * (x / z); elseif (y <= 5.8e+66) tmp = (x / z) - x; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -2.7e+15], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.8e+66], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.7 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 5.8 \cdot 10^{+66}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if y < -2.7e15Initial program 83.1%
associate-/l*89.7%
Simplified89.7%
associate-/r/84.2%
Applied egg-rr84.2%
Taylor expanded in y around inf 71.5%
if -2.7e15 < y < 5.79999999999999972e66Initial program 88.2%
Simplified100.0%
Taylor expanded in y around 0 95.6%
if 5.79999999999999972e66 < y Initial program 85.7%
associate-/l*96.4%
Simplified96.4%
clear-num96.3%
associate-/r/96.3%
clear-num96.3%
Applied egg-rr96.3%
Taylor expanded in y around inf 83.4%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= y -4.4e+15) (* y (/ x z)) (if (<= y 2.9e+66) (- (/ x z) x) (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+15) {
tmp = y * (x / z);
} else if (y <= 2.9e+66) {
tmp = (x / z) - x;
} else {
tmp = x / (z / 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.4d+15)) then
tmp = y * (x / z)
else if (y <= 2.9d+66) then
tmp = (x / z) - x
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4.4e+15) {
tmp = y * (x / z);
} else if (y <= 2.9e+66) {
tmp = (x / z) - x;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4.4e+15: tmp = y * (x / z) elif y <= 2.9e+66: tmp = (x / z) - x else: tmp = x / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4.4e+15) tmp = Float64(y * Float64(x / z)); elseif (y <= 2.9e+66) tmp = Float64(Float64(x / z) - x); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4.4e+15) tmp = y * (x / z); elseif (y <= 2.9e+66) tmp = (x / z) - x; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4.4e+15], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e+66], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.4 \cdot 10^{+15}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{+66}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < -4.4e15Initial program 83.1%
associate-/l*89.7%
Simplified89.7%
associate-/r/84.2%
Applied egg-rr84.2%
Taylor expanded in y around inf 71.5%
if -4.4e15 < y < 2.89999999999999986e66Initial program 88.2%
Simplified100.0%
Taylor expanded in y around 0 95.6%
if 2.89999999999999986e66 < y Initial program 85.7%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in y around inf 83.4%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= y -4400000000000.0) (/ y (/ z x)) (if (<= y 3.6e+66) (- (/ x z) x) (/ x (/ z y)))))
double code(double x, double y, double z) {
double tmp;
if (y <= -4400000000000.0) {
tmp = y / (z / x);
} else if (y <= 3.6e+66) {
tmp = (x / z) - x;
} else {
tmp = x / (z / 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 <= (-4400000000000.0d0)) then
tmp = y / (z / x)
else if (y <= 3.6d+66) then
tmp = (x / z) - x
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (y <= -4400000000000.0) {
tmp = y / (z / x);
} else if (y <= 3.6e+66) {
tmp = (x / z) - x;
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z): tmp = 0 if y <= -4400000000000.0: tmp = y / (z / x) elif y <= 3.6e+66: tmp = (x / z) - x else: tmp = x / (z / y) return tmp
function code(x, y, z) tmp = 0.0 if (y <= -4400000000000.0) tmp = Float64(y / Float64(z / x)); elseif (y <= 3.6e+66) tmp = Float64(Float64(x / z) - x); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (y <= -4400000000000.0) tmp = y / (z / x); elseif (y <= 3.6e+66) tmp = (x / z) - x; else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[y, -4400000000000.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.6e+66], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4400000000000:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 3.6 \cdot 10^{+66}:\\
\;\;\;\;\frac{x}{z} - x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if y < -4.4e12Initial program 83.1%
associate-/l*89.7%
Simplified89.7%
associate-/r/84.2%
Applied egg-rr84.2%
Taylor expanded in y around inf 71.5%
*-commutative71.5%
clear-num71.4%
un-div-inv71.6%
Applied egg-rr71.6%
if -4.4e12 < y < 3.6e66Initial program 88.2%
Simplified100.0%
Taylor expanded in y around 0 95.6%
if 3.6e66 < y Initial program 85.7%
associate-/l*96.4%
Simplified96.4%
Taylor expanded in y around inf 83.4%
Final simplification86.8%
(FPCore (x y z) :precision binary64 (if (<= z -1.0) (- x) (if (<= z 6e-5) (/ x z) (- x))))
double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= 6e-5) {
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) :: tmp
if (z <= (-1.0d0)) then
tmp = -x
else if (z <= 6d-5) then
tmp = x / z
else
tmp = -x
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (z <= -1.0) {
tmp = -x;
} else if (z <= 6e-5) {
tmp = x / z;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -1.0: tmp = -x elif z <= 6e-5: tmp = x / z else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -1.0) tmp = Float64(-x); elseif (z <= 6e-5) tmp = Float64(x / z); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -1.0) tmp = -x; elseif (z <= 6e-5) tmp = x / z; else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -1.0], (-x), If[LessEqual[z, 6e-5], N[(x / z), $MachinePrecision], (-x)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-5}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1 or 6.00000000000000015e-5 < z Initial program 73.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in z around inf 70.7%
neg-mul-170.7%
Simplified70.7%
if -1 < z < 6.00000000000000015e-5Initial program 99.9%
Taylor expanded in z around 0 99.1%
Taylor expanded in y around 0 53.4%
Final simplification62.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 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 86.4%
associate-/l*96.5%
Simplified96.5%
Taylor expanded in z around inf 37.2%
neg-mul-137.2%
Simplified37.2%
Final simplification37.2%
(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 2023199
(FPCore (x y z)
:name "Diagrams.TwoD.Segment.Bernstein:evaluateBernstein from diagrams-lib-1.3.0.3"
:precision binary64
:herbie-target
(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))