
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
(FPCore (x y z t) :precision binary64 (* x (+ (/ y z) (* t (/ -1.0 (- 1.0 z))))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t * (-1.0 / (1.0 - z))));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) + (t * ((-1.0d0) / (1.0d0 - z))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t * (-1.0 / (1.0 - z))));
}
def code(x, y, z, t): return x * ((y / z) + (t * (-1.0 / (1.0 - z))))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t * Float64(-1.0 / Float64(1.0 - z))))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t * (-1.0 / (1.0 - z)))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t * N[(-1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + t \cdot \frac{-1}{1 - z}\right)
\end{array}
Initial program 94.6%
clear-num94.6%
associate-/r/94.7%
Applied egg-rr94.7%
Final simplification94.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))))
(if (<= z -8.2e+74)
t_1
(if (<= z 7.5e+41)
(* x (- (/ y z) t))
(if (<= z 1.1e+116)
(/ x (/ z t))
(if (<= z 3.2e+149)
t_1
(if (<= z 7.6e+156) (* t (/ x z)) (/ x (/ z y)))))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (z <= -8.2e+74) {
tmp = t_1;
} else if (z <= 7.5e+41) {
tmp = x * ((y / z) - t);
} else if (z <= 1.1e+116) {
tmp = x / (z / t);
} else if (z <= 3.2e+149) {
tmp = t_1;
} else if (z <= 7.6e+156) {
tmp = t * (x / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / z)
if (z <= (-8.2d+74)) then
tmp = t_1
else if (z <= 7.5d+41) then
tmp = x * ((y / z) - t)
else if (z <= 1.1d+116) then
tmp = x / (z / t)
else if (z <= 3.2d+149) then
tmp = t_1
else if (z <= 7.6d+156) then
tmp = t * (x / z)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (z <= -8.2e+74) {
tmp = t_1;
} else if (z <= 7.5e+41) {
tmp = x * ((y / z) - t);
} else if (z <= 1.1e+116) {
tmp = x / (z / t);
} else if (z <= 3.2e+149) {
tmp = t_1;
} else if (z <= 7.6e+156) {
tmp = t * (x / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) tmp = 0 if z <= -8.2e+74: tmp = t_1 elif z <= 7.5e+41: tmp = x * ((y / z) - t) elif z <= 1.1e+116: tmp = x / (z / t) elif z <= 3.2e+149: tmp = t_1 elif z <= 7.6e+156: tmp = t * (x / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -8.2e+74) tmp = t_1; elseif (z <= 7.5e+41) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 1.1e+116) tmp = Float64(x / Float64(z / t)); elseif (z <= 3.2e+149) tmp = t_1; elseif (z <= 7.6e+156) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / z); tmp = 0.0; if (z <= -8.2e+74) tmp = t_1; elseif (z <= 7.5e+41) tmp = x * ((y / z) - t); elseif (z <= 1.1e+116) tmp = x / (z / t); elseif (z <= 3.2e+149) tmp = t_1; elseif (z <= 7.6e+156) tmp = t * (x / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -8.2e+74], t$95$1, If[LessEqual[z, 7.5e+41], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e+116], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.2e+149], t$95$1, If[LessEqual[z, 7.6e+156], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -8.2 \cdot 10^{+74}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+41}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{+116}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;z \leq 3.2 \cdot 10^{+149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+156}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if z < -8.2000000000000001e74 or 1.1e116 < z < 3.2000000000000002e149Initial program 98.1%
Taylor expanded in y around inf 66.1%
associate-*r/74.9%
Simplified74.9%
if -8.2000000000000001e74 < z < 7.50000000000000072e41Initial program 94.4%
Taylor expanded in z around 0 87.7%
+-commutative87.7%
associate-*r/86.5%
*-commutative86.5%
associate-*r*86.5%
neg-mul-186.5%
distribute-rgt-out88.4%
unsub-neg88.4%
Simplified88.4%
if 7.50000000000000072e41 < z < 1.1e116Initial program 99.7%
Taylor expanded in y around 0 65.0%
associate-*r/65.0%
mul-1-neg65.0%
*-commutative65.0%
distribute-rgt-neg-in65.0%
associate-*r/65.1%
neg-mul-165.1%
*-commutative65.1%
associate-*r/65.1%
metadata-eval65.1%
associate-/r*65.1%
neg-mul-165.1%
associate-*r/65.1%
*-rgt-identity65.1%
neg-sub065.1%
associate--r-65.1%
metadata-eval65.1%
Simplified65.1%
Taylor expanded in z around inf 65.0%
*-commutative65.0%
associate-/l*65.1%
Simplified65.1%
if 3.2000000000000002e149 < z < 7.60000000000000048e156Initial program 99.2%
Taylor expanded in y around 0 99.2%
associate-*r/99.2%
mul-1-neg99.2%
*-commutative99.2%
distribute-rgt-neg-in99.2%
associate-*r/99.2%
neg-mul-199.2%
*-commutative99.2%
associate-*r/100.0%
metadata-eval100.0%
associate-/r*100.0%
neg-mul-1100.0%
associate-*r/99.2%
*-rgt-identity99.2%
neg-sub099.2%
associate--r-99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in z around inf 99.2%
associate-*r/100.0%
Simplified100.0%
if 7.60000000000000048e156 < z Initial program 86.8%
Taylor expanded in y around inf 57.8%
associate-*r/67.4%
Simplified67.4%
associate-*r/57.8%
associate-/l*67.6%
Applied egg-rr67.6%
Final simplification82.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -52000000.0) (not (<= z 0.021))) (/ x (/ z (+ y t))) (* x (+ (/ y z) (* t (- -1.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -52000000.0) || !(z <= 0.021)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) + (t * (-1.0 - z)));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-52000000.0d0)) .or. (.not. (z <= 0.021d0))) then
tmp = x / (z / (y + t))
else
tmp = x * ((y / z) + (t * ((-1.0d0) - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -52000000.0) || !(z <= 0.021)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) + (t * (-1.0 - z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -52000000.0) or not (z <= 0.021): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) + (t * (-1.0 - z))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -52000000.0) || !(z <= 0.021)) tmp = Float64(x / Float64(z / Float64(y + t))); else tmp = Float64(x * Float64(Float64(y / z) + Float64(t * Float64(-1.0 - z)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -52000000.0) || ~((z <= 0.021))) tmp = x / (z / (y + t)); else tmp = x * ((y / z) + (t * (-1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -52000000.0], N[Not[LessEqual[z, 0.021]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t * N[(-1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -52000000 \lor \neg \left(z \leq 0.021\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + t \cdot \left(-1 - z\right)\right)\\
\end{array}
\end{array}
if z < -5.2e7 or 0.0210000000000000013 < z Initial program 96.0%
Taylor expanded in z around inf 87.9%
associate-/l*95.5%
cancel-sign-sub-inv95.5%
metadata-eval95.5%
*-lft-identity95.5%
+-commutative95.5%
Simplified95.5%
if -5.2e7 < z < 0.0210000000000000013Initial program 93.3%
clear-num93.3%
associate-/r/93.3%
Applied egg-rr93.3%
Taylor expanded in z around 0 93.1%
+-commutative93.1%
Simplified93.1%
Final simplification94.3%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.6e-6)
(not (or (<= z -9e-260) (and (not (<= z 2.3e-300)) (<= z 0.021)))))
(* t (/ x z))
(* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-6) || !((z <= -9e-260) || (!(z <= 2.3e-300) && (z <= 0.021)))) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.6d-6)) .or. (.not. (z <= (-9d-260)) .or. (.not. (z <= 2.3d-300)) .and. (z <= 0.021d0))) then
tmp = t * (x / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-6) || !((z <= -9e-260) || (!(z <= 2.3e-300) && (z <= 0.021)))) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-6) or not ((z <= -9e-260) or (not (z <= 2.3e-300) and (z <= 0.021))): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-6) || !((z <= -9e-260) || (!(z <= 2.3e-300) && (z <= 0.021)))) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e-6) || ~(((z <= -9e-260) || (~((z <= 2.3e-300)) && (z <= 0.021))))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-6], N[Not[Or[LessEqual[z, -9e-260], And[N[Not[LessEqual[z, 2.3e-300]], $MachinePrecision], LessEqual[z, 0.021]]]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-6} \lor \neg \left(z \leq -9 \cdot 10^{-260} \lor \neg \left(z \leq 2.3 \cdot 10^{-300}\right) \land z \leq 0.021\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1.5999999999999999e-6 or -8.9999999999999995e-260 < z < 2.30000000000000001e-300 or 0.0210000000000000013 < z Initial program 96.6%
Taylor expanded in y around 0 40.1%
associate-*r/40.1%
mul-1-neg40.1%
*-commutative40.1%
distribute-rgt-neg-in40.1%
associate-*r/41.5%
neg-mul-141.5%
*-commutative41.5%
associate-*r/41.5%
metadata-eval41.5%
associate-/r*41.5%
neg-mul-141.5%
associate-*r/41.5%
*-rgt-identity41.5%
neg-sub041.5%
associate--r-41.5%
metadata-eval41.5%
Simplified41.5%
Taylor expanded in z around inf 42.3%
associate-*r/45.1%
Simplified45.1%
if -1.5999999999999999e-6 < z < -8.9999999999999995e-260 or 2.30000000000000001e-300 < z < 0.0210000000000000013Initial program 92.0%
Taylor expanded in y around 0 37.5%
associate-*r/37.5%
mul-1-neg37.5%
*-commutative37.5%
distribute-rgt-neg-in37.5%
associate-*r/37.5%
neg-mul-137.5%
*-commutative37.5%
associate-*r/37.5%
metadata-eval37.5%
associate-/r*37.5%
neg-mul-137.5%
associate-*r/37.5%
*-rgt-identity37.5%
neg-sub037.5%
associate--r-37.5%
metadata-eval37.5%
Simplified37.5%
Taylor expanded in z around 0 36.6%
associate-*r*36.6%
*-commutative36.6%
neg-mul-136.6%
Simplified36.6%
Final simplification41.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.1e+15) (not (<= z 1.15))) (* (+ y t) (/ x z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.1e+15) || !(z <= 1.15)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.1d+15)) .or. (.not. (z <= 1.15d0))) then
tmp = (y + t) * (x / z)
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.1e+15) || !(z <= 1.15)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.1e+15) or not (z <= 1.15): tmp = (y + t) * (x / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.1e+15) || !(z <= 1.15)) tmp = Float64(Float64(y + t) * Float64(x / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.1e+15) || ~((z <= 1.15))) tmp = (y + t) * (x / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.1e+15], N[Not[LessEqual[z, 1.15]], $MachinePrecision]], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+15} \lor \neg \left(z \leq 1.15\right):\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -7.1e15 or 1.1499999999999999 < z Initial program 95.9%
Taylor expanded in z around inf 87.6%
associate-/l*95.4%
associate-/r/88.8%
cancel-sign-sub-inv88.8%
metadata-eval88.8%
*-lft-identity88.8%
+-commutative88.8%
Simplified88.8%
if -7.1e15 < z < 1.1499999999999999Initial program 93.5%
Taylor expanded in z around 0 92.7%
+-commutative92.7%
associate-*r/91.2%
*-commutative91.2%
associate-*r*91.2%
neg-mul-191.2%
distribute-rgt-out92.7%
unsub-neg92.7%
Simplified92.7%
Final simplification90.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.1e+15) (not (<= z 0.021))) (/ x (/ z (+ y t))) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.1e+15) || !(z <= 0.021)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.1d+15)) .or. (.not. (z <= 0.021d0))) then
tmp = x / (z / (y + t))
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.1e+15) || !(z <= 0.021)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.1e+15) or not (z <= 0.021): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.1e+15) || !(z <= 0.021)) tmp = Float64(x / Float64(z / Float64(y + t))); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.1e+15) || ~((z <= 0.021))) tmp = x / (z / (y + t)); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.1e+15], N[Not[LessEqual[z, 0.021]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.1 \cdot 10^{+15} \lor \neg \left(z \leq 0.021\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -7.1e15 or 0.0210000000000000013 < z Initial program 96.0%
Taylor expanded in z around inf 87.8%
associate-/l*95.4%
cancel-sign-sub-inv95.4%
metadata-eval95.4%
*-lft-identity95.4%
+-commutative95.4%
Simplified95.4%
if -7.1e15 < z < 0.0210000000000000013Initial program 93.4%
Taylor expanded in z around 0 92.6%
+-commutative92.6%
associate-*r/91.1%
*-commutative91.1%
associate-*r*91.1%
neg-mul-191.1%
distribute-rgt-out92.6%
unsub-neg92.6%
Simplified92.6%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (* x (- (/ y z) (/ t (- 1.0 z)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * ((y / z) - (t / (1.0d0 - z)))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) - (t / (1.0 - z)));
}
def code(x, y, z, t): return x * ((y / z) - (t / (1.0 - z)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) - (t / (1.0 - z))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)
\end{array}
Initial program 94.6%
Final simplification94.6%
(FPCore (x y z t) :precision binary64 (if (<= t -8e+161) (* t (/ x z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e+161) {
tmp = t * (x / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-8d+161)) then
tmp = t * (x / z)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -8e+161) {
tmp = t * (x / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -8e+161: tmp = t * (x / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -8e+161) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -8e+161) tmp = t * (x / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -8e+161], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+161}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -8.0000000000000003e161Initial program 87.0%
Taylor expanded in y around 0 57.7%
associate-*r/57.7%
mul-1-neg57.7%
*-commutative57.7%
distribute-rgt-neg-in57.7%
associate-*r/67.2%
neg-mul-167.2%
*-commutative67.2%
associate-*r/67.1%
metadata-eval67.1%
associate-/r*67.1%
neg-mul-167.1%
associate-*r/67.2%
*-rgt-identity67.2%
neg-sub067.2%
associate--r-67.2%
metadata-eval67.2%
Simplified67.2%
Taylor expanded in z around inf 47.2%
associate-*r/50.1%
Simplified50.1%
if -8.0000000000000003e161 < t Initial program 95.6%
Taylor expanded in y around inf 67.2%
associate-*r/71.3%
Simplified71.3%
Final simplification68.9%
(FPCore (x y z t) :precision binary64 (if (<= t -2.75e+48) (/ x (/ z t)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.75e+48) {
tmp = x / (z / t);
} else {
tmp = x * (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2.75d+48)) then
tmp = x / (z / t)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.75e+48) {
tmp = x / (z / t);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.75e+48: tmp = x / (z / t) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.75e+48) tmp = Float64(x / Float64(z / t)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.75e+48) tmp = x / (z / t); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.75e+48], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.75 \cdot 10^{+48}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -2.7500000000000001e48Initial program 92.0%
Taylor expanded in y around 0 58.4%
associate-*r/58.4%
mul-1-neg58.4%
*-commutative58.4%
distribute-rgt-neg-in58.4%
associate-*r/64.1%
neg-mul-164.1%
*-commutative64.1%
associate-*r/64.1%
metadata-eval64.1%
associate-/r*64.1%
neg-mul-164.1%
associate-*r/64.1%
*-rgt-identity64.1%
neg-sub064.1%
associate--r-64.1%
metadata-eval64.1%
Simplified64.1%
Taylor expanded in z around inf 46.2%
*-commutative46.2%
associate-/l*52.0%
Simplified52.0%
if -2.7500000000000001e48 < t Initial program 95.2%
Taylor expanded in y around inf 69.7%
associate-*r/73.7%
Simplified73.7%
Final simplification69.7%
(FPCore (x y z t) :precision binary64 (* t (- x)))
double code(double x, double y, double z, double t) {
return t * -x;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = t * -x
end function
public static double code(double x, double y, double z, double t) {
return t * -x;
}
def code(x, y, z, t): return t * -x
function code(x, y, z, t) return Float64(t * Float64(-x)) end
function tmp = code(x, y, z, t) tmp = t * -x; end
code[x_, y_, z_, t_] := N[(t * (-x)), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 94.6%
Taylor expanded in y around 0 39.0%
associate-*r/39.0%
mul-1-neg39.0%
*-commutative39.0%
distribute-rgt-neg-in39.0%
associate-*r/39.8%
neg-mul-139.8%
*-commutative39.8%
associate-*r/39.8%
metadata-eval39.8%
associate-/r*39.8%
neg-mul-139.8%
associate-*r/39.8%
*-rgt-identity39.8%
neg-sub039.8%
associate--r-39.8%
metadata-eval39.8%
Simplified39.8%
Taylor expanded in z around 0 22.7%
associate-*r*22.7%
*-commutative22.7%
neg-mul-122.7%
Simplified22.7%
Final simplification22.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023314
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))