
(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 9 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 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 95.4%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.0)
(and (not (<= z 1.45e-252)) (or (<= z 1.7e-152) (not (<= z 1.0)))))
(* x (/ t z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || (!(z <= 1.45e-252) && ((z <= 1.7e-152) || !(z <= 1.0)))) {
tmp = x * (t / 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 <= 1.45d-252)) .and. (z <= 1.7d-152) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / 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 <= 1.45e-252) && ((z <= 1.7e-152) || !(z <= 1.0)))) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or (not (z <= 1.45e-252) and ((z <= 1.7e-152) or not (z <= 1.0))): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || (!(z <= 1.45e-252) && ((z <= 1.7e-152) || !(z <= 1.0)))) tmp = Float64(x * Float64(t / 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 <= 1.45e-252)) && ((z <= 1.7e-152) || ~((z <= 1.0))))) tmp = x * (t / 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, 1.45e-252]], $MachinePrecision], Or[LessEqual[z, 1.7e-152], N[Not[LessEqual[z, 1.0]], $MachinePrecision]]]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.45 \cdot 10^{-252}\right) \land \left(z \leq 1.7 \cdot 10^{-152} \lor \neg \left(z \leq 1\right)\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or 1.45e-252 < z < 1.69999999999999992e-152 or 1 < z Initial program 95.8%
Taylor expanded in z around inf 91.7%
cancel-sign-sub-inv91.7%
metadata-eval91.7%
*-lft-identity91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in t around inf 54.5%
if -1 < z < 1.45e-252 or 1.69999999999999992e-152 < z < 1Initial program 94.6%
Taylor expanded in z around 0 88.4%
+-commutative88.4%
associate-*r/91.9%
*-commutative91.9%
associate-*r*91.9%
neg-mul-191.9%
distribute-rgt-out93.0%
unsub-neg93.0%
Simplified93.0%
Taylor expanded in y around 0 38.4%
associate-*r*38.4%
mul-1-neg38.4%
Simplified38.4%
Final simplification49.0%
(FPCore (x y z t)
:precision binary64
(if (<= z -33000000000.0)
(/ (* x t) z)
(if (<= z 11.5)
(* x (- (/ y z) t))
(if (<= z 2e+66)
(* t (/ x z))
(if (<= z 7.6e+161) (/ y (/ z x)) (* x (/ t z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -33000000000.0) {
tmp = (x * t) / z;
} else if (z <= 11.5) {
tmp = x * ((y / z) - t);
} else if (z <= 2e+66) {
tmp = t * (x / z);
} else if (z <= 7.6e+161) {
tmp = y / (z / x);
} 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 (z <= (-33000000000.0d0)) then
tmp = (x * t) / z
else if (z <= 11.5d0) then
tmp = x * ((y / z) - t)
else if (z <= 2d+66) then
tmp = t * (x / z)
else if (z <= 7.6d+161) then
tmp = y / (z / x)
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 (z <= -33000000000.0) {
tmp = (x * t) / z;
} else if (z <= 11.5) {
tmp = x * ((y / z) - t);
} else if (z <= 2e+66) {
tmp = t * (x / z);
} else if (z <= 7.6e+161) {
tmp = y / (z / x);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -33000000000.0: tmp = (x * t) / z elif z <= 11.5: tmp = x * ((y / z) - t) elif z <= 2e+66: tmp = t * (x / z) elif z <= 7.6e+161: tmp = y / (z / x) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -33000000000.0) tmp = Float64(Float64(x * t) / z); elseif (z <= 11.5) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 2e+66) tmp = Float64(t * Float64(x / z)); elseif (z <= 7.6e+161) tmp = Float64(y / Float64(z / x)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -33000000000.0) tmp = (x * t) / z; elseif (z <= 11.5) tmp = x * ((y / z) - t); elseif (z <= 2e+66) tmp = t * (x / z); elseif (z <= 7.6e+161) tmp = y / (z / x); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -33000000000.0], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 11.5], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+66], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+161], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -33000000000:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\mathbf{elif}\;z \leq 11.5:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+66}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+161}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -3.3e10Initial program 98.3%
Taylor expanded in z around inf 97.9%
cancel-sign-sub-inv97.9%
metadata-eval97.9%
*-lft-identity97.9%
+-commutative97.9%
Simplified97.9%
Taylor expanded in t around inf 67.6%
if -3.3e10 < z < 11.5Initial program 94.5%
Taylor expanded in z around 0 86.6%
+-commutative86.6%
associate-*r/89.6%
*-commutative89.6%
associate-*r*89.6%
neg-mul-189.6%
distribute-rgt-out91.3%
unsub-neg91.3%
Simplified91.3%
if 11.5 < z < 1.99999999999999989e66Initial program 99.8%
Taylor expanded in z around inf 93.5%
cancel-sign-sub-inv93.5%
metadata-eval93.5%
*-lft-identity93.5%
+-commutative93.5%
Simplified93.5%
Taylor expanded in t around inf 73.1%
associate-/l*72.9%
Simplified72.9%
clear-num72.8%
associate-/r/73.2%
clear-num73.2%
Applied egg-rr73.2%
if 1.99999999999999989e66 < z < 7.6000000000000005e161Initial program 95.8%
Taylor expanded in y around inf 45.6%
associate-*r/62.9%
Simplified62.9%
associate-*r/45.6%
*-commutative45.6%
associate-/l*63.3%
Applied egg-rr63.3%
if 7.6000000000000005e161 < z Initial program 90.8%
Taylor expanded in z around inf 90.8%
cancel-sign-sub-inv90.8%
metadata-eval90.8%
*-lft-identity90.8%
+-commutative90.8%
Simplified90.8%
Taylor expanded in t around inf 69.9%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.45e+157) (not (<= t 8.8e+86))) (* x (/ t (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.8e+86)) {
tmp = x * (t / (z + -1.0));
} 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) :: tmp
if ((t <= (-2.45d+157)) .or. (.not. (t <= 8.8d+86))) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.8e+86)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.45e+157) or not (t <= 8.8e+86): tmp = x * (t / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.45e+157) || !(t <= 8.8e+86)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.45e+157) || ~((t <= 8.8e+86))) tmp = x * (t / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.45e+157], N[Not[LessEqual[t, 8.8e+86]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+157} \lor \neg \left(t \leq 8.8 \cdot 10^{+86}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.4500000000000001e157 or 8.80000000000000013e86 < t Initial program 96.2%
Taylor expanded in y around 0 76.7%
associate-*r/76.7%
associate-*r*76.7%
neg-mul-176.7%
associate-*l/82.8%
*-commutative82.8%
neg-mul-182.8%
*-commutative82.8%
associate-*r/82.7%
metadata-eval82.7%
associate-/r*82.7%
neg-mul-182.7%
associate-*r/82.8%
*-rgt-identity82.8%
neg-sub082.8%
associate--r-82.8%
metadata-eval82.8%
Simplified82.8%
if -2.4500000000000001e157 < t < 8.80000000000000013e86Initial program 95.0%
Taylor expanded in y around inf 71.7%
associate-*r/77.7%
Simplified77.7%
associate-*r/71.7%
associate-/l*78.1%
Applied egg-rr78.1%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* 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 <= 1.0)) {
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 <= 1.0d0))) 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 <= 1.0)) {
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 <= 1.0): 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 <= 1.0)) 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 <= 1.0))) 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, 1.0]], $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 1\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 1 < z Initial program 96.4%
Taylor expanded in z around inf 94.2%
cancel-sign-sub-inv94.2%
metadata-eval94.2%
*-lft-identity94.2%
+-commutative94.2%
Simplified94.2%
if -1 < z < 1Initial program 94.1%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
associate-*r/91.1%
*-commutative91.1%
associate-*r*91.1%
neg-mul-191.1%
distribute-rgt-out92.9%
unsub-neg92.9%
Simplified92.9%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (<= z -1.0) (* x (/ (+ y t) z)) (if (<= z 1.0) (* x (- (/ y z) t)) (/ x (/ z (+ y t))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.0) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + 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)) then
tmp = x * ((y + t) / z)
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = x / (z / (y + 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) {
tmp = x * ((y + t) / z);
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x / (z / (y + t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.0: tmp = x * ((y + t) / z) elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = x / (z / (y + t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.0) tmp = Float64(x * Float64(Float64(y + t) / z)); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x / Float64(z / Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.0) tmp = x * ((y + t) / z); elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = x / (z / (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.0], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\end{array}
\end{array}
if z < -1Initial program 98.5%
Taylor expanded in z around inf 95.3%
cancel-sign-sub-inv95.3%
metadata-eval95.3%
*-lft-identity95.3%
+-commutative95.3%
Simplified95.3%
if -1 < z < 1Initial program 94.1%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
associate-*r/91.1%
*-commutative91.1%
associate-*r*91.1%
neg-mul-191.1%
distribute-rgt-out92.9%
unsub-neg92.9%
Simplified92.9%
if 1 < z Initial program 94.4%
Taylor expanded in z around inf 83.0%
associate-/l*93.2%
cancel-sign-sub-inv93.2%
metadata-eval93.2%
*-lft-identity93.2%
+-commutative93.2%
Simplified93.2%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.45e+157) (not (<= t 8.2e+102))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.2e+102)) {
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 <= (-2.45d+157)) .or. (.not. (t <= 8.2d+102))) 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 <= -2.45e+157) || !(t <= 8.2e+102)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.45e+157) or not (t <= 8.2e+102): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.45e+157) || !(t <= 8.2e+102)) 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 <= -2.45e+157) || ~((t <= 8.2e+102))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.45e+157], N[Not[LessEqual[t, 8.2e+102]], $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 -2.45 \cdot 10^{+157} \lor \neg \left(t \leq 8.2 \cdot 10^{+102}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -2.4500000000000001e157 or 8.1999999999999999e102 < t Initial program 96.0%
Taylor expanded in z around inf 77.1%
cancel-sign-sub-inv77.1%
metadata-eval77.1%
*-lft-identity77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in t around inf 73.1%
if -2.4500000000000001e157 < t < 8.1999999999999999e102Initial program 95.1%
Taylor expanded in y around inf 70.7%
associate-*r/76.5%
Simplified76.5%
Final simplification75.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.65e+157) (not (<= t 1.36e+103))) (* x (/ t z)) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+157) || !(t <= 1.36e+103)) {
tmp = x * (t / 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) :: tmp
if ((t <= (-2.65d+157)) .or. (.not. (t <= 1.36d+103))) then
tmp = x * (t / 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 tmp;
if ((t <= -2.65e+157) || !(t <= 1.36e+103)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.65e+157) or not (t <= 1.36e+103): tmp = x * (t / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.65e+157) || !(t <= 1.36e+103)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.65e+157) || ~((t <= 1.36e+103))) tmp = x * (t / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.65e+157], N[Not[LessEqual[t, 1.36e+103]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+157} \lor \neg \left(t \leq 1.36 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.6499999999999999e157 or 1.36e103 < t Initial program 96.0%
Taylor expanded in z around inf 77.1%
cancel-sign-sub-inv77.1%
metadata-eval77.1%
*-lft-identity77.1%
+-commutative77.1%
Simplified77.1%
Taylor expanded in t around inf 73.1%
if -2.6499999999999999e157 < t < 1.36e103Initial program 95.1%
Taylor expanded in y around inf 70.7%
associate-*r/76.5%
Simplified76.5%
associate-*r/70.7%
associate-/l*76.9%
Applied egg-rr76.9%
Final simplification75.8%
(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 95.4%
Taylor expanded in z around 0 56.0%
+-commutative56.0%
associate-*r/58.5%
*-commutative58.5%
associate-*r*58.5%
neg-mul-158.5%
distribute-rgt-out59.3%
unsub-neg59.3%
Simplified59.3%
Taylor expanded in y around 0 20.1%
associate-*r*20.1%
mul-1-neg20.1%
Simplified20.1%
Final simplification20.1%
(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 2024036
(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)))))