
(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 (let* ((t_1 (+ (/ y z) (/ t (+ z -1.0))))) (if (<= t_1 -2e+301) (* y (/ x z)) (* t_1 x))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= -2e+301) {
tmp = y * (x / z);
} else {
tmp = t_1 * 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) :: tmp
t_1 = (y / z) + (t / (z + (-1.0d0)))
if (t_1 <= (-2d+301)) then
tmp = y * (x / z)
else
tmp = t_1 * 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 / (z + -1.0));
double tmp;
if (t_1 <= -2e+301) {
tmp = y * (x / z);
} else {
tmp = t_1 * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= -2e+301: tmp = y * (x / z) else: tmp = t_1 * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) + Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t_1 <= -2e+301) tmp = Float64(y * Float64(x / z)); else tmp = Float64(t_1 * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) + (t / (z + -1.0)); tmp = 0.0; if (t_1 <= -2e+301) tmp = y * (x / z); else tmp = t_1 * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+301], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t$95$1 * x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+301}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \cdot x\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -2.00000000000000011e301Initial program 64.2%
clear-num64.4%
frac-sub64.4%
*-un-lft-identity64.4%
Applied egg-rr64.4%
div-sub7.7%
remove-double-neg7.7%
distribute-neg-frac7.7%
distribute-frac-neg27.7%
distribute-rgt-neg-out7.7%
times-frac7.7%
*-inverses64.4%
cancel-sign-sub-inv64.4%
*-commutative64.4%
associate-/r*64.4%
*-inverses64.4%
metadata-eval64.4%
mul-1-neg64.4%
distribute-neg-frac264.4%
Simplified64.4%
Taylor expanded in z around 0 99.8%
*-rgt-identity99.8%
times-frac99.8%
/-rgt-identity99.8%
associate-/r/64.4%
Simplified64.4%
associate-/r/99.8%
Applied egg-rr99.8%
if -2.00000000000000011e301 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 96.0%
Final simplification96.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ y z) x)))
(if (<= z -1.38e+101)
t_1
(if (<= z 1.92e+15)
(* x (- (/ y z) t))
(if (<= z 1.9e+64)
(/ (* t x) z)
(if (<= z 2.9e+186)
t_1
(if (<= z 2e+195) (* t (/ x z)) (/ (* y x) z))))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) * x;
double tmp;
if (z <= -1.38e+101) {
tmp = t_1;
} else if (z <= 1.92e+15) {
tmp = x * ((y / z) - t);
} else if (z <= 1.9e+64) {
tmp = (t * x) / z;
} else if (z <= 2.9e+186) {
tmp = t_1;
} else if (z <= 2e+195) {
tmp = t * (x / 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) :: t_1
real(8) :: tmp
t_1 = (y / z) * x
if (z <= (-1.38d+101)) then
tmp = t_1
else if (z <= 1.92d+15) then
tmp = x * ((y / z) - t)
else if (z <= 1.9d+64) then
tmp = (t * x) / z
else if (z <= 2.9d+186) then
tmp = t_1
else if (z <= 2d+195) then
tmp = t * (x / 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 t_1 = (y / z) * x;
double tmp;
if (z <= -1.38e+101) {
tmp = t_1;
} else if (z <= 1.92e+15) {
tmp = x * ((y / z) - t);
} else if (z <= 1.9e+64) {
tmp = (t * x) / z;
} else if (z <= 2.9e+186) {
tmp = t_1;
} else if (z <= 2e+195) {
tmp = t * (x / z);
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) * x tmp = 0 if z <= -1.38e+101: tmp = t_1 elif z <= 1.92e+15: tmp = x * ((y / z) - t) elif z <= 1.9e+64: tmp = (t * x) / z elif z <= 2.9e+186: tmp = t_1 elif z <= 2e+195: tmp = t * (x / z) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) * x) tmp = 0.0 if (z <= -1.38e+101) tmp = t_1; elseif (z <= 1.92e+15) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 1.9e+64) tmp = Float64(Float64(t * x) / z); elseif (z <= 2.9e+186) tmp = t_1; elseif (z <= 2e+195) tmp = Float64(t * Float64(x / z)); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) * x; tmp = 0.0; if (z <= -1.38e+101) tmp = t_1; elseif (z <= 1.92e+15) tmp = x * ((y / z) - t); elseif (z <= 1.9e+64) tmp = (t * x) / z; elseif (z <= 2.9e+186) tmp = t_1; elseif (z <= 2e+195) tmp = t * (x / z); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.38e+101], t$95$1, If[LessEqual[z, 1.92e+15], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e+64], N[(N[(t * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 2.9e+186], t$95$1, If[LessEqual[z, 2e+195], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.38 \cdot 10^{+101}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.92 \cdot 10^{+15}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+64}:\\
\;\;\;\;\frac{t \cdot x}{z}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+195}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if z < -1.38e101 or 1.9000000000000001e64 < z < 2.9e186Initial program 98.8%
Taylor expanded in y around inf 61.3%
associate-*r/69.0%
Simplified69.0%
if -1.38e101 < z < 1.92e15Initial program 93.6%
Taylor expanded in z around 0 87.1%
mul-1-neg87.1%
unsub-neg87.1%
div-sub87.2%
associate-/l*87.2%
*-inverses87.2%
*-rgt-identity87.2%
Simplified87.2%
if 1.92e15 < z < 1.9000000000000001e64Initial program 99.8%
Taylor expanded in y around 0 78.7%
mul-1-neg78.7%
distribute-neg-frac278.7%
neg-sub078.7%
associate--r-78.7%
metadata-eval78.7%
Simplified78.7%
Taylor expanded in z around inf 89.0%
if 2.9e186 < z < 1.99999999999999995e195Initial program 99.7%
Taylor expanded in y around 0 99.7%
mul-1-neg99.7%
distribute-neg-frac299.7%
neg-sub099.7%
associate--r-99.7%
metadata-eval99.7%
Simplified99.7%
Taylor expanded in z around inf 68.3%
associate-/l*100.0%
Simplified100.0%
if 1.99999999999999995e195 < z Initial program 84.3%
Taylor expanded in y around inf 76.4%
Final simplification81.9%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.0)
(not (or (<= z -9.4e-265) (and (not (<= z 1.02e-172)) (<= z 1.0)))))
(* t (/ x z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !((z <= -9.4e-265) || (!(z <= 1.02e-172) && (z <= 1.0)))) {
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 <= (-9.4d-265)) .or. (.not. (z <= 1.02d-172)) .and. (z <= 1.0d0))) 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 <= -9.4e-265) || (!(z <= 1.02e-172) && (z <= 1.0)))) {
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 <= -9.4e-265) or (not (z <= 1.02e-172) and (z <= 1.0))): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !((z <= -9.4e-265) || (!(z <= 1.02e-172) && (z <= 1.0)))) 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 <= -9.4e-265) || (~((z <= 1.02e-172)) && (z <= 1.0))))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[Or[LessEqual[z, -9.4e-265], And[N[Not[LessEqual[z, 1.02e-172]], $MachinePrecision], LessEqual[z, 1.0]]]], $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 -9.4 \cdot 10^{-265} \lor \neg \left(z \leq 1.02 \cdot 10^{-172}\right) \land z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or -9.39999999999999972e-265 < z < 1.02e-172 or 1 < z Initial program 94.7%
Taylor expanded in y around 0 48.8%
mul-1-neg48.8%
distribute-neg-frac248.8%
neg-sub048.8%
associate--r-48.8%
metadata-eval48.8%
Simplified48.8%
Taylor expanded in z around inf 49.0%
associate-/l*46.2%
Simplified46.2%
if -1 < z < -9.39999999999999972e-265 or 1.02e-172 < z < 1Initial program 93.7%
Taylor expanded in y around 0 36.8%
mul-1-neg36.8%
distribute-neg-frac236.8%
neg-sub036.8%
associate--r-36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in z around 0 36.3%
associate-*r*36.3%
neg-mul-136.3%
*-commutative36.3%
Simplified36.3%
Final simplification42.6%
(FPCore (x y z t)
:precision binary64
(if (<= t -3.4e+84)
(/ x (/ z t))
(if (<= t -4.5e-238)
(* (/ y z) x)
(if (<= t 1.8e-49)
(/ (* y x) z)
(if (<= t 7.5e+227) (/ x (/ z y)) (* x (/ t z)))))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -3.4e+84) {
tmp = x / (z / t);
} else if (t <= -4.5e-238) {
tmp = (y / z) * x;
} else if (t <= 1.8e-49) {
tmp = (y * x) / z;
} else if (t <= 7.5e+227) {
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 (t <= (-3.4d+84)) then
tmp = x / (z / t)
else if (t <= (-4.5d-238)) then
tmp = (y / z) * x
else if (t <= 1.8d-49) then
tmp = (y * x) / z
else if (t <= 7.5d+227) 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 (t <= -3.4e+84) {
tmp = x / (z / t);
} else if (t <= -4.5e-238) {
tmp = (y / z) * x;
} else if (t <= 1.8e-49) {
tmp = (y * x) / z;
} else if (t <= 7.5e+227) {
tmp = x / (z / y);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -3.4e+84: tmp = x / (z / t) elif t <= -4.5e-238: tmp = (y / z) * x elif t <= 1.8e-49: tmp = (y * x) / z elif t <= 7.5e+227: tmp = x / (z / y) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -3.4e+84) tmp = Float64(x / Float64(z / t)); elseif (t <= -4.5e-238) tmp = Float64(Float64(y / z) * x); elseif (t <= 1.8e-49) tmp = Float64(Float64(y * x) / z); elseif (t <= 7.5e+227) tmp = Float64(x / Float64(z / y)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -3.4e+84) tmp = x / (z / t); elseif (t <= -4.5e-238) tmp = (y / z) * x; elseif (t <= 1.8e-49) tmp = (y * x) / z; elseif (t <= 7.5e+227) tmp = x / (z / y); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -3.4e+84], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4.5e-238], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[t, 1.8e-49], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 7.5e+227], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.4 \cdot 10^{+84}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq -4.5 \cdot 10^{-238}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{-49}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\mathbf{elif}\;t \leq 7.5 \cdot 10^{+227}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -3.3999999999999998e84Initial program 95.3%
Taylor expanded in y around 0 75.8%
mul-1-neg75.8%
distribute-neg-frac275.8%
neg-sub075.8%
associate--r-75.8%
metadata-eval75.8%
Simplified75.8%
clear-num75.9%
un-div-inv75.9%
+-commutative75.9%
Applied egg-rr75.9%
Taylor expanded in z around inf 59.0%
if -3.3999999999999998e84 < t < -4.49999999999999996e-238Initial program 97.3%
Taylor expanded in y around inf 76.0%
associate-*r/82.8%
Simplified82.8%
if -4.49999999999999996e-238 < t < 1.79999999999999985e-49Initial program 88.9%
Taylor expanded in y around inf 87.4%
if 1.79999999999999985e-49 < t < 7.5000000000000003e227Initial program 96.4%
clear-num96.3%
frac-sub68.9%
*-un-lft-identity68.9%
Applied egg-rr68.9%
div-sub59.3%
remove-double-neg59.3%
distribute-neg-frac59.3%
distribute-frac-neg259.3%
distribute-rgt-neg-out59.3%
times-frac66.5%
*-inverses94.5%
cancel-sign-sub-inv94.5%
*-commutative94.5%
associate-/r*96.3%
*-inverses96.3%
metadata-eval96.3%
mul-1-neg96.3%
distribute-neg-frac296.3%
Simplified96.3%
Taylor expanded in z around 0 57.7%
*-rgt-identity57.7%
times-frac58.9%
/-rgt-identity58.9%
associate-/r/61.3%
Simplified61.3%
if 7.5000000000000003e227 < t Initial program 94.8%
Taylor expanded in y around 0 82.1%
mul-1-neg82.1%
distribute-neg-frac282.1%
neg-sub082.1%
associate--r-82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in z around inf 64.1%
*-commutative64.1%
*-lft-identity64.1%
times-frac68.8%
/-rgt-identity68.8%
Simplified68.8%
Final simplification74.6%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- t))))
(if (<= z -1.0)
t_1
(if (<= z -1.36e-264)
t_2
(if (<= z 7.6e-174) (* t (/ x z)) (if (<= z 1.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -1.36e-264) {
tmp = t_2;
} else if (z <= 7.6e-174) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = t_2;
} 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 * (t / z)
t_2 = x * -t
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= (-1.36d-264)) then
tmp = t_2
else if (z <= 7.6d-174) then
tmp = t * (x / z)
else if (z <= 1.0d0) then
tmp = t_2
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 t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -1.36e-264) {
tmp = t_2;
} else if (z <= 7.6e-174) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = x * -t tmp = 0 if z <= -1.0: tmp = t_1 elif z <= -1.36e-264: tmp = t_2 elif z <= 7.6e-174: tmp = t * (x / z) elif z <= 1.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(x * Float64(-t)) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= -1.36e-264) tmp = t_2; elseif (z <= 7.6e-174) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = x * -t; tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= -1.36e-264) tmp = t_2; elseif (z <= 7.6e-174) tmp = t * (x / z); elseif (z <= 1.0) tmp = t_2; 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]}, Block[{t$95$2 = N[(x * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, -1.36e-264], t$95$2, If[LessEqual[z, 7.6e-174], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := x \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.36 \cdot 10^{-264}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-174}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 96.2%
Taylor expanded in y around 0 58.5%
mul-1-neg58.5%
distribute-neg-frac258.5%
neg-sub058.5%
associate--r-58.5%
metadata-eval58.5%
Simplified58.5%
Taylor expanded in z around inf 56.3%
*-commutative56.3%
*-lft-identity56.3%
times-frac57.5%
/-rgt-identity57.5%
Simplified57.5%
if -1 < z < -1.36e-264 or 7.60000000000000042e-174 < z < 1Initial program 93.7%
Taylor expanded in y around 0 36.8%
mul-1-neg36.8%
distribute-neg-frac236.8%
neg-sub036.8%
associate--r-36.8%
metadata-eval36.8%
Simplified36.8%
Taylor expanded in z around 0 36.3%
associate-*r*36.3%
neg-mul-136.3%
*-commutative36.3%
Simplified36.3%
if -1.36e-264 < z < 7.60000000000000042e-174Initial program 88.4%
Taylor expanded in y around 0 8.7%
mul-1-neg8.7%
distribute-neg-frac28.7%
neg-sub08.7%
associate--r-8.7%
metadata-eval8.7%
Simplified8.7%
Taylor expanded in z around inf 18.5%
associate-/l*21.6%
Simplified21.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.098))) (* 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.098)) {
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.098d0))) 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.098)) {
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.098): 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.098)) 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.098))) 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.098]], $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.098\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.098000000000000004 < z Initial program 96.3%
Taylor expanded in z around inf 91.2%
*-commutative91.2%
sub-neg91.2%
remove-double-neg91.2%
neg-mul-191.2%
distribute-neg-in91.2%
neg-mul-191.2%
sub-neg91.2%
distribute-lft-neg-in91.2%
*-commutative91.2%
distribute-neg-frac91.2%
associate-/l*95.4%
distribute-rgt-neg-in95.4%
distribute-neg-frac95.4%
Simplified95.4%
if -1 < z < 0.098000000000000004Initial program 92.2%
Taylor expanded in z around 0 91.7%
mul-1-neg91.7%
unsub-neg91.7%
div-sub91.8%
associate-/l*91.8%
*-inverses91.8%
*-rgt-identity91.8%
Simplified91.8%
Final simplification93.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.2e+84) (not (<= t 1.3e+228))) (* x (/ t z)) (* (/ y z) x)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.2e+84) || !(t <= 1.3e+228)) {
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 <= (-5.2d+84)) .or. (.not. (t <= 1.3d+228))) 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 <= -5.2e+84) || !(t <= 1.3e+228)) {
tmp = x * (t / z);
} else {
tmp = (y / z) * x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.2e+84) or not (t <= 1.3e+228): tmp = x * (t / z) else: tmp = (y / z) * x return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.2e+84) || !(t <= 1.3e+228)) 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 <= -5.2e+84) || ~((t <= 1.3e+228))) tmp = x * (t / z); else tmp = (y / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.2e+84], N[Not[LessEqual[t, 1.3e+228]], $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 -5.2 \cdot 10^{+84} \lor \neg \left(t \leq 1.3 \cdot 10^{+228}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\end{array}
\end{array}
if t < -5.2000000000000002e84 or 1.30000000000000004e228 < t Initial program 95.1%
Taylor expanded in y around 0 77.8%
mul-1-neg77.8%
distribute-neg-frac277.8%
neg-sub077.8%
associate--r-77.8%
metadata-eval77.8%
Simplified77.8%
Taylor expanded in z around inf 57.5%
*-commutative57.5%
*-lft-identity57.5%
times-frac62.0%
/-rgt-identity62.0%
Simplified62.0%
if -5.2000000000000002e84 < t < 1.30000000000000004e228Initial program 94.1%
Taylor expanded in y around inf 74.9%
associate-*r/76.2%
Simplified76.2%
Final simplification72.9%
(FPCore (x y z t) :precision binary64 (if (<= t -5.5e+83) (/ x (/ z t)) (if (<= t 1.02e+228) (* (/ y z) x) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -5.5e+83) {
tmp = x / (z / t);
} else if (t <= 1.02e+228) {
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 (t <= (-5.5d+83)) then
tmp = x / (z / t)
else if (t <= 1.02d+228) 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 (t <= -5.5e+83) {
tmp = x / (z / t);
} else if (t <= 1.02e+228) {
tmp = (y / z) * x;
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -5.5e+83: tmp = x / (z / t) elif t <= 1.02e+228: tmp = (y / z) * x else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -5.5e+83) tmp = Float64(x / Float64(z / t)); elseif (t <= 1.02e+228) tmp = Float64(Float64(y / 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 (t <= -5.5e+83) tmp = x / (z / t); elseif (t <= 1.02e+228) tmp = (y / z) * x; else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -5.5e+83], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e+228], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{+83}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+228}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if t < -5.4999999999999996e83Initial program 95.3%
Taylor expanded in y around 0 75.8%
mul-1-neg75.8%
distribute-neg-frac275.8%
neg-sub075.8%
associate--r-75.8%
metadata-eval75.8%
Simplified75.8%
clear-num75.9%
un-div-inv75.9%
+-commutative75.9%
Applied egg-rr75.9%
Taylor expanded in z around inf 59.0%
if -5.4999999999999996e83 < t < 1.02e228Initial program 94.1%
Taylor expanded in y around inf 74.9%
associate-*r/76.2%
Simplified76.2%
if 1.02e228 < t Initial program 94.8%
Taylor expanded in y around 0 82.1%
mul-1-neg82.1%
distribute-neg-frac282.1%
neg-sub082.1%
associate--r-82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in z around inf 64.1%
*-commutative64.1%
*-lft-identity64.1%
times-frac68.8%
/-rgt-identity68.8%
Simplified68.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 94.4%
Taylor expanded in y around 0 44.5%
mul-1-neg44.5%
distribute-neg-frac244.5%
neg-sub044.5%
associate--r-44.5%
metadata-eval44.5%
Simplified44.5%
Taylor expanded in z around 0 22.1%
associate-*r*22.1%
neg-mul-122.1%
*-commutative22.1%
Simplified22.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 2024087
(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)))))