
(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 (+ z -1.0)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
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 / (z + (-1.0d0))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
def code(x, y, z, t): return x * ((y / z) + (t / (z + -1.0)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t / (z + -1.0))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)
\end{array}
Initial program 96.8%
Final simplification96.8%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.0)
(and (not (<= z -3.85e-221))
(or (<= z 2.5e-291) (not (<= z 0.0122)))))
(* t (/ x z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || (!(z <= -3.85e-221) && ((z <= 2.5e-291) || !(z <= 0.0122)))) {
tmp = t * (x / z);
} else {
tmp = x * -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 <= (-1.0d0)) .or. (.not. (z <= (-3.85d-221))) .and. (z <= 2.5d-291) .or. (.not. (z <= 0.0122d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || (!(z <= -3.85e-221) && ((z <= 2.5e-291) || !(z <= 0.0122)))) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or (not (z <= -3.85e-221) and ((z <= 2.5e-291) or not (z <= 0.0122))): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || (!(z <= -3.85e-221) && ((z <= 2.5e-291) || !(z <= 0.0122)))) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || (~((z <= -3.85e-221)) && ((z <= 2.5e-291) || ~((z <= 0.0122))))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], And[N[Not[LessEqual[z, -3.85e-221]], $MachinePrecision], Or[LessEqual[z, 2.5e-291], N[Not[LessEqual[z, 0.0122]], $MachinePrecision]]]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq -3.85 \cdot 10^{-221}\right) \land \left(z \leq 2.5 \cdot 10^{-291} \lor \neg \left(z \leq 0.0122\right)\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or -3.84999999999999996e-221 < z < 2.5000000000000002e-291 or 0.0122000000000000008 < z Initial program 97.9%
Taylor expanded in y around 0 49.2%
mul-1-neg49.2%
distribute-neg-frac249.2%
neg-sub049.2%
associate--r-49.2%
metadata-eval49.2%
Simplified49.2%
Taylor expanded in z around inf 46.3%
associate-/l*50.8%
Simplified50.8%
if -1 < z < -3.84999999999999996e-221 or 2.5000000000000002e-291 < z < 0.0122000000000000008Initial program 95.4%
Taylor expanded in y around 0 40.9%
mul-1-neg40.9%
distribute-neg-frac240.9%
neg-sub040.9%
associate--r-40.9%
metadata-eval40.9%
Simplified40.9%
Taylor expanded in z around 0 38.3%
*-commutative38.3%
neg-mul-138.3%
distribute-rgt-neg-in38.3%
Simplified38.3%
Final simplification45.7%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x z))) (t_2 (* x (- t))))
(if (<= z -1.0)
t_1
(if (<= z -1.25e-220)
t_2
(if (<= z 2.7e-291) t_1 (if (<= z 0.0122) t_2 (* x (/ t z))))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -1.25e-220) {
tmp = t_2;
} else if (z <= 2.7e-291) {
tmp = t_1;
} else if (z <= 0.0122) {
tmp = t_2;
} else {
tmp = x * (t / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t * (x / z)
t_2 = x * -t
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= (-1.25d-220)) then
tmp = t_2
else if (z <= 2.7d-291) then
tmp = t_1
else if (z <= 0.0122d0) then
tmp = t_2
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / z);
double t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -1.25e-220) {
tmp = t_2;
} else if (z <= 2.7e-291) {
tmp = t_1;
} else if (z <= 0.0122) {
tmp = t_2;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / z) t_2 = x * -t tmp = 0 if z <= -1.0: tmp = t_1 elif z <= -1.25e-220: tmp = t_2 elif z <= 2.7e-291: tmp = t_1 elif z <= 0.0122: tmp = t_2 else: tmp = x * (t / z) return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / z)) t_2 = Float64(x * Float64(-t)) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= -1.25e-220) tmp = t_2; elseif (z <= 2.7e-291) tmp = t_1; elseif (z <= 0.0122) tmp = t_2; else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / z); t_2 = x * -t; tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= -1.25e-220) tmp = t_2; elseif (z <= 2.7e-291) tmp = t_1; elseif (z <= 0.0122) tmp = t_2; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, -1.25e-220], t$95$2, If[LessEqual[z, 2.7e-291], t$95$1, If[LessEqual[z, 0.0122], t$95$2, N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z}\\
t_2 := x \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.25 \cdot 10^{-220}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-291}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 0.0122:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -1 or -1.25e-220 < z < 2.69999999999999992e-291Initial program 96.7%
Taylor expanded in y around 0 45.2%
mul-1-neg45.2%
distribute-neg-frac245.2%
neg-sub045.2%
associate--r-45.2%
metadata-eval45.2%
Simplified45.2%
Taylor expanded in z around inf 46.2%
associate-/l*52.0%
Simplified52.0%
if -1 < z < -1.25e-220 or 2.69999999999999992e-291 < z < 0.0122000000000000008Initial program 95.4%
Taylor expanded in y around 0 40.9%
mul-1-neg40.9%
distribute-neg-frac240.9%
neg-sub040.9%
associate--r-40.9%
metadata-eval40.9%
Simplified40.9%
Taylor expanded in z around 0 38.3%
*-commutative38.3%
neg-mul-138.3%
distribute-rgt-neg-in38.3%
Simplified38.3%
if 0.0122000000000000008 < z Initial program 99.6%
Taylor expanded in y around 0 54.8%
mul-1-neg54.8%
distribute-neg-frac254.8%
neg-sub054.8%
associate--r-54.8%
metadata-eval54.8%
Simplified54.8%
Taylor expanded in z around inf 46.4%
*-commutative46.4%
*-lft-identity46.4%
times-frac53.7%
/-rgt-identity53.7%
Simplified53.7%
Final simplification46.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))))
(if (<= z -5.5e+163)
t_1
(if (<= z -3.6e+51)
(* x (/ t z))
(if (<= z 0.0122) (* x (- (/ y z) t)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (z <= -5.5e+163) {
tmp = t_1;
} else if (z <= -3.6e+51) {
tmp = x * (t / z);
} else if (z <= 0.0122) {
tmp = x * ((y / z) - t);
} 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) :: tmp
t_1 = x * (y / z)
if (z <= (-5.5d+163)) then
tmp = t_1
else if (z <= (-3.6d+51)) then
tmp = x * (t / z)
else if (z <= 0.0122d0) then
tmp = x * ((y / z) - t)
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);
double tmp;
if (z <= -5.5e+163) {
tmp = t_1;
} else if (z <= -3.6e+51) {
tmp = x * (t / z);
} else if (z <= 0.0122) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) tmp = 0 if z <= -5.5e+163: tmp = t_1 elif z <= -3.6e+51: tmp = x * (t / z) elif z <= 0.0122: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (z <= -5.5e+163) tmp = t_1; elseif (z <= -3.6e+51) tmp = Float64(x * Float64(t / z)); elseif (z <= 0.0122) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / z); tmp = 0.0; if (z <= -5.5e+163) tmp = t_1; elseif (z <= -3.6e+51) tmp = x * (t / z); elseif (z <= 0.0122) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.5e+163], t$95$1, If[LessEqual[z, -3.6e+51], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0122], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+163}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3.6 \cdot 10^{+51}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 0.0122:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -5.50000000000000014e163 or 0.0122000000000000008 < z Initial program 97.7%
Taylor expanded in y around inf 61.8%
associate-*r/68.6%
Simplified68.6%
if -5.50000000000000014e163 < z < -3.60000000000000011e51Initial program 99.9%
Taylor expanded in y around 0 73.4%
mul-1-neg73.4%
distribute-neg-frac273.4%
neg-sub073.4%
associate--r-73.4%
metadata-eval73.4%
Simplified73.4%
Taylor expanded in z around inf 65.1%
*-commutative65.1%
*-lft-identity65.1%
times-frac73.4%
/-rgt-identity73.4%
Simplified73.4%
if -3.60000000000000011e51 < z < 0.0122000000000000008Initial program 95.8%
Taylor expanded in z around 0 91.9%
mul-1-neg91.9%
unsub-neg91.9%
div-sub91.9%
associate-/l*91.9%
*-inverses91.9%
*-rgt-identity91.9%
Simplified91.9%
Final simplification81.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9e+92) (not (<= t 2.7e+71))) (* t (/ x (+ z -1.0))) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9e+92) || !(t <= 2.7e+71)) {
tmp = t * (x / (z + -1.0));
} 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 <= (-9d+92)) .or. (.not. (t <= 2.7d+71))) then
tmp = t * (x / (z + (-1.0d0)))
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 <= -9e+92) || !(t <= 2.7e+71)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9e+92) or not (t <= 2.7e+71): tmp = t * (x / (z + -1.0)) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9e+92) || !(t <= 2.7e+71)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9e+92) || ~((t <= 2.7e+71))) tmp = t * (x / (z + -1.0)); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9e+92], N[Not[LessEqual[t, 2.7e+71]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+92} \lor \neg \left(t \leq 2.7 \cdot 10^{+71}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -8.9999999999999998e92 or 2.69999999999999997e71 < t Initial program 96.1%
Taylor expanded in y around 0 69.1%
mul-1-neg69.1%
associate-/l*73.0%
distribute-rgt-neg-in73.0%
distribute-neg-frac273.0%
neg-sub073.0%
associate--r-73.0%
metadata-eval73.0%
Simplified73.0%
if -8.9999999999999998e92 < t < 2.69999999999999997e71Initial program 97.2%
Taylor expanded in y around inf 74.5%
associate-*r/79.3%
Simplified79.3%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.0122))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 0.0122)) {
tmp = x * ((y + t) / 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 <= (-1.0d0)) .or. (.not. (z <= 0.0122d0))) then
tmp = x * ((y + t) / 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 <= -1.0) || !(z <= 0.0122)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 0.0122): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.0122)) tmp = Float64(x * Float64(Float64(y + t) / 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 <= -1.0) || ~((z <= 0.0122))) tmp = x * ((y + t) / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 0.0122]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 0.0122\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 0.0122000000000000008 < z Initial program 98.2%
Taylor expanded in z around inf 86.1%
*-commutative86.1%
remove-double-neg86.1%
cancel-sign-sub-inv86.1%
metadata-eval86.1%
*-lft-identity86.1%
distribute-neg-out86.1%
neg-mul-186.1%
sub-neg86.1%
distribute-lft-neg-in86.1%
*-commutative86.1%
distribute-neg-frac86.1%
associate-/l*97.2%
distribute-rgt-neg-in97.2%
distribute-neg-frac97.2%
Simplified97.2%
if -1 < z < 0.0122000000000000008Initial program 95.5%
Taylor expanded in z around 0 93.4%
mul-1-neg93.4%
unsub-neg93.4%
div-sub93.4%
associate-/l*93.4%
*-inverses93.4%
*-rgt-identity93.4%
Simplified93.4%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (+ (/ y z) (/ t z))) (if (<= z 0.0122) (* x (- (/ y z) t)) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y / z) + (t / z));
} else if (z <= 0.0122) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / 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 <= (-1.0d0)) then
tmp = x * ((y / z) + (t / z))
else if (z <= 0.0122d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y + t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y / z) + (t / z));
} else if (z <= 0.0122) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y / z) + (t / z)) elif z <= 0.0122: tmp = x * ((y / z) - t) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(Float64(y / z) + Float64(t / z))); elseif (z <= 0.0122) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y + t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * ((y / z) + (t / z)); elseif (z <= 0.0122) tmp = x * ((y / z) - t); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0122], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} + \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 0.0122:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -1Initial program 96.9%
Taylor expanded in z around inf 96.0%
associate-*r/96.0%
neg-mul-196.0%
Simplified96.0%
sub-neg96.0%
distribute-frac-neg96.0%
remove-double-neg96.0%
Applied egg-rr96.0%
if -1 < z < 0.0122000000000000008Initial program 95.5%
Taylor expanded in z around 0 93.4%
mul-1-neg93.4%
unsub-neg93.4%
div-sub93.4%
associate-/l*93.4%
*-inverses93.4%
*-rgt-identity93.4%
Simplified93.4%
if 0.0122000000000000008 < z Initial program 99.6%
Taylor expanded in z around inf 86.8%
*-commutative86.8%
remove-double-neg86.8%
cancel-sign-sub-inv86.8%
metadata-eval86.8%
*-lft-identity86.8%
distribute-neg-out86.8%
neg-mul-186.8%
sub-neg86.8%
distribute-lft-neg-in86.8%
*-commutative86.8%
distribute-neg-frac86.8%
associate-/l*98.4%
distribute-rgt-neg-in98.4%
distribute-neg-frac98.4%
Simplified98.4%
Final simplification95.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.65e+96) (not (<= t 2.4e+159))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.65e+96) || !(t <= 2.4e+159)) {
tmp = x * (t / 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 <= (-1.65d+96)) .or. (.not. (t <= 2.4d+159))) then
tmp = x * (t / 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 <= -1.65e+96) || !(t <= 2.4e+159)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.65e+96) or not (t <= 2.4e+159): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.65e+96) || !(t <= 2.4e+159)) tmp = Float64(x * Float64(t / 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 <= -1.65e+96) || ~((t <= 2.4e+159))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.65e+96], N[Not[LessEqual[t, 2.4e+159]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.65 \cdot 10^{+96} \lor \neg \left(t \leq 2.4 \cdot 10^{+159}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -1.64999999999999992e96 or 2.4e159 < t Initial program 96.9%
Taylor expanded in y around 0 83.1%
mul-1-neg83.1%
distribute-neg-frac283.1%
neg-sub083.1%
associate--r-83.1%
metadata-eval83.1%
Simplified83.1%
Taylor expanded in z around inf 48.9%
*-commutative48.9%
*-lft-identity48.9%
times-frac58.7%
/-rgt-identity58.7%
Simplified58.7%
if -1.64999999999999992e96 < t < 2.4e159Initial program 96.8%
Taylor expanded in y around inf 73.7%
associate-*r/77.7%
Simplified77.7%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (<= t -4e+92) (/ x (/ z t)) (if (<= t 3.25e+156) (* x (/ y z)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4e+92) {
tmp = x / (z / t);
} else if (t <= 3.25e+156) {
tmp = x * (y / z);
} else {
tmp = x * (t / 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 <= (-4d+92)) then
tmp = x / (z / t)
else if (t <= 3.25d+156) then
tmp = x * (y / z)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4e+92) {
tmp = x / (z / t);
} else if (t <= 3.25e+156) {
tmp = x * (y / z);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4e+92: tmp = x / (z / t) elif t <= 3.25e+156: tmp = x * (y / z) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4e+92) tmp = Float64(x / Float64(z / t)); elseif (t <= 3.25e+156) tmp = Float64(x * Float64(y / z)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4e+92) tmp = x / (z / t); elseif (t <= 3.25e+156) tmp = x * (y / z); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4e+92], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.25e+156], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+92}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 3.25 \cdot 10^{+156}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -4.0000000000000002e92Initial program 97.6%
Taylor expanded in y around 0 81.1%
mul-1-neg81.1%
distribute-neg-frac281.1%
neg-sub081.1%
associate--r-81.1%
metadata-eval81.1%
Simplified81.1%
Taylor expanded in z around inf 46.1%
*-commutative46.1%
*-lft-identity46.1%
times-frac54.8%
/-rgt-identity54.8%
Simplified54.8%
associate-*r/46.1%
clear-num46.0%
Applied egg-rr46.0%
associate-/r/46.1%
associate-*r*47.1%
associate-*l/47.1%
*-lft-identity47.1%
associate-/r/54.9%
Simplified54.9%
if -4.0000000000000002e92 < t < 3.25000000000000014e156Initial program 96.8%
Taylor expanded in y around inf 73.7%
associate-*r/77.7%
Simplified77.7%
if 3.25000000000000014e156 < t Initial program 95.6%
Taylor expanded in y around 0 86.8%
mul-1-neg86.8%
distribute-neg-frac286.8%
neg-sub086.8%
associate--r-86.8%
metadata-eval86.8%
Simplified86.8%
Taylor expanded in z around inf 54.0%
*-commutative54.0%
*-lft-identity54.0%
times-frac65.8%
/-rgt-identity65.8%
Simplified65.8%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -t;
}
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 * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 96.8%
Taylor expanded in y around 0 45.8%
mul-1-neg45.8%
distribute-neg-frac245.8%
neg-sub045.8%
associate--r-45.8%
metadata-eval45.8%
Simplified45.8%
Taylor expanded in z around 0 22.5%
*-commutative22.5%
neg-mul-122.5%
distribute-rgt-neg-in22.5%
Simplified22.5%
Final simplification22.5%
(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 2024112
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(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)))))