
(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 12 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
(let* ((t_1 (- (/ y z) (/ t (- 1.0 z)))) (t_2 (* t_1 x)))
(if (<= t_1 -5e-255)
t_2
(if (<= t_1 4e-234)
(/ (+ y t) (/ z x))
(if (<= t_1 5e+295) t_2 (/ y (/ z x)))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -5e-255) {
tmp = t_2;
} else if (t_1 <= 4e-234) {
tmp = (y + t) / (z / x);
} else if (t_1 <= 5e+295) {
tmp = t_2;
} else {
tmp = y / (z / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
t_2 = t_1 * x
if (t_1 <= (-5d-255)) then
tmp = t_2
else if (t_1 <= 4d-234) then
tmp = (y + t) / (z / x)
else if (t_1 <= 5d+295) then
tmp = t_2
else
tmp = y / (z / x)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double t_2 = t_1 * x;
double tmp;
if (t_1 <= -5e-255) {
tmp = t_2;
} else if (t_1 <= 4e-234) {
tmp = (y + t) / (z / x);
} else if (t_1 <= 5e+295) {
tmp = t_2;
} else {
tmp = y / (z / x);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) t_2 = t_1 * x tmp = 0 if t_1 <= -5e-255: tmp = t_2 elif t_1 <= 4e-234: tmp = (y + t) / (z / x) elif t_1 <= 5e+295: tmp = t_2 else: tmp = y / (z / x) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) t_2 = Float64(t_1 * x) tmp = 0.0 if (t_1 <= -5e-255) tmp = t_2; elseif (t_1 <= 4e-234) tmp = Float64(Float64(y + t) / Float64(z / x)); elseif (t_1 <= 5e+295) tmp = t_2; else tmp = Float64(y / Float64(z / x)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); t_2 = t_1 * x; tmp = 0.0; if (t_1 <= -5e-255) tmp = t_2; elseif (t_1 <= 4e-234) tmp = (y + t) / (z / x); elseif (t_1 <= 5e+295) tmp = t_2; else tmp = y / (z / x); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * x), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-255], t$95$2, If[LessEqual[t$95$1, 4e-234], N[(N[(y + t), $MachinePrecision] / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e+295], t$95$2, N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
t_2 := t_1 \cdot x\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-255}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_1 \leq 4 \cdot 10^{-234}:\\
\;\;\;\;\frac{y + t}{\frac{z}{x}}\\
\mathbf{elif}\;t_1 \leq 5 \cdot 10^{+295}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < -4.9999999999999996e-255 or 3.9999999999999998e-234 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 4.99999999999999991e295Initial program 98.0%
if -4.9999999999999996e-255 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) < 3.9999999999999998e-234Initial program 66.4%
Taylor expanded in z around inf 99.5%
associate-/l*63.0%
associate-/r/99.7%
cancel-sign-sub-inv99.7%
metadata-eval99.7%
*-lft-identity99.7%
+-commutative99.7%
Simplified99.7%
*-commutative99.7%
clear-num99.7%
un-div-inv99.8%
+-commutative99.8%
Applied egg-rr99.8%
if 4.99999999999999991e295 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 1 z))) Initial program 62.2%
Taylor expanded in y around inf 99.8%
*-commutative99.8%
associate-/l*100.0%
Simplified100.0%
Final simplification98.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.46e-8) (not (<= z 1.0))) (* (+ y t) (/ x z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.46e-8) || !(z <= 1.0)) {
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 <= (-1.46d-8)) .or. (.not. (z <= 1.0d0))) 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 <= -1.46e-8) || !(z <= 1.0)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.46e-8) or not (z <= 1.0): tmp = (y + t) * (x / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.46e-8) || !(z <= 1.0)) 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 <= -1.46e-8) || ~((z <= 1.0))) 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, -1.46e-8], N[Not[LessEqual[z, 1.0]], $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 -1.46 \cdot 10^{-8} \lor \neg \left(z \leq 1\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 < -1.46e-8 or 1 < z Initial program 94.9%
Taylor expanded in z around inf 81.8%
associate-/l*94.3%
associate-/r/90.6%
cancel-sign-sub-inv90.6%
metadata-eval90.6%
*-lft-identity90.6%
+-commutative90.6%
Simplified90.6%
if -1.46e-8 < z < 1Initial program 91.2%
Taylor expanded in z around 0 88.1%
+-commutative88.1%
associate-*r/83.3%
*-commutative83.3%
associate-*r*83.3%
neg-mul-183.3%
distribute-rgt-out89.4%
unsub-neg89.4%
Simplified89.4%
Final simplification90.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.46e-8) (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 <= -1.46e-8) || !(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 <= (-1.46d-8)) .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 <= -1.46e-8) || !(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 <= -1.46e-8) 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 <= -1.46e-8) || !(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 <= -1.46e-8) || ~((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, -1.46e-8], 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 -1.46 \cdot 10^{-8} \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 < -1.46e-8 or 1 < z Initial program 94.9%
Taylor expanded in z around inf 81.8%
associate-/l*94.3%
cancel-sign-sub-inv94.3%
metadata-eval94.3%
*-lft-identity94.3%
+-commutative94.3%
Simplified94.3%
if -1.46e-8 < z < 1Initial program 91.2%
Taylor expanded in z around 0 88.1%
+-commutative88.1%
associate-*r/83.3%
*-commutative83.3%
associate-*r*83.3%
neg-mul-183.3%
distribute-rgt-out89.4%
unsub-neg89.4%
Simplified89.4%
Final simplification91.8%
(FPCore (x y z t) :precision binary64 (if (<= z -2.05e+46) (* y (/ x z)) (if (<= z 19500.0) (* x (- (/ y z) t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.05e+46) {
tmp = y * (x / z);
} else if (z <= 19500.0) {
tmp = x * ((y / z) - t);
} 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 <= (-2.05d+46)) then
tmp = y * (x / z)
else if (z <= 19500.0d0) then
tmp = x * ((y / z) - t)
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 <= -2.05e+46) {
tmp = y * (x / z);
} else if (z <= 19500.0) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.05e+46: tmp = y * (x / z) elif z <= 19500.0: tmp = x * ((y / z) - t) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.05e+46) tmp = Float64(y * Float64(x / z)); elseif (z <= 19500.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.05e+46) tmp = y * (x / z); elseif (z <= 19500.0) tmp = x * ((y / z) - t); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.05e+46], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 19500.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{+46}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 19500:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -2.05e46Initial program 93.0%
Taylor expanded in y around inf 51.0%
associate-/l*56.6%
associate-/r/59.7%
Simplified59.7%
if -2.05e46 < z < 19500Initial program 91.8%
Taylor expanded in z around 0 87.0%
+-commutative87.0%
associate-*r/82.5%
*-commutative82.5%
associate-*r*82.5%
neg-mul-182.5%
distribute-rgt-out88.2%
unsub-neg88.2%
Simplified88.2%
if 19500 < z Initial program 95.9%
Taylor expanded in z around inf 80.5%
associate-/l*94.8%
associate-/r/91.9%
cancel-sign-sub-inv91.9%
metadata-eval91.9%
*-lft-identity91.9%
+-commutative91.9%
Simplified91.9%
Taylor expanded in t around inf 48.4%
associate-*l/65.3%
Simplified65.3%
Final simplification76.6%
(FPCore (x y z t) :precision binary64 (if (<= y -1.1e-63) (/ y (/ z x)) (if (<= y 2.6e+44) (* x (/ t (+ z -1.0))) (* y (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -1.1e-63) {
tmp = y / (z / x);
} else if (y <= 2.6e+44) {
tmp = x * (t / (z + -1.0));
} 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 (y <= (-1.1d-63)) then
tmp = y / (z / x)
else if (y <= 2.6d+44) then
tmp = x * (t / (z + (-1.0d0)))
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 (y <= -1.1e-63) {
tmp = y / (z / x);
} else if (y <= 2.6e+44) {
tmp = x * (t / (z + -1.0));
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -1.1e-63: tmp = y / (z / x) elif y <= 2.6e+44: tmp = x * (t / (z + -1.0)) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -1.1e-63) tmp = Float64(y / Float64(z / x)); elseif (y <= 2.6e+44) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -1.1e-63) tmp = y / (z / x); elseif (y <= 2.6e+44) tmp = x * (t / (z + -1.0)); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -1.1e-63], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.6e+44], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.1 \cdot 10^{-63}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 2.6 \cdot 10^{+44}:\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if y < -1.1e-63Initial program 90.5%
Taylor expanded in y around inf 77.6%
*-commutative77.6%
associate-/l*79.5%
Simplified79.5%
if -1.1e-63 < y < 2.5999999999999999e44Initial program 95.9%
Taylor expanded in y around 0 70.7%
associate-*r/70.7%
associate-*r*70.7%
neg-mul-170.7%
associate-*l/75.0%
*-commutative75.0%
neg-mul-175.0%
*-commutative75.0%
associate-*r/74.9%
metadata-eval74.9%
associate-/r*74.9%
neg-mul-174.9%
associate-*r/75.0%
*-rgt-identity75.0%
neg-sub075.0%
associate--r-75.0%
metadata-eval75.0%
Simplified75.0%
if 2.5999999999999999e44 < y Initial program 89.6%
Taylor expanded in y around inf 74.0%
associate-/l*70.2%
associate-/r/79.5%
Simplified79.5%
Final simplification77.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -225000000.0) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -225000000.0) || !(z <= 1.0)) {
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 <= (-225000000.0d0)) .or. (.not. (z <= 1.0d0))) 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 <= -225000000.0) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -225000000.0) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -225000000.0) || !(z <= 1.0)) 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 <= -225000000.0) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -225000000.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -225000000 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -2.25e8 or 1 < z Initial program 94.7%
Taylor expanded in z around inf 81.1%
associate-/l*94.2%
associate-/r/90.3%
cancel-sign-sub-inv90.3%
metadata-eval90.3%
*-lft-identity90.3%
+-commutative90.3%
Simplified90.3%
Taylor expanded in t around inf 47.7%
associate-*r/52.2%
Simplified52.2%
if -2.25e8 < z < 1Initial program 91.5%
Taylor expanded in z around 0 87.8%
Taylor expanded in t around inf 39.8%
associate-*r*39.8%
neg-mul-139.8%
Simplified39.8%
Final simplification45.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.55e+157) (not (<= t 4.2e+162))) (* t (/ x z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.55e+157) || !(t <= 4.2e+162)) {
tmp = t * (x / z);
} else {
tmp = (y / z) * 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 ((t <= (-1.55d+157)) .or. (.not. (t <= 4.2d+162))) then
tmp = t * (x / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.55e+157) || !(t <= 4.2e+162)) {
tmp = t * (x / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.55e+157) or not (t <= 4.2e+162): tmp = t * (x / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.55e+157) || !(t <= 4.2e+162)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.55e+157) || ~((t <= 4.2e+162))) tmp = t * (x / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.55e+157], N[Not[LessEqual[t, 4.2e+162]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.55 \cdot 10^{+157} \lor \neg \left(t \leq 4.2 \cdot 10^{+162}\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.5499999999999999e157 or 4.2000000000000001e162 < t Initial program 96.3%
Taylor expanded in z around inf 48.0%
associate-/l*61.9%
associate-/r/53.8%
cancel-sign-sub-inv53.8%
metadata-eval53.8%
*-lft-identity53.8%
+-commutative53.8%
Simplified53.8%
Taylor expanded in t around inf 42.6%
associate-*r/48.0%
Simplified48.0%
if -1.5499999999999999e157 < t < 4.2000000000000001e162Initial program 91.5%
Taylor expanded in y around inf 71.4%
associate-*r/70.8%
Simplified70.8%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.45e+74) (not (<= t 1.9e+161))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e+74) || !(t <= 1.9e+161)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * 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 ((t <= (-1.45d+74)) .or. (.not. (t <= 1.9d+161))) then
tmp = x * (t / z)
else
tmp = (y / z) * x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.45e+74) || !(t <= 1.9e+161)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.45e+74) or not (t <= 1.9e+161): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.45e+74) || !(t <= 1.9e+161)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(Float64(y / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.45e+74) || ~((t <= 1.9e+161))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.45e+74], N[Not[LessEqual[t, 1.9e+161]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.45 \cdot 10^{+74} \lor \neg \left(t \leq 1.9 \cdot 10^{+161}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -1.4500000000000001e74 or 1.9000000000000001e161 < t Initial program 95.0%
Taylor expanded in z around inf 48.1%
associate-/l*58.6%
associate-/r/52.0%
cancel-sign-sub-inv52.0%
metadata-eval52.0%
*-lft-identity52.0%
+-commutative52.0%
Simplified52.0%
Taylor expanded in t around inf 40.6%
associate-*l/52.7%
Simplified52.7%
if -1.4500000000000001e74 < t < 1.9000000000000001e161Initial program 91.8%
Taylor expanded in y around inf 74.9%
associate-*r/75.4%
Simplified75.4%
Final simplification66.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.2e+101) (not (<= t 2.7e+131))) (* x (/ t z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.2e+101) || !(t <= 2.7e+131)) {
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 <= (-9.2d+101)) .or. (.not. (t <= 2.7d+131))) 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 <= -9.2e+101) || !(t <= 2.7e+131)) {
tmp = x * (t / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.2e+101) or not (t <= 2.7e+131): tmp = x * (t / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.2e+101) || !(t <= 2.7e+131)) 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 <= -9.2e+101) || ~((t <= 2.7e+131))) tmp = x * (t / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.2e+101], N[Not[LessEqual[t, 2.7e+131]], $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 -9.2 \cdot 10^{+101} \lor \neg \left(t \leq 2.7 \cdot 10^{+131}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -9.2000000000000005e101 or 2.70000000000000004e131 < t Initial program 96.9%
Taylor expanded in z around inf 50.0%
associate-/l*62.7%
associate-/r/53.8%
cancel-sign-sub-inv53.8%
metadata-eval53.8%
*-lft-identity53.8%
+-commutative53.8%
Simplified53.8%
Taylor expanded in t around inf 42.4%
associate-*l/54.7%
Simplified54.7%
if -9.2000000000000005e101 < t < 2.70000000000000004e131Initial program 90.7%
Taylor expanded in y around inf 73.9%
associate-/l*72.9%
associate-/r/78.2%
Simplified78.2%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (<= t -1.66e+102) (* x (/ t z)) (if (<= t 7e+133) (* y (/ x z)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.66e+102) {
tmp = x * (t / z);
} else if (t <= 7e+133) {
tmp = y * (x / z);
} else {
tmp = x / (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 (t <= (-1.66d+102)) then
tmp = x * (t / z)
else if (t <= 7d+133) then
tmp = y * (x / z)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.66e+102) {
tmp = x * (t / z);
} else if (t <= 7e+133) {
tmp = y * (x / z);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.66e+102: tmp = x * (t / z) elif t <= 7e+133: tmp = y * (x / z) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.66e+102) tmp = Float64(x * Float64(t / z)); elseif (t <= 7e+133) tmp = Float64(y * Float64(x / z)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.66e+102) tmp = x * (t / z); elseif (t <= 7e+133) tmp = y * (x / z); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.66e+102], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+133], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.66 \cdot 10^{+102}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+133}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -1.66e102Initial program 94.1%
Taylor expanded in z around inf 53.4%
associate-/l*61.1%
associate-/r/47.5%
cancel-sign-sub-inv47.5%
metadata-eval47.5%
*-lft-identity47.5%
+-commutative47.5%
Simplified47.5%
Taylor expanded in t around inf 45.7%
associate-*l/54.7%
Simplified54.7%
if -1.66e102 < t < 6.9999999999999997e133Initial program 90.7%
Taylor expanded in y around inf 73.9%
associate-/l*72.9%
associate-/r/78.2%
Simplified78.2%
if 6.9999999999999997e133 < t Initial program 99.8%
Taylor expanded in z around inf 46.6%
associate-/l*64.4%
associate-/r/60.2%
cancel-sign-sub-inv60.2%
metadata-eval60.2%
*-lft-identity60.2%
+-commutative60.2%
Simplified60.2%
associate-*l/46.6%
associate-/l*64.4%
+-commutative64.4%
Applied egg-rr64.4%
Taylor expanded in y around 0 54.8%
Final simplification69.5%
(FPCore (x y z t) :precision binary64 (if (<= t -7.3e+102) (* x (/ t z)) (if (<= t 8.8e+130) (/ y (/ z x)) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.3e+102) {
tmp = x * (t / z);
} else if (t <= 8.8e+130) {
tmp = y / (z / x);
} else {
tmp = x / (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 (t <= (-7.3d+102)) then
tmp = x * (t / z)
else if (t <= 8.8d+130) then
tmp = y / (z / x)
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -7.3e+102) {
tmp = x * (t / z);
} else if (t <= 8.8e+130) {
tmp = y / (z / x);
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -7.3e+102: tmp = x * (t / z) elif t <= 8.8e+130: tmp = y / (z / x) else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -7.3e+102) tmp = Float64(x * Float64(t / z)); elseif (t <= 8.8e+130) tmp = Float64(y / Float64(z / x)); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -7.3e+102) tmp = x * (t / z); elseif (t <= 8.8e+130) tmp = y / (z / x); else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -7.3e+102], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.8e+130], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.3 \cdot 10^{+102}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 8.8 \cdot 10^{+130}:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -7.29999999999999989e102Initial program 94.1%
Taylor expanded in z around inf 53.4%
associate-/l*61.1%
associate-/r/47.5%
cancel-sign-sub-inv47.5%
metadata-eval47.5%
*-lft-identity47.5%
+-commutative47.5%
Simplified47.5%
Taylor expanded in t around inf 45.7%
associate-*l/54.7%
Simplified54.7%
if -7.29999999999999989e102 < t < 8.79999999999999974e130Initial program 90.7%
Taylor expanded in y around inf 73.9%
*-commutative73.9%
associate-/l*78.2%
Simplified78.2%
if 8.79999999999999974e130 < t Initial program 99.8%
Taylor expanded in z around inf 46.6%
associate-/l*64.4%
associate-/r/60.2%
cancel-sign-sub-inv60.2%
metadata-eval60.2%
*-lft-identity60.2%
+-commutative60.2%
Simplified60.2%
associate-*l/46.6%
associate-/l*64.4%
+-commutative64.4%
Applied egg-rr64.4%
Taylor expanded in y around 0 54.8%
Final simplification69.5%
(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 93.0%
Taylor expanded in z around 0 59.6%
Taylor expanded in t around inf 26.8%
associate-*r*26.8%
neg-mul-126.8%
Simplified26.8%
Final simplification26.8%
(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 2023318
(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)))))