
(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 (* (/ x z) y)) (t_2 (- (/ y z) (/ t (- 1.0 z)))))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 4e+291) (* (fma t (pow (- z 1.0) -1.0) (/ y z)) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 4e+291) {
tmp = fma(t, pow((z - 1.0), -1.0), (y / z)) * x;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 4e+291) tmp = Float64(fma(t, (Float64(z - 1.0) ^ -1.0), Float64(y / z)) * x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 4e+291], N[(N[(t * N[Power[N[(z - 1.0), $MachinePrecision], -1.0], $MachinePrecision] + N[(y / z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;\mathsf{fma}\left(t, {\left(z - 1\right)}^{-1}, \frac{y}{z}\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 3.9999999999999998e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 64.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.9999999999999998e291Initial program 98.5%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-/.f64N/A
distribute-neg-frac2N/A
div-invN/A
lower-fma.f64N/A
inv-powN/A
lower-pow.f64N/A
lift--.f64N/A
sub-negN/A
distribute-neg-inN/A
metadata-evalN/A
remove-double-negN/A
lower-+.f6498.5
Applied rewrites98.5%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) y)) (t_2 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_2 (- INFINITY)) t_1 (if (<= t_2 4e+291) (* x t_2) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= 4e+291) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double t_1 = (x / z) * y;
double t_2 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= 4e+291) {
tmp = x * t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * y t_2 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= 4e+291: tmp = x * t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * y) t_2 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= 4e+291) tmp = Float64(x * t_2); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * y; t_2 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= 4e+291) tmp = x * t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, 4e+291], N[(x * t$95$2), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot y\\
t_2 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+291}:\\
\;\;\;\;x \cdot t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0 or 3.9999999999999998e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 64.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.9
Applied rewrites99.9%
Applied rewrites100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 3.9999999999999998e291Initial program 98.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ x z) t)) (t_2 (* (- t) (fma z x x))))
(if (<= z -0.75)
t_1
(if (<= z -6.5e-200)
t_2
(if (<= z 6.4e-186) t_1 (if (<= z 225000.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double t_2 = -t * fma(z, x, x);
double tmp;
if (z <= -0.75) {
tmp = t_1;
} else if (z <= -6.5e-200) {
tmp = t_2;
} else if (z <= 6.4e-186) {
tmp = t_1;
} else if (z <= 225000.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * t) t_2 = Float64(Float64(-t) * fma(z, x, x)) tmp = 0.0 if (z <= -0.75) tmp = t_1; elseif (z <= -6.5e-200) tmp = t_2; elseif (z <= 6.4e-186) tmp = t_1; elseif (z <= 225000.0) tmp = t_2; else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, Block[{t$95$2 = N[((-t) * N[(z * x + x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -0.75], t$95$1, If[LessEqual[z, -6.5e-200], t$95$2, If[LessEqual[z, 6.4e-186], t$95$1, If[LessEqual[z, 225000.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot t\\
t_2 := \left(-t\right) \cdot \mathsf{fma}\left(z, x, x\right)\\
\mathbf{if}\;z \leq -0.75:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6.5 \cdot 10^{-200}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 6.4 \cdot 10^{-186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 225000:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.75 or -6.5000000000000002e-200 < z < 6.4000000000000001e-186 or 225000 < z Initial program 92.7%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6441.6
Applied rewrites41.6%
Taylor expanded in z around inf
Applied rewrites48.1%
if -0.75 < z < -6.5000000000000002e-200 or 6.4000000000000001e-186 < z < 225000Initial program 95.5%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6441.1
Applied rewrites41.1%
Taylor expanded in z around 0
Applied rewrites39.5%
Final simplification45.1%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ t z) x)))
(if (<= z -2.3e+263)
(* (/ y z) x)
(if (<= z -6e+63) t_1 (if (<= z 1.6e+23) (* (- (/ y z) t) x) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = (t / z) * x;
double tmp;
if (z <= -2.3e+263) {
tmp = (y / z) * x;
} else if (z <= -6e+63) {
tmp = t_1;
} else if (z <= 1.6e+23) {
tmp = ((y / z) - t) * x;
} 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 = (t / z) * x
if (z <= (-2.3d+263)) then
tmp = (y / z) * x
else if (z <= (-6d+63)) then
tmp = t_1
else if (z <= 1.6d+23) then
tmp = ((y / z) - t) * x
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 = (t / z) * x;
double tmp;
if (z <= -2.3e+263) {
tmp = (y / z) * x;
} else if (z <= -6e+63) {
tmp = t_1;
} else if (z <= 1.6e+23) {
tmp = ((y / z) - t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t / z) * x tmp = 0 if z <= -2.3e+263: tmp = (y / z) * x elif z <= -6e+63: tmp = t_1 elif z <= 1.6e+23: tmp = ((y / z) - t) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t / z) * x) tmp = 0.0 if (z <= -2.3e+263) tmp = Float64(Float64(y / z) * x); elseif (z <= -6e+63) tmp = t_1; elseif (z <= 1.6e+23) tmp = Float64(Float64(Float64(y / z) - t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t / z) * x; tmp = 0.0; if (z <= -2.3e+263) tmp = (y / z) * x; elseif (z <= -6e+63) tmp = t_1; elseif (z <= 1.6e+23) tmp = ((y / z) - t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -2.3e+263], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6e+63], t$95$1, If[LessEqual[z, 1.6e+23], N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z} \cdot x\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+263}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -6 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+23}:\\
\;\;\;\;\left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.29999999999999997e263Initial program 99.7%
Taylor expanded in t around 0
lower-/.f6481.9
Applied rewrites81.9%
if -2.29999999999999997e263 < z < -5.99999999999999998e63 or 1.6e23 < z Initial program 96.8%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6496.8
Applied rewrites96.8%
Taylor expanded in t around inf
Applied rewrites66.8%
if -5.99999999999999998e63 < z < 1.6e23Initial program 91.0%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6491.8
Applied rewrites91.8%
Taylor expanded in t around 0
Applied rewrites86.4%
Final simplification79.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -1.1) t_1 (if (<= z 1.08e-11) (/ (* (- y (* t z)) x) z) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -1.1) {
tmp = t_1;
} else if (z <= 1.08e-11) {
tmp = ((y - (t * z)) * 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 = ((t + y) / z) * x
if (z <= (-1.1d0)) then
tmp = t_1
else if (z <= 1.08d-11) then
tmp = ((y - (t * z)) * 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 = ((t + y) / z) * x;
double tmp;
if (z <= -1.1) {
tmp = t_1;
} else if (z <= 1.08e-11) {
tmp = ((y - (t * z)) * x) / z;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -1.1: tmp = t_1 elif z <= 1.08e-11: tmp = ((y - (t * z)) * x) / z else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -1.1) tmp = t_1; elseif (z <= 1.08e-11) tmp = Float64(Float64(Float64(y - Float64(t * z)) * x) / z); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) / z) * x; tmp = 0.0; if (z <= -1.1) tmp = t_1; elseif (z <= 1.08e-11) tmp = ((y - (t * z)) * x) / z; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.1], t$95$1, If[LessEqual[z, 1.08e-11], N[(N[(N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision] / z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\frac{\left(y - t \cdot z\right) \cdot x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.1000000000000001 or 1.07999999999999992e-11 < z Initial program 97.7%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6497.7
Applied rewrites97.7%
if -1.1000000000000001 < z < 1.07999999999999992e-11Initial program 89.2%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6494.5
Applied rewrites94.5%
Final simplification96.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -1.6e+25) t_1 (if (<= z 1.08e-11) (* (- (/ y z) t) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = ((t + y) / z) * x;
double tmp;
if (z <= -1.6e+25) {
tmp = t_1;
} else if (z <= 1.08e-11) {
tmp = ((y / z) - t) * x;
} 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 = ((t + y) / z) * x
if (z <= (-1.6d+25)) then
tmp = t_1
else if (z <= 1.08d-11) then
tmp = ((y / z) - t) * x
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 = ((t + y) / z) * x;
double tmp;
if (z <= -1.6e+25) {
tmp = t_1;
} else if (z <= 1.08e-11) {
tmp = ((y / z) - t) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((t + y) / z) * x tmp = 0 if z <= -1.6e+25: tmp = t_1 elif z <= 1.08e-11: tmp = ((y / z) - t) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -1.6e+25) tmp = t_1; elseif (z <= 1.08e-11) tmp = Float64(Float64(Float64(y / z) - t) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((t + y) / z) * x; tmp = 0.0; if (z <= -1.6e+25) tmp = t_1; elseif (z <= 1.08e-11) tmp = ((y / z) - t) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.6e+25], t$95$1, If[LessEqual[z, 1.08e-11], N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1.6 \cdot 10^{+25}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1.08 \cdot 10^{-11}:\\
\;\;\;\;\left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.6e25 or 1.07999999999999992e-11 < z Initial program 97.6%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6497.6
Applied rewrites97.6%
if -1.6e25 < z < 1.07999999999999992e-11Initial program 89.4%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6494.6
Applied rewrites94.6%
Taylor expanded in t around 0
Applied rewrites88.2%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ t z) x))) (if (<= t -1.95e+131) t_1 (if (<= t 1.3e+127) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (t / z) * x;
double tmp;
if (t <= -1.95e+131) {
tmp = t_1;
} else if (t <= 1.3e+127) {
tmp = (x / z) * y;
} 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 = (t / z) * x
if (t <= (-1.95d+131)) then
tmp = t_1
else if (t <= 1.3d+127) then
tmp = (x / z) * y
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 = (t / z) * x;
double tmp;
if (t <= -1.95e+131) {
tmp = t_1;
} else if (t <= 1.3e+127) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (t / z) * x tmp = 0 if t <= -1.95e+131: tmp = t_1 elif t <= 1.3e+127: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(t / z) * x) tmp = 0.0 if (t <= -1.95e+131) tmp = t_1; elseif (t <= 1.3e+127) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (t / z) * x; tmp = 0.0; if (t <= -1.95e+131) tmp = t_1; elseif (t <= 1.3e+127) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[t, -1.95e+131], t$95$1, If[LessEqual[t, 1.3e+127], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t}{z} \cdot x\\
\mathbf{if}\;t \leq -1.95 \cdot 10^{+131}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.3 \cdot 10^{+127}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.95e131 or 1.3000000000000001e127 < t Initial program 95.8%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6473.6
Applied rewrites73.6%
Taylor expanded in t around inf
Applied rewrites66.2%
if -1.95e131 < t < 1.3000000000000001e127Initial program 92.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6477.1
Applied rewrites77.1%
Applied rewrites78.4%
Final simplification75.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ x z) t))) (if (<= t -2e+132) t_1 (if (<= t 6e+127) (* (/ x z) y) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x / z) * t;
double tmp;
if (t <= -2e+132) {
tmp = t_1;
} else if (t <= 6e+127) {
tmp = (x / z) * y;
} 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 / z) * t
if (t <= (-2d+132)) then
tmp = t_1
else if (t <= 6d+127) then
tmp = (x / z) * y
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 / z) * t;
double tmp;
if (t <= -2e+132) {
tmp = t_1;
} else if (t <= 6e+127) {
tmp = (x / z) * y;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / z) * t tmp = 0 if t <= -2e+132: tmp = t_1 elif t <= 6e+127: tmp = (x / z) * y else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / z) * t) tmp = 0.0 if (t <= -2e+132) tmp = t_1; elseif (t <= 6e+127) tmp = Float64(Float64(x / z) * y); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / z) * t; tmp = 0.0; if (t <= -2e+132) tmp = t_1; elseif (t <= 6e+127) tmp = (x / z) * y; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / z), $MachinePrecision] * t), $MachinePrecision]}, If[LessEqual[t, -2e+132], t$95$1, If[LessEqual[t, 6e+127], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{z} \cdot t\\
\mathbf{if}\;t \leq -2 \cdot 10^{+132}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+127}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.99999999999999998e132 or 6.0000000000000005e127 < t Initial program 95.8%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6473.1
Applied rewrites73.1%
Taylor expanded in z around inf
Applied rewrites56.3%
if -1.99999999999999998e132 < t < 6.0000000000000005e127Initial program 92.8%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6477.1
Applied rewrites77.1%
Applied rewrites78.4%
(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(Float64(-t) * 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}
\\
\left(-t\right) \cdot x
\end{array}
Initial program 93.6%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6464.6
Applied rewrites64.6%
Taylor expanded in t around inf
Applied rewrites21.3%
(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 2024276
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:alt
(! :herbie-platform default (if (< (* x (- (/ y z) (/ t (- 1 z)))) -3811613151656021/5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (* x (- (/ y z) (* t (/ 1 (- 1 z))))) (if (< (* x (- (/ y z) (/ t (- 1 z)))) 7066972463851151/50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (/ (* y x) z) (- (/ (* t x) (- 1 z)))) (* x (- (/ y z) (* t (/ 1 (- 1 z))))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))