
(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 -4e-11) (not (<= z 2e-45))) (* x (+ (/ (+ y 1.0) z) -1.0)) (* (+ (- y z) 1.0) (/ x z))))
double code(double x, double y, double z) {
double tmp;
if ((z <= -4e-11) || !(z <= 2e-45)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} 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 <= (-4d-11)) .or. (.not. (z <= 2d-45))) then
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
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 <= -4e-11) || !(z <= 2e-45)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = ((y - z) + 1.0) * (x / z);
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -4e-11) or not (z <= 2e-45): tmp = x * (((y + 1.0) / z) + -1.0) else: tmp = ((y - z) + 1.0) * (x / z) return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -4e-11) || !(z <= 2e-45)) tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); 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 <= -4e-11) || ~((z <= 2e-45))) tmp = x * (((y + 1.0) / z) + -1.0); else tmp = ((y - z) + 1.0) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -4e-11], N[Not[LessEqual[z, 2e-45]], $MachinePrecision]], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $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 -4 \cdot 10^{-11} \lor \neg \left(z \leq 2 \cdot 10^{-45}\right):\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(y - z\right) + 1\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -3.99999999999999976e-11 or 1.99999999999999997e-45 < z Initial program 76.7%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if -3.99999999999999976e-11 < z < 1.99999999999999997e-45Initial program 99.8%
*-commutative99.8%
associate-/l*99.9%
+-commutative99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y z)
:precision binary64
(if (<= z -7.8e+33)
(- x)
(if (<= z -3.05e-15)
(* x (/ y z))
(if (<= z -4.5e-272) (/ x z) (if (<= z 5.8e+72) (* y (/ x z)) (- x))))))
double code(double x, double y, double z) {
double tmp;
if (z <= -7.8e+33) {
tmp = -x;
} else if (z <= -3.05e-15) {
tmp = x * (y / z);
} else if (z <= -4.5e-272) {
tmp = x / z;
} else if (z <= 5.8e+72) {
tmp = y * (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 <= (-7.8d+33)) then
tmp = -x
else if (z <= (-3.05d-15)) then
tmp = x * (y / z)
else if (z <= (-4.5d-272)) then
tmp = x / z
else if (z <= 5.8d+72) then
tmp = y * (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 <= -7.8e+33) {
tmp = -x;
} else if (z <= -3.05e-15) {
tmp = x * (y / z);
} else if (z <= -4.5e-272) {
tmp = x / z;
} else if (z <= 5.8e+72) {
tmp = y * (x / z);
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if z <= -7.8e+33: tmp = -x elif z <= -3.05e-15: tmp = x * (y / z) elif z <= -4.5e-272: tmp = x / z elif z <= 5.8e+72: tmp = y * (x / z) else: tmp = -x return tmp
function code(x, y, z) tmp = 0.0 if (z <= -7.8e+33) tmp = Float64(-x); elseif (z <= -3.05e-15) tmp = Float64(x * Float64(y / z)); elseif (z <= -4.5e-272) tmp = Float64(x / z); elseif (z <= 5.8e+72) tmp = Float64(y * Float64(x / z)); else tmp = Float64(-x); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (z <= -7.8e+33) tmp = -x; elseif (z <= -3.05e-15) tmp = x * (y / z); elseif (z <= -4.5e-272) tmp = x / z; elseif (z <= 5.8e+72) tmp = y * (x / z); else tmp = -x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[z, -7.8e+33], (-x), If[LessEqual[z, -3.05e-15], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.5e-272], N[(x / z), $MachinePrecision], If[LessEqual[z, 5.8e+72], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], (-x)]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+33}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -3.05 \cdot 10^{-15}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{-272}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -7.8000000000000004e33 or 5.80000000000000034e72 < z Initial program 70.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 77.7%
neg-mul-177.7%
Simplified77.7%
if -7.8000000000000004e33 < z < -3.04999999999999986e-15Initial program 99.6%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub100.0%
*-inverses100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
Taylor expanded in y around inf 64.5%
associate-/l*64.5%
Simplified64.5%
if -3.04999999999999986e-15 < z < -4.4999999999999998e-272Initial program 99.8%
associate-/l*91.1%
+-commutative91.1%
associate-+r-91.1%
div-sub91.1%
*-inverses91.1%
sub-neg91.1%
metadata-eval91.1%
+-commutative91.1%
Simplified91.1%
Taylor expanded in z around 0 99.7%
associate-/l*91.0%
Simplified91.0%
Taylor expanded in y around 0 61.3%
if -4.4999999999999998e-272 < z < 5.80000000000000034e72Initial program 98.8%
associate-/l*84.6%
+-commutative84.6%
associate-+r-84.6%
div-sub84.6%
*-inverses84.6%
sub-neg84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in y around inf 65.1%
*-commutative65.1%
associate-/l*71.2%
Applied egg-rr71.2%
(FPCore (x y z)
:precision binary64
(let* ((t_0 (* x (/ y z))))
(if (<= z -1.85e+33)
(- x)
(if (<= z -1.15e-14)
t_0
(if (<= z 4.8e-208) (/ x z) (if (<= z 5.4e+73) t_0 (- x)))))))
double code(double x, double y, double z) {
double t_0 = x * (y / z);
double tmp;
if (z <= -1.85e+33) {
tmp = -x;
} else if (z <= -1.15e-14) {
tmp = t_0;
} else if (z <= 4.8e-208) {
tmp = x / z;
} else if (z <= 5.4e+73) {
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 <= (-1.85d+33)) then
tmp = -x
else if (z <= (-1.15d-14)) then
tmp = t_0
else if (z <= 4.8d-208) then
tmp = x / z
else if (z <= 5.4d+73) 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 <= -1.85e+33) {
tmp = -x;
} else if (z <= -1.15e-14) {
tmp = t_0;
} else if (z <= 4.8e-208) {
tmp = x / z;
} else if (z <= 5.4e+73) {
tmp = t_0;
} else {
tmp = -x;
}
return tmp;
}
def code(x, y, z): t_0 = x * (y / z) tmp = 0 if z <= -1.85e+33: tmp = -x elif z <= -1.15e-14: tmp = t_0 elif z <= 4.8e-208: tmp = x / z elif z <= 5.4e+73: 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 <= -1.85e+33) tmp = Float64(-x); elseif (z <= -1.15e-14) tmp = t_0; elseif (z <= 4.8e-208) tmp = Float64(x / z); elseif (z <= 5.4e+73) 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 <= -1.85e+33) tmp = -x; elseif (z <= -1.15e-14) tmp = t_0; elseif (z <= 4.8e-208) tmp = x / z; elseif (z <= 5.4e+73) 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, -1.85e+33], (-x), If[LessEqual[z, -1.15e-14], t$95$0, If[LessEqual[z, 4.8e-208], N[(x / z), $MachinePrecision], If[LessEqual[z, 5.4e+73], t$95$0, (-x)]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -1.85 \cdot 10^{+33}:\\
\;\;\;\;-x\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-14}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-208}:\\
\;\;\;\;\frac{x}{z}\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+73}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;-x\\
\end{array}
\end{array}
if z < -1.8499999999999999e33 or 5.3999999999999998e73 < z Initial program 70.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 77.7%
neg-mul-177.7%
Simplified77.7%
if -1.8499999999999999e33 < z < -1.14999999999999999e-14 or 4.7999999999999998e-208 < z < 5.3999999999999998e73Initial program 98.3%
associate-/l*93.5%
+-commutative93.5%
associate-+r-93.5%
div-sub93.5%
*-inverses93.5%
sub-neg93.5%
metadata-eval93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in y around inf 68.6%
associate-/l*63.8%
Simplified63.8%
if -1.14999999999999999e-14 < z < 4.7999999999999998e-208Initial program 99.8%
associate-/l*84.5%
+-commutative84.5%
associate-+r-84.5%
div-sub84.5%
*-inverses84.5%
sub-neg84.5%
metadata-eval84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in z around 0 99.8%
associate-/l*84.5%
Simplified84.5%
Taylor expanded in y around 0 59.4%
(FPCore (x y z) :precision binary64 (if (or (<= z -3.7e-17) (not (<= z 3e-43))) (* x (+ (/ (+ y 1.0) z) -1.0)) (/ (+ x (* x y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e-17) || !(z <= 3e-43)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x + (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 <= (-3.7d-17)) .or. (.not. (z <= 3d-43))) then
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
else
tmp = (x + (x * y)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -3.7e-17) || !(z <= 3e-43)) {
tmp = x * (((y + 1.0) / z) + -1.0);
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -3.7e-17) or not (z <= 3e-43): tmp = x * (((y + 1.0) / z) + -1.0) else: tmp = (x + (x * y)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -3.7e-17) || !(z <= 3e-43)) tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); else tmp = Float64(Float64(x + Float64(x * y)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -3.7e-17) || ~((z <= 3e-43))) tmp = x * (((y + 1.0) / z) + -1.0); else tmp = (x + (x * y)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -3.7e-17], N[Not[LessEqual[z, 3e-43]], $MachinePrecision]], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.7 \cdot 10^{-17} \lor \neg \left(z \leq 3 \cdot 10^{-43}\right):\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\end{array}
\end{array}
if z < -3.6999999999999997e-17 or 3.00000000000000003e-43 < z Initial program 77.0%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
if -3.6999999999999997e-17 < z < 3.00000000000000003e-43Initial program 99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 99.8%
Final simplification99.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -13500000000.0) (not (<= z 4.1e-7))) (* x (+ -1.0 (/ y z))) (/ (+ x (* x y)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000000.0) || !(z <= 4.1e-7)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x + (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 <= (-13500000000.0d0)) .or. (.not. (z <= 4.1d-7))) then
tmp = x * ((-1.0d0) + (y / z))
else
tmp = (x + (x * y)) / z
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000000.0) || !(z <= 4.1e-7)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x + (x * y)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -13500000000.0) or not (z <= 4.1e-7): tmp = x * (-1.0 + (y / z)) else: tmp = (x + (x * y)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -13500000000.0) || !(z <= 4.1e-7)) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); else tmp = Float64(Float64(x + Float64(x * y)) / z); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if ((z <= -13500000000.0) || ~((z <= 4.1e-7))) tmp = x * (-1.0 + (y / z)); else tmp = (x + (x * y)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -13500000000.0], N[Not[LessEqual[z, 4.1e-7]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(x * y), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000000 \lor \neg \left(z \leq 4.1 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x + x \cdot y}{z}\\
\end{array}
\end{array}
if z < -1.35e10 or 4.0999999999999999e-7 < z Initial program 75.3%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 99.2%
if -1.35e10 < z < 4.0999999999999999e-7Initial program 99.8%
distribute-lft-in99.8%
*-rgt-identity99.8%
Applied egg-rr99.8%
Taylor expanded in z around 0 98.3%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= z -13500000000.0) (not (<= z 4.1e-7))) (* x (+ -1.0 (/ y z))) (/ (* x (+ y 1.0)) z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -13500000000.0) || !(z <= 4.1e-7)) {
tmp = x * (-1.0 + (y / 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 <= (-13500000000.0d0)) .or. (.not. (z <= 4.1d-7))) then
tmp = x * ((-1.0d0) + (y / 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 <= -13500000000.0) || !(z <= 4.1e-7)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x * (y + 1.0)) / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -13500000000.0) or not (z <= 4.1e-7): tmp = x * (-1.0 + (y / z)) else: tmp = (x * (y + 1.0)) / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -13500000000.0) || !(z <= 4.1e-7)) tmp = Float64(x * Float64(-1.0 + Float64(y / 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 <= -13500000000.0) || ~((z <= 4.1e-7))) tmp = x * (-1.0 + (y / z)); else tmp = (x * (y + 1.0)) / z; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[z, -13500000000.0], N[Not[LessEqual[z, 4.1e-7]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -13500000000 \lor \neg \left(z \leq 4.1 \cdot 10^{-7}\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + 1\right)}{z}\\
\end{array}
\end{array}
if z < -1.35e10 or 4.0999999999999999e-7 < z Initial program 75.3%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around inf 99.2%
if -1.35e10 < z < 4.0999999999999999e-7Initial program 99.8%
associate-/l*85.6%
+-commutative85.6%
associate-+r-85.6%
div-sub85.7%
*-inverses85.7%
sub-neg85.7%
metadata-eval85.7%
+-commutative85.7%
Simplified85.7%
Taylor expanded in z around 0 98.3%
Final simplification98.8%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.0) (not (<= y 1.0))) (* x (+ -1.0 (/ y z))) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.0) || !(y <= 1.0)) {
tmp = x * (-1.0 + (y / 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 <= (-1.0d0)) .or. (.not. (y <= 1.0d0))) then
tmp = x * ((-1.0d0) + (y / 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 <= -1.0) || !(y <= 1.0)) {
tmp = x * (-1.0 + (y / z));
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.0) or not (y <= 1.0): tmp = x * (-1.0 + (y / z)) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.0) || !(y <= 1.0)) tmp = Float64(x * Float64(-1.0 + Float64(y / z))); 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 <= 1.0))) tmp = x * (-1.0 + (y / z)); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.0], N[Not[LessEqual[y, 1.0]], $MachinePrecision]], N[(x * N[(-1.0 + N[(y / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / z), $MachinePrecision] - x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1 \lor \neg \left(y \leq 1\right):\\
\;\;\;\;x \cdot \left(-1 + \frac{y}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -1 or 1 < y Initial program 84.2%
associate-/l*87.2%
+-commutative87.2%
associate-+r-87.2%
div-sub87.2%
*-inverses87.2%
sub-neg87.2%
metadata-eval87.2%
+-commutative87.2%
Simplified87.2%
Taylor expanded in y around inf 85.8%
if -1 < y < 1Initial program 91.6%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in y around 0 98.4%
sub-neg98.4%
metadata-eval98.4%
distribute-rgt-in98.4%
associate-*l/98.5%
*-lft-identity98.5%
neg-mul-198.5%
unsub-neg98.5%
Simplified98.5%
Final simplification91.4%
(FPCore (x y z) :precision binary64 (if (or (<= y -1.6e+49) (not (<= y 4.2e+20))) (* y (/ x z)) (- (/ x z) x)))
double code(double x, double y, double z) {
double tmp;
if ((y <= -1.6e+49) || !(y <= 4.2e+20)) {
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 <= (-1.6d+49)) .or. (.not. (y <= 4.2d+20))) 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 <= -1.6e+49) || !(y <= 4.2e+20)) {
tmp = y * (x / z);
} else {
tmp = (x / z) - x;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (y <= -1.6e+49) or not (y <= 4.2e+20): tmp = y * (x / z) else: tmp = (x / z) - x return tmp
function code(x, y, z) tmp = 0.0 if ((y <= -1.6e+49) || !(y <= 4.2e+20)) 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 <= -1.6e+49) || ~((y <= 4.2e+20))) tmp = y * (x / z); else tmp = (x / z) - x; end tmp_2 = tmp; end
code[x_, y_, z_] := If[Or[LessEqual[y, -1.6e+49], N[Not[LessEqual[y, 4.2e+20]], $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 -1.6 \cdot 10^{+49} \lor \neg \left(y \leq 4.2 \cdot 10^{+20}\right):\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} - x\\
\end{array}
\end{array}
if y < -1.60000000000000007e49 or 4.2e20 < y Initial program 86.2%
associate-/l*85.9%
+-commutative85.9%
associate-+r-85.9%
div-sub85.9%
*-inverses85.9%
sub-neg85.9%
metadata-eval85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in y around inf 76.7%
*-commutative76.7%
associate-/l*78.7%
Applied egg-rr78.7%
if -1.60000000000000007e49 < y < 4.2e20Initial program 88.8%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
Taylor expanded in y around 0 94.8%
sub-neg94.8%
metadata-eval94.8%
distribute-rgt-in94.8%
associate-*l/94.9%
*-lft-identity94.9%
neg-mul-194.9%
unsub-neg94.9%
Simplified94.9%
Final simplification86.7%
(FPCore (x y z) :precision binary64 (if (<= x 5e-15) (/ (* x (+ (- y z) 1.0)) z) (* x (+ (/ (+ y 1.0) z) -1.0))))
double code(double x, double y, double z) {
double tmp;
if (x <= 5e-15) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -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 (x <= 5d-15) then
tmp = (x * ((y - z) + 1.0d0)) / z
else
tmp = x * (((y + 1.0d0) / z) + (-1.0d0))
end if
code = tmp
end function
public static double code(double x, double y, double z) {
double tmp;
if (x <= 5e-15) {
tmp = (x * ((y - z) + 1.0)) / z;
} else {
tmp = x * (((y + 1.0) / z) + -1.0);
}
return tmp;
}
def code(x, y, z): tmp = 0 if x <= 5e-15: tmp = (x * ((y - z) + 1.0)) / z else: tmp = x * (((y + 1.0) / z) + -1.0) return tmp
function code(x, y, z) tmp = 0.0 if (x <= 5e-15) tmp = Float64(Float64(x * Float64(Float64(y - z) + 1.0)) / z); else tmp = Float64(x * Float64(Float64(Float64(y + 1.0) / z) + -1.0)); end return tmp end
function tmp_2 = code(x, y, z) tmp = 0.0; if (x <= 5e-15) tmp = (x * ((y - z) + 1.0)) / z; else tmp = x * (((y + 1.0) / z) + -1.0); end tmp_2 = tmp; end
code[x_, y_, z_] := If[LessEqual[x, 5e-15], N[(N[(x * N[(N[(y - z), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(x * N[(N[(N[(y + 1.0), $MachinePrecision] / z), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 5 \cdot 10^{-15}:\\
\;\;\;\;\frac{x \cdot \left(\left(y - z\right) + 1\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y + 1}{z} + -1\right)\\
\end{array}
\end{array}
if x < 4.99999999999999999e-15Initial program 92.8%
if 4.99999999999999999e-15 < x Initial program 68.4%
associate-/l*99.9%
+-commutative99.9%
associate-+r-99.9%
div-sub99.9%
*-inverses99.9%
sub-neg99.9%
metadata-eval99.9%
+-commutative99.9%
Simplified99.9%
(FPCore (x y z) :precision binary64 (if (or (<= z -1.0) (not (<= z 4.1e-7))) (- x) (/ x z)))
double code(double x, double y, double z) {
double tmp;
if ((z <= -1.0) || !(z <= 4.1e-7)) {
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 <= 4.1d-7))) 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 <= 4.1e-7)) {
tmp = -x;
} else {
tmp = x / z;
}
return tmp;
}
def code(x, y, z): tmp = 0 if (z <= -1.0) or not (z <= 4.1e-7): tmp = -x else: tmp = x / z return tmp
function code(x, y, z) tmp = 0.0 if ((z <= -1.0) || !(z <= 4.1e-7)) 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 <= 4.1e-7))) 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, 4.1e-7]], $MachinePrecision]], (-x), N[(x / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 4.1 \cdot 10^{-7}\right):\\
\;\;\;\;-x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z}\\
\end{array}
\end{array}
if z < -1 or 4.0999999999999999e-7 < z Initial program 75.7%
associate-/l*99.8%
+-commutative99.8%
associate-+r-99.8%
div-sub99.8%
*-inverses99.8%
sub-neg99.8%
metadata-eval99.8%
+-commutative99.8%
Simplified99.8%
Taylor expanded in z around inf 66.4%
neg-mul-166.4%
Simplified66.4%
if -1 < z < 4.0999999999999999e-7Initial program 99.8%
associate-/l*85.4%
+-commutative85.4%
associate-+r-85.4%
div-sub85.4%
*-inverses85.4%
sub-neg85.4%
metadata-eval85.4%
+-commutative85.4%
Simplified85.4%
Taylor expanded in z around 0 98.3%
associate-/l*83.8%
Simplified83.8%
Taylor expanded in y around 0 53.4%
Final simplification60.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 87.5%
associate-/l*92.8%
+-commutative92.8%
associate-+r-92.8%
div-sub92.8%
*-inverses92.8%
sub-neg92.8%
metadata-eval92.8%
+-commutative92.8%
Simplified92.8%
Taylor expanded in z around inf 35.8%
neg-mul-135.8%
Simplified35.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 2024096
(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))