
(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 11 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)))))
(if (<= t_1 (- INFINITY))
(* (/ x z) y)
(if (<= t_1 2e+248) (* x t_1) (* (fma (- t) z y) (/ x z))))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = (x / z) * y;
} else if (t_1 <= 2e+248) {
tmp = x * t_1;
} else {
tmp = fma(-t, z, y) * (x / z);
}
return tmp;
}
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(Float64(x / z) * y); elseif (t_1 <= 2e+248) tmp = Float64(x * t_1); else tmp = Float64(fma(Float64(-t), z, y) * Float64(x / z)); end return 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[t$95$1, 2e+248], N[(x * t$95$1), $MachinePrecision], N[(N[((-t) * z + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+248}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-t, z, y\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < -inf.0Initial program 61.1%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6499.8
Applied rewrites99.8%
Applied rewrites100.0%
if -inf.0 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 2.00000000000000009e248Initial program 98.8%
if 2.00000000000000009e248 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 75.0%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6499.8
Applied rewrites99.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (/ y z) t) x)) (t_2 (* (/ (+ t y) z) x)))
(if (<= z -1.0)
t_2
(if (<= z -6e-135)
t_1
(if (<= z 1e-218) (* (/ x z) y) (if (<= z 1.0) t_1 t_2))))))
double code(double x, double y, double z, double t) {
double t_1 = ((y / z) - t) * x;
double t_2 = ((t + y) / z) * x;
double tmp;
if (z <= -1.0) {
tmp = t_2;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
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) * x
t_2 = ((t + y) / z) * x
if (z <= (-1.0d0)) then
tmp = t_2
else if (z <= (-6d-135)) then
tmp = t_1
else if (z <= 1d-218) then
tmp = (x / z) * y
else if (z <= 1.0d0) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = ((y / z) - t) * x;
double t_2 = ((t + y) / z) * x;
double tmp;
if (z <= -1.0) {
tmp = t_2;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 1.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((y / z) - t) * x t_2 = ((t + y) / z) * x tmp = 0 if z <= -1.0: tmp = t_2 elif z <= -6e-135: tmp = t_1 elif z <= 1e-218: tmp = (x / z) * y elif z <= 1.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(y / z) - t) * x) t_2 = Float64(Float64(Float64(t + y) / z) * x) tmp = 0.0 if (z <= -1.0) tmp = t_2; elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = Float64(Float64(x / z) * y); elseif (z <= 1.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((y / z) - t) * x; t_2 = ((t + y) / z) * x; tmp = 0.0; if (z <= -1.0) tmp = t_2; elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = (x / z) * y; elseif (z <= 1.0) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$2, If[LessEqual[z, -6e-135], t$95$1, If[LessEqual[z, 1e-218], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 1.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{y}{z} - t\right) \cdot x\\
t_2 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-218}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 98.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.8
Applied rewrites95.8%
if -1 < z < -6.00000000000000024e-135 or 1e-218 < z < 1Initial program 95.9%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6438.7
Applied rewrites38.7%
Taylor expanded in z around 0
Applied rewrites35.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6493.0
Applied rewrites93.0%
Taylor expanded in t around 0
Applied rewrites93.1%
if -6.00000000000000024e-135 < z < 1e-218Initial program 80.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.6
Applied rewrites91.6%
Applied rewrites94.9%
Final simplification94.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (/ y z) t) x)))
(if (<= z -3e+51)
(* (/ y z) x)
(if (<= z -6e-135)
t_1
(if (<= z 1e-218)
(* (/ x z) y)
(if (<= z 5.1e-5) t_1 (* (/ t (- z 1.0)) x)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((y / z) - t) * x;
double tmp;
if (z <= -3e+51) {
tmp = (y / z) * x;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 5.1e-5) {
tmp = t_1;
} else {
tmp = (t / (z - 1.0)) * 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) * x
if (z <= (-3d+51)) then
tmp = (y / z) * x
else if (z <= (-6d-135)) then
tmp = t_1
else if (z <= 1d-218) then
tmp = (x / z) * y
else if (z <= 5.1d-5) then
tmp = t_1
else
tmp = (t / (z - 1.0d0)) * 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) * x;
double tmp;
if (z <= -3e+51) {
tmp = (y / z) * x;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 5.1e-5) {
tmp = t_1;
} else {
tmp = (t / (z - 1.0)) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((y / z) - t) * x tmp = 0 if z <= -3e+51: tmp = (y / z) * x elif z <= -6e-135: tmp = t_1 elif z <= 1e-218: tmp = (x / z) * y elif z <= 5.1e-5: tmp = t_1 else: tmp = (t / (z - 1.0)) * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(y / z) - t) * x) tmp = 0.0 if (z <= -3e+51) tmp = Float64(Float64(y / z) * x); elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = Float64(Float64(x / z) * y); elseif (z <= 5.1e-5) tmp = t_1; else tmp = Float64(Float64(t / Float64(z - 1.0)) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((y / z) - t) * x; tmp = 0.0; if (z <= -3e+51) tmp = (y / z) * x; elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = (x / z) * y; elseif (z <= 5.1e-5) tmp = t_1; else tmp = (t / (z - 1.0)) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -3e+51], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6e-135], t$95$1, If[LessEqual[z, 1e-218], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 5.1e-5], t$95$1, N[(N[(t / N[(z - 1.0), $MachinePrecision]), $MachinePrecision] * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{if}\;z \leq -3 \cdot 10^{+51}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-218}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;z \leq 5.1 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z - 1} \cdot x\\
\end{array}
\end{array}
if z < -3e51Initial program 98.0%
Taylor expanded in t around 0
lower-/.f6463.4
Applied rewrites63.4%
if -3e51 < z < -6.00000000000000024e-135 or 1e-218 < z < 5.09999999999999996e-5Initial program 96.4%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6436.8
Applied rewrites36.8%
Taylor expanded in z around 0
Applied rewrites33.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6493.5
Applied rewrites93.5%
Taylor expanded in t around 0
Applied rewrites93.6%
if -6.00000000000000024e-135 < z < 1e-218Initial program 80.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.6
Applied rewrites91.6%
Applied rewrites94.9%
if 5.09999999999999996e-5 < z Initial program 98.1%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6471.2
Applied rewrites71.2%
Final simplification82.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (- (/ y z) t) x)))
(if (<= z -3e+51)
(* (/ y z) x)
(if (<= z -6e-135)
t_1
(if (<= z 1e-218) (* (/ x z) y) (if (<= z 10.0) t_1 (* (/ t z) x)))))))
double code(double x, double y, double z, double t) {
double t_1 = ((y / z) - t) * x;
double tmp;
if (z <= -3e+51) {
tmp = (y / z) * x;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 10.0) {
tmp = t_1;
} else {
tmp = (t / 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) :: tmp
t_1 = ((y / z) - t) * x
if (z <= (-3d+51)) then
tmp = (y / z) * x
else if (z <= (-6d-135)) then
tmp = t_1
else if (z <= 1d-218) then
tmp = (x / z) * y
else if (z <= 10.0d0) then
tmp = t_1
else
tmp = (t / 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) * x;
double tmp;
if (z <= -3e+51) {
tmp = (y / z) * x;
} else if (z <= -6e-135) {
tmp = t_1;
} else if (z <= 1e-218) {
tmp = (x / z) * y;
} else if (z <= 10.0) {
tmp = t_1;
} else {
tmp = (t / z) * x;
}
return tmp;
}
def code(x, y, z, t): t_1 = ((y / z) - t) * x tmp = 0 if z <= -3e+51: tmp = (y / z) * x elif z <= -6e-135: tmp = t_1 elif z <= 1e-218: tmp = (x / z) * y elif z <= 10.0: tmp = t_1 else: tmp = (t / z) * x return tmp
function code(x, y, z, t) t_1 = Float64(Float64(Float64(y / z) - t) * x) tmp = 0.0 if (z <= -3e+51) tmp = Float64(Float64(y / z) * x); elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = Float64(Float64(x / z) * y); elseif (z <= 10.0) tmp = t_1; else tmp = Float64(Float64(t / z) * x); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = ((y / z) - t) * x; tmp = 0.0; if (z <= -3e+51) tmp = (y / z) * x; elseif (z <= -6e-135) tmp = t_1; elseif (z <= 1e-218) tmp = (x / z) * y; elseif (z <= 10.0) tmp = t_1; else tmp = (t / z) * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -3e+51], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, -6e-135], t$95$1, If[LessEqual[z, 1e-218], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision], If[LessEqual[z, 10.0], t$95$1, N[(N[(t / z), $MachinePrecision] * x), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\frac{y}{z} - t\right) \cdot x\\
\mathbf{if}\;z \leq -3 \cdot 10^{+51}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{elif}\;z \leq -6 \cdot 10^{-135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 10^{-218}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{elif}\;z \leq 10:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{z} \cdot x\\
\end{array}
\end{array}
if z < -3e51Initial program 98.0%
Taylor expanded in t around 0
lower-/.f6463.4
Applied rewrites63.4%
if -3e51 < z < -6.00000000000000024e-135 or 1e-218 < z < 10Initial program 96.4%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6437.5
Applied rewrites37.5%
Taylor expanded in z around 0
Applied rewrites34.0%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6492.9
Applied rewrites92.9%
Taylor expanded in t around 0
Applied rewrites92.9%
if -6.00000000000000024e-135 < z < 1e-218Initial program 80.2%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6491.6
Applied rewrites91.6%
Applied rewrites94.9%
if 10 < z Initial program 98.1%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6470.8
Applied rewrites70.8%
Taylor expanded in z around inf
Applied rewrites67.1%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (<= z -0.16) (* (/ (+ t y) z) x) (if (<= z 1.0) (* (fma (- t) z y) (/ x z)) (/ x (/ z (+ t y))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.16) {
tmp = ((t + y) / z) * x;
} else if (z <= 1.0) {
tmp = fma(-t, z, y) * (x / z);
} else {
tmp = x / (z / (t + y));
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (z <= -0.16) tmp = Float64(Float64(Float64(t + y) / z) * x); elseif (z <= 1.0) tmp = Float64(fma(Float64(-t), z, y) * Float64(x / z)); else tmp = Float64(x / Float64(z / Float64(t + y))); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.16], N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision], If[LessEqual[z, 1.0], N[(N[((-t) * z + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;\frac{t + y}{z} \cdot x\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\mathsf{fma}\left(-t, z, y\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t + y}}\\
\end{array}
\end{array}
if z < -0.160000000000000003Initial program 98.3%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6497.2
Applied rewrites97.2%
if -0.160000000000000003 < z < 1Initial program 89.1%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6493.3
Applied rewrites93.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6491.8
Applied rewrites91.8%
if 1 < z Initial program 98.1%
lift-*.f64N/A
lift--.f64N/A
flip--N/A
clear-numN/A
un-div-invN/A
lower-/.f64N/A
clear-numN/A
flip--N/A
lift--.f64N/A
lower-/.f6498.0
Applied rewrites98.0%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.5
Applied rewrites94.5%
Final simplification93.8%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* (/ (+ t y) z) x))) (if (<= z -0.16) t_1 (if (<= z 1.0) (* (fma (- t) z y) (/ 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 <= -0.16) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = fma(-t, z, y) * (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 <= -0.16) tmp = t_1; elseif (z <= 1.0) tmp = Float64(fma(Float64(-t), z, y) * Float64(x / z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision] * x), $MachinePrecision]}, If[LessEqual[z, -0.16], t$95$1, If[LessEqual[z, 1.0], N[(N[((-t) * z + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{t + y}{z} \cdot x\\
\mathbf{if}\;z \leq -0.16:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;\mathsf{fma}\left(-t, z, y\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.160000000000000003 or 1 < z Initial program 98.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6495.8
Applied rewrites95.8%
if -0.160000000000000003 < z < 1Initial program 89.1%
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-/.f64N/A
lift-/.f64N/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
lower-*.f64N/A
lower-/.f64N/A
cancel-sign-sub-invN/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f64N/A
lower-neg.f64N/A
lower-/.f6493.3
Applied rewrites93.3%
Taylor expanded in z around 0
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6491.8
Applied rewrites91.8%
Final simplification93.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* (/ t z) x)))
(if (<= t -2.55e+221)
t_1
(if (<= t 1.62e-296)
(/ (* x y) z)
(if (<= t 2.55e+143) (* (/ 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 <= -2.55e+221) {
tmp = t_1;
} else if (t <= 1.62e-296) {
tmp = (x * y) / z;
} else if (t <= 2.55e+143) {
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 <= (-2.55d+221)) then
tmp = t_1
else if (t <= 1.62d-296) then
tmp = (x * y) / z
else if (t <= 2.55d+143) 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 <= -2.55e+221) {
tmp = t_1;
} else if (t <= 1.62e-296) {
tmp = (x * y) / z;
} else if (t <= 2.55e+143) {
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 <= -2.55e+221: tmp = t_1 elif t <= 1.62e-296: tmp = (x * y) / z elif t <= 2.55e+143: 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 <= -2.55e+221) tmp = t_1; elseif (t <= 1.62e-296) tmp = Float64(Float64(x * y) / z); elseif (t <= 2.55e+143) 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 <= -2.55e+221) tmp = t_1; elseif (t <= 1.62e-296) tmp = (x * y) / z; elseif (t <= 2.55e+143) 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, -2.55e+221], t$95$1, If[LessEqual[t, 1.62e-296], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[t, 2.55e+143], 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 -2.55 \cdot 10^{+221}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.62 \cdot 10^{-296}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{elif}\;t \leq 2.55 \cdot 10^{+143}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.54999999999999988e221 or 2.55000000000000019e143 < t Initial program 93.2%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6482.7
Applied rewrites82.7%
Taylor expanded in z around inf
Applied rewrites77.7%
if -2.54999999999999988e221 < t < 1.61999999999999994e-296Initial program 93.0%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6474.4
Applied rewrites74.4%
if 1.61999999999999994e-296 < t < 2.55000000000000019e143Initial program 94.3%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6471.5
Applied rewrites71.5%
Applied rewrites77.7%
Final simplification76.1%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (/ (* x y) z))) (if (<= y -3.5e-63) t_1 (if (<= y 2.5e-60) (/ (* x t) (- z 1.0)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = (x * y) / z;
double tmp;
if (y <= -3.5e-63) {
tmp = t_1;
} else if (y <= 2.5e-60) {
tmp = (x * t) / (z - 1.0);
} 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 * y) / z
if (y <= (-3.5d-63)) then
tmp = t_1
else if (y <= 2.5d-60) then
tmp = (x * t) / (z - 1.0d0)
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;
double tmp;
if (y <= -3.5e-63) {
tmp = t_1;
} else if (y <= 2.5e-60) {
tmp = (x * t) / (z - 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x * y) / z tmp = 0 if y <= -3.5e-63: tmp = t_1 elif y <= 2.5e-60: tmp = (x * t) / (z - 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x * y) / z) tmp = 0.0 if (y <= -3.5e-63) tmp = t_1; elseif (y <= 2.5e-60) tmp = Float64(Float64(x * t) / Float64(z - 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x * y) / z; tmp = 0.0; if (y <= -3.5e-63) tmp = t_1; elseif (y <= 2.5e-60) tmp = (x * t) / (z - 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]}, If[LessEqual[y, -3.5e-63], t$95$1, If[LessEqual[y, 2.5e-60], N[(N[(x * t), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x \cdot y}{z}\\
\mathbf{if}\;y \leq -3.5 \cdot 10^{-63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{x \cdot t}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -3.50000000000000003e-63 or 2.5000000000000001e-60 < y Initial program 90.7%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6481.8
Applied rewrites81.8%
if -3.50000000000000003e-63 < y < 2.5000000000000001e-60Initial program 97.9%
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--.f6472.1
Applied rewrites72.1%
Final simplification78.0%
(FPCore (x y z t) :precision binary64 (if (<= t 1.62e-296) (/ (* x y) z) (* (/ x z) y)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.62e-296) {
tmp = (x * y) / z;
} else {
tmp = (x / z) * y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= 1.62d-296) then
tmp = (x * y) / z
else
tmp = (x / z) * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= 1.62e-296) {
tmp = (x * y) / z;
} else {
tmp = (x / z) * y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= 1.62e-296: tmp = (x * y) / z else: tmp = (x / z) * y return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= 1.62e-296) tmp = Float64(Float64(x * y) / z); else tmp = Float64(Float64(x / z) * y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= 1.62e-296) tmp = (x * y) / z; else tmp = (x / z) * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, 1.62e-296], N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision], N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.62 \cdot 10^{-296}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot y\\
\end{array}
\end{array}
if t < 1.61999999999999994e-296Initial program 92.4%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6468.6
Applied rewrites68.6%
if 1.61999999999999994e-296 < t Initial program 94.9%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6459.5
Applied rewrites59.5%
Applied rewrites64.2%
Final simplification66.6%
(FPCore (x y z t) :precision binary64 (* (/ x z) y))
double code(double x, double y, double z, double t) {
return (x / z) * y;
}
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 / z) * y
end function
public static double code(double x, double y, double z, double t) {
return (x / z) * y;
}
def code(x, y, z, t): return (x / z) * y
function code(x, y, z, t) return Float64(Float64(x / z) * y) end
function tmp = code(x, y, z, t) tmp = (x / z) * y; end
code[x_, y_, z_, t_] := N[(N[(x / z), $MachinePrecision] * y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{z} \cdot y
\end{array}
Initial program 93.5%
Taylor expanded in t around 0
lower-/.f64N/A
*-commutativeN/A
lower-*.f6464.4
Applied rewrites64.4%
Applied rewrites64.3%
(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.5%
Taylor expanded in t around inf
mul-1-negN/A
distribute-neg-frac2N/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--.f6442.4
Applied rewrites42.4%
Taylor expanded in z around 0
Applied rewrites17.2%
Final simplification17.2%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))))
(t_2 (* x (- (/ y z) (/ t (- 1.0 z))))))
(if (< t_2 -7.623226303312042e-196)
t_1
(if (< t_2 1.4133944927702302e-211)
(+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z))))
t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = x * ((y / z) - (t * (1.0d0 / (1.0d0 - z))))
t_2 = x * ((y / z) - (t / (1.0d0 - z)))
if (t_2 < (-7.623226303312042d-196)) then
tmp = t_1
else if (t_2 < 1.4133944927702302d-211) then
tmp = ((y * x) / z) + -((t * x) / (1.0d0 - z))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z))));
double t_2 = x * ((y / z) - (t / (1.0 - z)));
double tmp;
if (t_2 < -7.623226303312042e-196) {
tmp = t_1;
} else if (t_2 < 1.4133944927702302e-211) {
tmp = ((y * x) / z) + -((t * x) / (1.0 - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))) t_2 = x * ((y / z) - (t / (1.0 - z))) tmp = 0 if t_2 < -7.623226303312042e-196: tmp = t_1 elif t_2 < 1.4133944927702302e-211: tmp = ((y * x) / z) + -((t * x) / (1.0 - z)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y / z) - Float64(t * Float64(1.0 / Float64(1.0 - z))))) t_2 = Float64(x * Float64(Float64(y / z) - Float64(t / Float64(1.0 - z)))) tmp = 0.0 if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = Float64(Float64(Float64(y * x) / z) + Float64(-Float64(Float64(t * x) / Float64(1.0 - z)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y / z) - (t * (1.0 / (1.0 - z)))); t_2 = x * ((y / z) - (t / (1.0 - z))); tmp = 0.0; if (t_2 < -7.623226303312042e-196) tmp = t_1; elseif (t_2 < 1.4133944927702302e-211) tmp = ((y * x) / z) + -((t * x) / (1.0 - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t * N[(1.0 / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x * N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -7.623226303312042e-196], t$95$1, If[Less[t$95$2, 1.4133944927702302e-211], N[(N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision] + (-N[(N[(t * x), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \left(\frac{y}{z} - t \cdot \frac{1}{1 - z}\right)\\
t_2 := x \cdot \left(\frac{y}{z} - \frac{t}{1 - z}\right)\\
\mathbf{if}\;t\_2 < -7.623226303312042 \cdot 10^{-196}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 < 1.4133944927702302 \cdot 10^{-211}:\\
\;\;\;\;\frac{y \cdot x}{z} + \left(-\frac{t \cdot x}{1 - z}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024268
(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)))))