
(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 1e+236)
(* t_1 x)
(* (/ (- (* y (- 1.0 z)) (* z t)) (- 1.0 z)) (/ x z)))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) + (t / (z + -1.0));
double tmp;
if (t_1 <= 1e+236) {
tmp = t_1 * x;
} else {
tmp = (((y * (1.0 - z)) - (z * t)) / (1.0 - z)) * (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) + (t / (z + (-1.0d0)))
if (t_1 <= 1d+236) then
tmp = t_1 * x
else
tmp = (((y * (1.0d0 - z)) - (z * t)) / (1.0d0 - z)) * (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) + (t / (z + -1.0));
double tmp;
if (t_1 <= 1e+236) {
tmp = t_1 * x;
} else {
tmp = (((y * (1.0 - z)) - (z * t)) / (1.0 - z)) * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= 1e+236: tmp = t_1 * x else: tmp = (((y * (1.0 - z)) - (z * t)) / (1.0 - z)) * (x / z) 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 <= 1e+236) tmp = Float64(t_1 * x); else tmp = Float64(Float64(Float64(Float64(y * Float64(1.0 - z)) - Float64(z * t)) / Float64(1.0 - z)) * Float64(x / z)); 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 <= 1e+236) tmp = t_1 * x; else tmp = (((y * (1.0 - z)) - (z * t)) / (1.0 - z)) * (x / z); 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, 1e+236], N[(t$95$1 * x), $MachinePrecision], N[(N[(N[(N[(y * N[(1.0 - z), $MachinePrecision]), $MachinePrecision] - N[(z * t), $MachinePrecision]), $MachinePrecision] / N[(1.0 - z), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq 10^{+236}:\\
\;\;\;\;t\_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot \left(1 - z\right) - z \cdot t}{1 - z} \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.00000000000000005e236Initial program 96.9%
if 1.00000000000000005e236 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 82.6%
*-commutativeN/A
frac-subN/A
associate-*l/N/A
*-commutativeN/A
times-fracN/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
/-lowering-/.f64100.0%
Applied egg-rr100.0%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(if (<= z -5.5e+129)
(/ x (/ z y))
(if (<= z -6.6e+36)
(* x (/ t z))
(if (<= z 4400000000000.0)
(* x (- (/ y z) t))
(if (<= z 1.45e+149) (/ x (/ z t)) (/ (* y x) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+129) {
tmp = x / (z / y);
} else if (z <= -6.6e+36) {
tmp = x * (t / z);
} else if (z <= 4400000000000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 1.45e+149) {
tmp = x / (z / t);
} else {
tmp = (y * x) / z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-5.5d+129)) then
tmp = x / (z / y)
else if (z <= (-6.6d+36)) then
tmp = x * (t / z)
else if (z <= 4400000000000.0d0) then
tmp = x * ((y / z) - t)
else if (z <= 1.45d+149) then
tmp = x / (z / t)
else
tmp = (y * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -5.5e+129) {
tmp = x / (z / y);
} else if (z <= -6.6e+36) {
tmp = x * (t / z);
} else if (z <= 4400000000000.0) {
tmp = x * ((y / z) - t);
} else if (z <= 1.45e+149) {
tmp = x / (z / t);
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -5.5e+129: tmp = x / (z / y) elif z <= -6.6e+36: tmp = x * (t / z) elif z <= 4400000000000.0: tmp = x * ((y / z) - t) elif z <= 1.45e+149: tmp = x / (z / t) else: tmp = (y * x) / z return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -5.5e+129) tmp = Float64(x / Float64(z / y)); elseif (z <= -6.6e+36) tmp = Float64(x * Float64(t / z)); elseif (z <= 4400000000000.0) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 1.45e+149) tmp = Float64(x / Float64(z / t)); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -5.5e+129) tmp = x / (z / y); elseif (z <= -6.6e+36) tmp = x * (t / z); elseif (z <= 4400000000000.0) tmp = x * ((y / z) - t); elseif (z <= 1.45e+149) tmp = x / (z / t); else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -5.5e+129], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -6.6e+36], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4400000000000.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.45e+149], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{+129}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;z \leq -6.6 \cdot 10^{+36}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 4400000000000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{+149}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if z < -5.49999999999999984e129Initial program 99.8%
Taylor expanded in y around inf
/-lowering-/.f6481.3%
Simplified81.3%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6481.4%
Applied egg-rr81.4%
if -5.49999999999999984e129 < z < -6.5999999999999997e36Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6474.1%
Simplified74.1%
Taylor expanded in z around inf
/-lowering-/.f6474.1%
Simplified74.1%
if -6.5999999999999997e36 < z < 4.4e12Initial program 93.3%
Taylor expanded in z around 0
Simplified89.8%
if 4.4e12 < z < 1.4500000000000001e149Initial program 99.7%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6467.8%
Simplified67.8%
Taylor expanded in z around inf
/-lowering-/.f6467.4%
Simplified67.4%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6467.5%
Applied egg-rr67.5%
if 1.4500000000000001e149 < z Initial program 86.8%
Taylor expanded in y around inf
/-lowering-/.f64N/A
*-lowering-*.f6474.3%
Simplified74.3%
Final simplification83.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (+ (/ y z) (/ t (+ z -1.0))))) (if (<= t_1 2e+291) (* t_1 x) (* y (/ x z)))))
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+291) {
tmp = t_1 * x;
} 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) + (t / (z + (-1.0d0)))
if (t_1 <= 2d+291) then
tmp = t_1 * x
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) + (t / (z + -1.0));
double tmp;
if (t_1 <= 2e+291) {
tmp = t_1 * x;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) + (t / (z + -1.0)) tmp = 0 if t_1 <= 2e+291: tmp = t_1 * x else: tmp = y * (x / z) 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+291) tmp = Float64(t_1 * x); else tmp = Float64(y * Float64(x / z)); 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+291) tmp = t_1 * x; else tmp = y * (x / z); 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+291], N[(t$95$1 * x), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} + \frac{t}{z + -1}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+291}:\\
\;\;\;\;t\_1 \cdot x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.9999999999999999e291Initial program 97.0%
if 1.9999999999999999e291 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 76.9%
Taylor expanded in y around inf
/-lowering-/.f6476.9%
Simplified76.9%
div-invN/A
*-commutativeN/A
associate-*r*N/A
div-invN/A
*-lowering-*.f64N/A
/-lowering-/.f64100.0%
Applied egg-rr100.0%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ (+ y t) z)))) (if (<= z -1.05e+28) t_1 (if (<= z 8e-5) (* x (- (/ y z) t)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * ((y + t) / z);
double tmp;
if (z <= -1.05e+28) {
tmp = t_1;
} else if (z <= 8e-5) {
tmp = x * ((y / z) - t);
} 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 + t) / z)
if (z <= (-1.05d+28)) then
tmp = t_1
else if (z <= 8d-5) then
tmp = x * ((y / z) - t)
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 + t) / z);
double tmp;
if (z <= -1.05e+28) {
tmp = t_1;
} else if (z <= 8e-5) {
tmp = x * ((y / z) - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * ((y + t) / z) tmp = 0 if z <= -1.05e+28: tmp = t_1 elif z <= 8e-5: tmp = x * ((y / z) - t) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(Float64(y + t) / z)) tmp = 0.0 if (z <= -1.05e+28) tmp = t_1; elseif (z <= 8e-5) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * ((y + t) / z); tmp = 0.0; if (z <= -1.05e+28) tmp = t_1; elseif (z <= 8e-5) tmp = x * ((y / z) - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.05e+28], t$95$1, If[LessEqual[z, 8e-5], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y + t}{z}\\
\mathbf{if}\;z \leq -1.05 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-5}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1.04999999999999995e28 or 8.00000000000000065e-5 < z Initial program 97.5%
Taylor expanded in z around inf
/-lowering-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-lowering-+.f6496.2%
Simplified96.2%
if -1.04999999999999995e28 < z < 8.00000000000000065e-5Initial program 92.8%
Taylor expanded in z around 0
Simplified92.0%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t (+ z -1.0))))) (if (<= t -1.35e+122) t_1 (if (<= t 1.2e+123) (* (/ y z) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -1.35e+122) {
tmp = t_1;
} else if (t <= 1.2e+123) {
tmp = (y / z) * 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 = x * (t / (z + (-1.0d0)))
if (t <= (-1.35d+122)) then
tmp = t_1
else if (t <= 1.2d+123) then
tmp = (y / z) * 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 = x * (t / (z + -1.0));
double tmp;
if (t <= -1.35e+122) {
tmp = t_1;
} else if (t <= 1.2e+123) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -1.35e+122: tmp = t_1 elif t <= 1.2e+123: tmp = (y / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / Float64(z + -1.0))) tmp = 0.0 if (t <= -1.35e+122) tmp = t_1; elseif (t <= 1.2e+123) tmp = Float64(Float64(y / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / (z + -1.0)); tmp = 0.0; if (t <= -1.35e+122) tmp = t_1; elseif (t <= 1.2e+123) tmp = (y / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.35e+122], t$95$1, If[LessEqual[t, 1.2e+123], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{+122}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+123}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.3499999999999999e122 or 1.19999999999999994e123 < t Initial program 93.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6479.7%
Simplified79.7%
if -1.3499999999999999e122 < t < 1.19999999999999994e123Initial program 95.6%
Taylor expanded in y around inf
/-lowering-/.f6481.8%
Simplified81.8%
Final simplification81.2%
(FPCore (x y z t) :precision binary64 (if (<= t -2.4e+134) (* x (/ t z)) (if (<= t 8e+111) (* (/ y z) x) (/ x (/ z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.4e+134) {
tmp = x * (t / z);
} else if (t <= 8e+111) {
tmp = (y / z) * x;
} else {
tmp = x / (z / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-2.4d+134)) then
tmp = x * (t / z)
else if (t <= 8d+111) then
tmp = (y / z) * x
else
tmp = x / (z / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.4e+134) {
tmp = x * (t / z);
} else if (t <= 8e+111) {
tmp = (y / z) * x;
} else {
tmp = x / (z / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.4e+134: tmp = x * (t / z) elif t <= 8e+111: tmp = (y / z) * x else: tmp = x / (z / t) return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.4e+134) tmp = Float64(x * Float64(t / z)); elseif (t <= 8e+111) tmp = Float64(Float64(y / z) * x); else tmp = Float64(x / Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.4e+134) tmp = x * (t / z); elseif (t <= 8e+111) tmp = (y / z) * x; else tmp = x / (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.4e+134], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8e+111], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], N[(x / N[(z / t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+134}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+111}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{t}}\\
\end{array}
\end{array}
if t < -2.40000000000000005e134Initial program 99.9%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6482.1%
Simplified82.1%
Taylor expanded in z around inf
/-lowering-/.f6467.6%
Simplified67.6%
if -2.40000000000000005e134 < t < 7.99999999999999965e111Initial program 95.6%
Taylor expanded in y around inf
/-lowering-/.f6481.6%
Simplified81.6%
if 7.99999999999999965e111 < t Initial program 89.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6476.9%
Simplified76.9%
Taylor expanded in z around inf
/-lowering-/.f6452.5%
Simplified52.5%
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f6452.6%
Applied egg-rr52.6%
Final simplification74.5%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= t -5.1e+135) t_1 (if (<= t 3e+97) (* (/ y z) x) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -5.1e+135) {
tmp = t_1;
} else if (t <= 3e+97) {
tmp = (y / z) * 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 = x * (t / z)
if (t <= (-5.1d+135)) then
tmp = t_1
else if (t <= 3d+97) then
tmp = (y / z) * 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 = x * (t / z);
double tmp;
if (t <= -5.1e+135) {
tmp = t_1;
} else if (t <= 3e+97) {
tmp = (y / z) * x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -5.1e+135: tmp = t_1 elif t <= 3e+97: tmp = (y / z) * x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -5.1e+135) tmp = t_1; elseif (t <= 3e+97) tmp = Float64(Float64(y / z) * x); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -5.1e+135) tmp = t_1; elseif (t <= 3e+97) tmp = (y / z) * x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.1e+135], t$95$1, If[LessEqual[t, 3e+97], N[(N[(y / z), $MachinePrecision] * x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -5.1 \cdot 10^{+135}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+97}:\\
\;\;\;\;\frac{y}{z} \cdot x\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.09999999999999982e135 or 2.9999999999999998e97 < t Initial program 94.0%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6479.1%
Simplified79.1%
Taylor expanded in z around inf
/-lowering-/.f6458.7%
Simplified58.7%
if -5.09999999999999982e135 < t < 2.9999999999999998e97Initial program 95.6%
Taylor expanded in y around inf
/-lowering-/.f6481.6%
Simplified81.6%
Final simplification74.4%
(FPCore (x y z t) :precision binary64 (let* ((t_1 (* x (/ t z)))) (if (<= z -1.0) t_1 (if (<= z 1.0) (* t (- 0.0 x)) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = t * (0.0 - 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 = x * (t / z)
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= 1.0d0) then
tmp = t * (0.0d0 - 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 = x * (t / z);
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= 1.0) {
tmp = t * (0.0 - x);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -1.0: tmp = t_1 elif z <= 1.0: tmp = t * (0.0 - x) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= 1.0) tmp = Float64(t * Float64(0.0 - x)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= 1.0) tmp = t * (0.0 - x); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, 1.0], N[(t * N[(0.0 - x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t \cdot \left(0 - x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 97.5%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6455.8%
Simplified55.8%
Taylor expanded in z around inf
/-lowering-/.f6454.6%
Simplified54.6%
if -1 < z < 1Initial program 92.8%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6431.2%
Simplified31.2%
Taylor expanded in z around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6430.3%
Simplified30.3%
sub0-negN/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f6430.3%
Applied egg-rr30.3%
Final simplification42.2%
(FPCore (x y z t) :precision binary64 (* t (- 0.0 x)))
double code(double x, double y, double z, double t) {
return t * (0.0 - 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 * (0.0d0 - x)
end function
public static double code(double x, double y, double z, double t) {
return t * (0.0 - x);
}
def code(x, y, z, t): return t * (0.0 - x)
function code(x, y, z, t) return Float64(t * Float64(0.0 - x)) end
function tmp = code(x, y, z, t) tmp = t * (0.0 - x); end
code[x_, y_, z_, t_] := N[(t * N[(0.0 - x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
t \cdot \left(0 - x\right)
\end{array}
Initial program 95.1%
Taylor expanded in y around 0
*-commutativeN/A
associate-/l*N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
*-lowering-*.f64N/A
mul-1-negN/A
distribute-neg-frac2N/A
/-lowering-/.f64N/A
sub-negN/A
mul-1-negN/A
distribute-neg-inN/A
metadata-evalN/A
mul-1-negN/A
remove-double-negN/A
+-commutativeN/A
+-lowering-+.f6443.2%
Simplified43.2%
Taylor expanded in z around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
*-lowering-*.f6420.5%
Simplified20.5%
sub0-negN/A
neg-lowering-neg.f64N/A
*-commutativeN/A
*-lowering-*.f6420.5%
Applied egg-rr20.5%
Final simplification20.5%
(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 2024191
(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)))))