
(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 (if (<= y -6e+140) (/ (* y x) z) (* x (- (/ y z) (/ t (- 1.0 z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -6e+140) {
tmp = (y * x) / z;
} 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 (y <= (-6d+140)) then
tmp = (y * x) / z
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 (y <= -6e+140) {
tmp = (y * x) / z;
} else {
tmp = x * ((y / z) - (t / (1.0 - z)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -6e+140: tmp = (y * x) / z else: tmp = x * ((y / z) - (t / (1.0 - z))) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -6e+140) tmp = Float64(Float64(y * x) / z); 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 (y <= -6e+140) tmp = (y * x) / z; else tmp = x * ((y / z) - (t / (1.0 - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -6e+140], N[(N[(y * x), $MachinePrecision] / z), $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}\;y \leq -6 \cdot 10^{+140}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\end{array}
\end{array}
if y < -5.99999999999999993e140Initial program 78.1%
Taylor expanded in y around inf 92.6%
if -5.99999999999999993e140 < y Initial program 95.6%
Final simplification95.1%
(FPCore (x y z t)
:precision binary64
(if (<= z -14500000000000.0)
(* x (/ t z))
(if (<= z 2.6e+89)
(* x (- (/ y z) t))
(if (<= z 4.4e+134)
(/ t (/ z x))
(if (<= z 1.6e+174) (/ x (/ z y)) (/ (* x t) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -14500000000000.0) {
tmp = x * (t / z);
} else if (z <= 2.6e+89) {
tmp = x * ((y / z) - t);
} else if (z <= 4.4e+134) {
tmp = t / (z / x);
} else if (z <= 1.6e+174) {
tmp = x / (z / y);
} 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 <= (-14500000000000.0d0)) then
tmp = x * (t / z)
else if (z <= 2.6d+89) then
tmp = x * ((y / z) - t)
else if (z <= 4.4d+134) then
tmp = t / (z / x)
else if (z <= 1.6d+174) then
tmp = x / (z / y)
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 <= -14500000000000.0) {
tmp = x * (t / z);
} else if (z <= 2.6e+89) {
tmp = x * ((y / z) - t);
} else if (z <= 4.4e+134) {
tmp = t / (z / x);
} else if (z <= 1.6e+174) {
tmp = x / (z / y);
} else {
tmp = (x * t) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -14500000000000.0: tmp = x * (t / z) elif z <= 2.6e+89: tmp = x * ((y / z) - t) elif z <= 4.4e+134: tmp = t / (z / x) elif z <= 1.6e+174: tmp = x / (z / y) else: tmp = (x * t) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -14500000000000.0) tmp = Float64(x * Float64(t / z)); elseif (z <= 2.6e+89) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 4.4e+134) tmp = Float64(t / Float64(z / x)); elseif (z <= 1.6e+174) tmp = Float64(x / Float64(z / y)); else tmp = Float64(Float64(x * t) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -14500000000000.0) tmp = x * (t / z); elseif (z <= 2.6e+89) tmp = x * ((y / z) - t); elseif (z <= 4.4e+134) tmp = t / (z / x); elseif (z <= 1.6e+174) tmp = x / (z / y); else tmp = (x * t) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -14500000000000.0], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.6e+89], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.4e+134], N[(t / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.6e+174], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(N[(x * t), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -14500000000000:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 2.6 \cdot 10^{+89}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 4.4 \cdot 10^{+134}:\\
\;\;\;\;\frac{t}{\frac{z}{x}}\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+174}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot t}{z}\\
\end{array}
\end{array}
if z < -1.45e13Initial program 97.5%
Taylor expanded in z around inf 88.4%
Taylor expanded in y around 0 60.5%
associate-*l/67.5%
Simplified67.5%
if -1.45e13 < z < 2.6000000000000001e89Initial program 91.6%
Taylor expanded in z around 0 88.9%
associate-*l/83.5%
associate-*r*83.5%
neg-mul-183.5%
distribute-rgt-out86.2%
unsub-neg86.2%
Simplified86.2%
if 2.6000000000000001e89 < z < 4.4e134Initial program 99.6%
Taylor expanded in z around inf 94.2%
Taylor expanded in y around 0 68.0%
*-commutative68.0%
associate-/l*73.0%
Simplified73.0%
associate-/r/73.0%
Applied egg-rr73.0%
associate-*l/68.0%
*-commutative68.0%
associate-/l*73.3%
Applied egg-rr73.3%
if 4.4e134 < z < 1.6e174Initial program 99.7%
Taylor expanded in y around inf 82.5%
associate-*l/91.0%
Simplified91.0%
*-commutative91.0%
clear-num90.8%
un-div-inv91.1%
Applied egg-rr91.1%
if 1.6e174 < z Initial program 84.6%
Taylor expanded in z around inf 96.5%
Taylor expanded in y around 0 80.1%
Final simplification81.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (+ z -1.0)))))
(if (<= t -2.8e+67)
t_1
(if (<= t -2e-271) (/ y (/ z x)) (if (<= t 9.5e-22) (/ (* y x) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -2.8e+67) {
tmp = t_1;
} else if (t <= -2e-271) {
tmp = y / (z / x);
} else if (t <= 9.5e-22) {
tmp = (y * x) / 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) :: tmp
t_1 = x * (t / (z + (-1.0d0)))
if (t <= (-2.8d+67)) then
tmp = t_1
else if (t <= (-2d-271)) then
tmp = y / (z / x)
else if (t <= 9.5d-22) then
tmp = (y * x) / 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 * (t / (z + -1.0));
double tmp;
if (t <= -2.8e+67) {
tmp = t_1;
} else if (t <= -2e-271) {
tmp = y / (z / x);
} else if (t <= 9.5e-22) {
tmp = (y * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -2.8e+67: tmp = t_1 elif t <= -2e-271: tmp = y / (z / x) elif t <= 9.5e-22: tmp = (y * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -2.8e+67) tmp = t_1; elseif (t <= -2e-271) tmp = Float64(y / Float64(z / x)); elseif (t <= 9.5e-22) tmp = Float64(Float64(y * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z + -1.0)); tmp = 0.0; if (t <= -2.8e+67) tmp = t_1; elseif (t <= -2e-271) tmp = y / (z / x); elseif (t <= 9.5e-22) tmp = (y * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.8e+67], t$95$1, If[LessEqual[t, -2e-271], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e-22], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -2.8 \cdot 10^{+67}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -2 \cdot 10^{-271}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{-22}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -2.7999999999999998e67 or 9.4999999999999994e-22 < t Initial program 93.6%
Taylor expanded in y around 0 72.4%
associate-*r/72.4%
associate-*r*72.4%
neg-mul-172.4%
associate-*l/75.9%
*-commutative75.9%
neg-mul-175.9%
*-commutative75.9%
associate-*r/75.8%
metadata-eval75.8%
associate-/r*75.8%
neg-mul-175.8%
associate-*r/75.9%
*-rgt-identity75.9%
neg-sub075.9%
associate--r-75.9%
metadata-eval75.9%
Simplified75.9%
if -2.7999999999999998e67 < t < -1.99999999999999993e-271Initial program 93.9%
Taylor expanded in y around inf 79.0%
associate-*l/82.1%
Simplified82.1%
associate-*l/79.0%
associate-/l*85.4%
Applied egg-rr85.4%
if -1.99999999999999993e-271 < t < 9.4999999999999994e-22Initial program 90.2%
Taylor expanded in y around inf 90.4%
Final simplification82.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -7.5e+188)
t_1
(if (<= t -1.8e-270)
(/ y (/ z x))
(if (<= t 1.9e+17) (/ (* y x) z) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -7.5e+188) {
tmp = t_1;
} else if (t <= -1.8e-270) {
tmp = y / (z / x);
} else if (t <= 1.9e+17) {
tmp = (y * x) / 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) :: tmp
t_1 = x * (t / z)
if (t <= (-7.5d+188)) then
tmp = t_1
else if (t <= (-1.8d-270)) then
tmp = y / (z / x)
else if (t <= 1.9d+17) then
tmp = (y * x) / 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 * (t / z);
double tmp;
if (t <= -7.5e+188) {
tmp = t_1;
} else if (t <= -1.8e-270) {
tmp = y / (z / x);
} else if (t <= 1.9e+17) {
tmp = (y * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -7.5e+188: tmp = t_1 elif t <= -1.8e-270: tmp = y / (z / x) elif t <= 1.9e+17: tmp = (y * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -7.5e+188) tmp = t_1; elseif (t <= -1.8e-270) tmp = Float64(y / Float64(z / x)); elseif (t <= 1.9e+17) tmp = Float64(Float64(y * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -7.5e+188) tmp = t_1; elseif (t <= -1.8e-270) tmp = y / (z / x); elseif (t <= 1.9e+17) tmp = (y * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e+188], t$95$1, If[LessEqual[t, -1.8e-270], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.9e+17], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+188}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-270}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{+17}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -7.4999999999999996e188 or 1.9e17 < t Initial program 94.1%
Taylor expanded in z around inf 63.9%
Taylor expanded in y around 0 54.5%
associate-*l/60.1%
Simplified60.1%
if -7.4999999999999996e188 < t < -1.7999999999999999e-270Initial program 93.7%
Taylor expanded in y around inf 73.5%
associate-*l/74.1%
Simplified74.1%
associate-*l/73.5%
associate-/l*77.4%
Applied egg-rr77.4%
if -1.7999999999999999e-270 < t < 1.9e17Initial program 90.1%
Taylor expanded in y around inf 85.4%
Final simplification73.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e-9) (not (<= z 1.0))) (* (/ x z) (+ y t)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e-9) || !(z <= 1.0)) {
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 <= (-4d-9)) .or. (.not. (z <= 1.0d0))) 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 <= -4e-9) || !(z <= 1.0)) {
tmp = (x / z) * (y + t);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e-9) or not (z <= 1.0): tmp = (x / z) * (y + t) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e-9) || !(z <= 1.0)) tmp = Float64(Float64(x / 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 <= -4e-9) || ~((z <= 1.0))) 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, -4e-9], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(x / z), $MachinePrecision] * N[(y + t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4 \cdot 10^{-9} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{z} \cdot \left(y + t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -4.00000000000000025e-9 or 1 < z Initial program 94.8%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
associate-/l*93.9%
associate-/r/88.0%
cancel-sign-sub-inv88.0%
metadata-eval88.0%
*-lft-identity88.0%
Simplified88.0%
if -4.00000000000000025e-9 < z < 1Initial program 91.1%
Taylor expanded in z around 0 94.0%
associate-*l/87.0%
associate-*r*87.0%
neg-mul-187.0%
distribute-rgt-out90.1%
unsub-neg90.1%
Simplified90.1%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e-9) (not (<= z 1.0))) (/ x (/ z (+ y t))) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e-9) || !(z <= 1.0)) {
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 <= (-4d-9)) .or. (.not. (z <= 1.0d0))) 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 <= -4e-9) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e-9) or not (z <= 1.0): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4e-9) || !(z <= 1.0)) 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 <= -4e-9) || ~((z <= 1.0))) 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, -4e-9], N[Not[LessEqual[z, 1.0]], $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 -4 \cdot 10^{-9} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -4.00000000000000025e-9 or 1 < z Initial program 94.8%
Taylor expanded in z around inf 90.9%
*-commutative90.9%
associate-/l*93.9%
neg-mul-193.9%
Simplified93.9%
if -4.00000000000000025e-9 < z < 1Initial program 91.1%
Taylor expanded in z around 0 94.0%
associate-*l/87.0%
associate-*r*87.0%
neg-mul-187.0%
distribute-rgt-out90.1%
unsub-neg90.1%
Simplified90.1%
Final simplification92.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4e-9) (not (<= z 1.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4e-9) || !(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 <= (-4d-9)) .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 <= -4e-9) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4e-9) 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 <= -4e-9) || !(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 <= -4e-9) || ~((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, -4e-9], 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 -4 \cdot 10^{-9} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.00000000000000025e-9 or 1 < z Initial program 94.8%
Taylor expanded in z around inf 90.9%
Taylor expanded in y around 0 61.4%
associate-*l/63.0%
Simplified63.0%
if -4.00000000000000025e-9 < z < 1Initial program 91.1%
Taylor expanded in z around 0 94.0%
associate-*l/87.0%
associate-*r*87.0%
neg-mul-187.0%
distribute-rgt-out90.1%
unsub-neg90.1%
Simplified90.1%
Taylor expanded in y around 0 36.1%
associate-*r*36.1%
mul-1-neg36.1%
Simplified36.1%
Final simplification49.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e+189) (not (<= t 4.1e+15))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+189) || !(t <= 4.1e+15)) {
tmp = x * (t / z);
} else {
tmp = y * (x / 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 <= (-1d+189)) .or. (.not. (t <= 4.1d+15))) then
tmp = x * (t / z)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e+189) || !(t <= 4.1e+15)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1e+189) or not (t <= 4.1e+15): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e+189) || !(t <= 4.1e+15)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1e+189) || ~((t <= 4.1e+15))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1e+189], N[Not[LessEqual[t, 4.1e+15]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+189} \lor \neg \left(t \leq 4.1 \cdot 10^{+15}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -1e189 or 4.1e15 < t Initial program 94.1%
Taylor expanded in z around inf 63.9%
Taylor expanded in y around 0 54.5%
associate-*l/60.1%
Simplified60.1%
if -1e189 < t < 4.1e15Initial program 92.4%
Taylor expanded in y around inf 77.8%
associate-*l/76.5%
Simplified76.5%
associate-*l/77.8%
associate-/l*77.1%
Applied egg-rr77.1%
clear-num77.1%
associate-/r/77.0%
clear-num77.1%
Applied egg-rr77.1%
Final simplification71.6%
(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 92.9%
Taylor expanded in z around 0 62.4%
associate-*l/59.8%
associate-*r*59.8%
neg-mul-159.8%
distribute-rgt-out61.4%
unsub-neg61.4%
Simplified61.4%
Taylor expanded in y around 0 24.2%
associate-*r*24.2%
mul-1-neg24.2%
Simplified24.2%
Final simplification24.2%
(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 2023229
(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)))))