
(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 (* x (+ (/ y z) (/ t (+ z -1.0)))))
double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
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 / (z + (-1.0d0))))
end function
public static double code(double x, double y, double z, double t) {
return x * ((y / z) + (t / (z + -1.0)));
}
def code(x, y, z, t): return x * ((y / z) + (t / (z + -1.0)))
function code(x, y, z, t) return Float64(x * Float64(Float64(y / z) + Float64(t / Float64(z + -1.0)))) end
function tmp = code(x, y, z, t) tmp = x * ((y / z) + (t / (z + -1.0))); end
code[x_, y_, z_, t_] := N[(x * N[(N[(y / z), $MachinePrecision] + N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(\frac{y}{z} + \frac{t}{z + -1}\right)
\end{array}
Initial program 97.9%
Final simplification97.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t (+ z -1.0)))))
(if (<= t -5.9e+94)
t_1
(if (<= t -1.9e-34)
(* x (- (/ y z) t))
(if (<= t 1.2e+18) (* x (/ y z)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / (z + -1.0));
double tmp;
if (t <= -5.9e+94) {
tmp = t_1;
} else if (t <= -1.9e-34) {
tmp = x * ((y / z) - t);
} else if (t <= 1.2e+18) {
tmp = x * (y / 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 = x * (t / (z + (-1.0d0)))
if (t <= (-5.9d+94)) then
tmp = t_1
else if (t <= (-1.9d-34)) then
tmp = x * ((y / z) - t)
else if (t <= 1.2d+18) then
tmp = x * (y / 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 * (t / (z + -1.0));
double tmp;
if (t <= -5.9e+94) {
tmp = t_1;
} else if (t <= -1.9e-34) {
tmp = x * ((y / z) - t);
} else if (t <= 1.2e+18) {
tmp = x * (y / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / (z + -1.0)) tmp = 0 if t <= -5.9e+94: tmp = t_1 elif t <= -1.9e-34: tmp = x * ((y / z) - t) elif t <= 1.2e+18: tmp = x * (y / z) 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 <= -5.9e+94) tmp = t_1; elseif (t <= -1.9e-34) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (t <= 1.2e+18) tmp = Float64(x * Float64(y / z)); 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 <= -5.9e+94) tmp = t_1; elseif (t <= -1.9e-34) tmp = x * ((y / z) - t); elseif (t <= 1.2e+18) tmp = x * (y / z); 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, -5.9e+94], t$95$1, If[LessEqual[t, -1.9e-34], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.2e+18], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z + -1}\\
\mathbf{if}\;t \leq -5.9 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{-34}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+18}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.8999999999999999e94 or 1.2e18 < t Initial program 97.7%
Taylor expanded in y around 0 75.5%
mul-1-neg75.5%
distribute-neg-frac275.5%
neg-sub075.5%
associate--r-75.5%
metadata-eval75.5%
Simplified75.5%
if -5.8999999999999999e94 < t < -1.9000000000000001e-34Initial program 99.6%
Taylor expanded in z around 0 88.7%
if -1.9000000000000001e-34 < t < 1.2e18Initial program 97.6%
Taylor expanded in y around inf 89.3%
associate-*r/92.4%
Simplified92.4%
Final simplification85.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e+20) (not (<= z 0.0265))) (* x (/ (+ y t) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 0.0265)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.8d+20)) .or. (.not. (z <= 0.0265d0))) then
tmp = x * ((y + t) / z)
else
tmp = x * ((y / z) - t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 0.0265)) {
tmp = x * ((y + t) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+20) or not (z <= 0.0265): tmp = x * ((y + t) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+20) || !(z <= 0.0265)) tmp = Float64(x * Float64(Float64(y + t) / z)); else tmp = Float64(x * Float64(Float64(y / z) - t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e+20) || ~((z <= 0.0265))) tmp = x * ((y + t) / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+20], N[Not[LessEqual[z, 0.0265]], $MachinePrecision]], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+20} \lor \neg \left(z \leq 0.0265\right):\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -4.8e20 or 0.0264999999999999993 < z Initial program 98.9%
Taylor expanded in z around inf 91.0%
associate-/l*98.9%
sub-neg98.9%
remove-double-neg98.9%
neg-mul-198.9%
distribute-rgt-neg-in98.9%
distribute-lft-in98.9%
neg-mul-198.9%
sub-neg98.9%
*-commutative98.9%
associate-*l/98.9%
*-commutative98.9%
associate-*r/98.9%
sub-neg98.9%
neg-mul-198.9%
distribute-lft-in98.9%
neg-mul-198.9%
remove-double-neg98.9%
neg-mul-198.9%
remove-double-neg98.9%
+-commutative98.9%
Simplified98.9%
if -4.8e20 < z < 0.0264999999999999993Initial program 96.8%
Taylor expanded in z around 0 95.3%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.05e+29) (not (<= t 5.8e+24))) (* t (/ x (+ z -1.0))) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e+29) || !(t <= 5.8e+24)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x * (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.05d+29)) .or. (.not. (t <= 5.8d+24))) then
tmp = t * (x / (z + (-1.0d0)))
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.05e+29) || !(t <= 5.8e+24)) {
tmp = t * (x / (z + -1.0));
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.05e+29) or not (t <= 5.8e+24): tmp = t * (x / (z + -1.0)) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.05e+29) || !(t <= 5.8e+24)) tmp = Float64(t * Float64(x / Float64(z + -1.0))); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.05e+29) || ~((t <= 5.8e+24))) tmp = t * (x / (z + -1.0)); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.05e+29], N[Not[LessEqual[t, 5.8e+24]], $MachinePrecision]], N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{+29} \lor \neg \left(t \leq 5.8 \cdot 10^{+24}\right):\\
\;\;\;\;t \cdot \frac{x}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -1.0500000000000001e29 or 5.79999999999999958e24 < t Initial program 98.0%
Taylor expanded in y around 0 70.1%
mul-1-neg70.1%
associate-/l*65.7%
distribute-rgt-neg-in65.7%
distribute-neg-frac265.7%
neg-sub065.7%
associate--r-65.7%
metadata-eval65.7%
Simplified65.7%
if -1.0500000000000001e29 < t < 5.79999999999999958e24Initial program 97.7%
Taylor expanded in y around inf 87.8%
associate-*r/90.5%
Simplified90.5%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (<= z -1.05) (/ x (/ z (+ y t))) (if (<= z 0.0265) (* x (- (/ y z) t)) (* x (/ (+ y t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05) {
tmp = x / (z / (y + t));
} else if (z <= 0.0265) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-1.05d0)) then
tmp = x / (z / (y + t))
else if (z <= 0.0265d0) then
tmp = x * ((y / z) - t)
else
tmp = x * ((y + t) / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -1.05) {
tmp = x / (z / (y + t));
} else if (z <= 0.0265) {
tmp = x * ((y / z) - t);
} else {
tmp = x * ((y + t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -1.05: tmp = x / (z / (y + t)) elif z <= 0.0265: tmp = x * ((y / z) - t) else: tmp = x * ((y + t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -1.05) tmp = Float64(x / Float64(z / Float64(y + t))); elseif (z <= 0.0265) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(Float64(y + t) / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -1.05) tmp = x / (z / (y + t)); elseif (z <= 0.0265) tmp = x * ((y / z) - t); else tmp = x * ((y + t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -1.05], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0265], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y + t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05:\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{elif}\;z \leq 0.0265:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y + t}{z}\\
\end{array}
\end{array}
if z < -1.05000000000000004Initial program 98.1%
clear-num98.0%
associate-/r/98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 89.0%
associate-/l*98.1%
neg-mul-198.1%
sub-neg98.1%
remove-double-neg98.1%
Simplified98.1%
clear-num98.0%
un-div-inv98.3%
Applied egg-rr98.3%
if -1.05000000000000004 < z < 0.0264999999999999993Initial program 96.7%
Taylor expanded in z around 0 95.3%
if 0.0264999999999999993 < z Initial program 99.6%
Taylor expanded in z around inf 92.9%
associate-/l*99.6%
sub-neg99.6%
remove-double-neg99.6%
neg-mul-199.6%
distribute-rgt-neg-in99.6%
distribute-lft-in99.6%
neg-mul-199.6%
sub-neg99.6%
*-commutative99.6%
associate-*l/99.6%
*-commutative99.6%
associate-*r/99.6%
sub-neg99.6%
neg-mul-199.6%
distribute-lft-in99.6%
neg-mul-199.6%
remove-double-neg99.6%
neg-mul-199.6%
remove-double-neg99.6%
+-commutative99.6%
Simplified99.6%
Final simplification97.2%
(FPCore (x y z t) :precision binary64 (if (<= z -3.05e+29) (* x (/ t z)) (if (<= z 0.0265) (* x (- (/ y z) t)) (* x (/ y z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.05e+29) {
tmp = x * (t / z);
} else if (z <= 0.0265) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (y / 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 <= (-3.05d+29)) then
tmp = x * (t / z)
else if (z <= 0.0265d0) then
tmp = x * ((y / z) - t)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -3.05e+29) {
tmp = x * (t / z);
} else if (z <= 0.0265) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -3.05e+29: tmp = x * (t / z) elif z <= 0.0265: tmp = x * ((y / z) - t) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -3.05e+29) tmp = Float64(x * Float64(t / z)); elseif (z <= 0.0265) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -3.05e+29) tmp = x * (t / z); elseif (z <= 0.0265) tmp = x * ((y / z) - t); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -3.05e+29], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.0265], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.05 \cdot 10^{+29}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 0.0265:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if z < -3.0499999999999999e29Initial program 98.1%
Taylor expanded in y around 0 61.4%
mul-1-neg61.4%
distribute-neg-frac261.4%
neg-sub061.4%
associate--r-61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in z around inf 61.4%
if -3.0499999999999999e29 < z < 0.0264999999999999993Initial program 96.8%
Taylor expanded in z around 0 95.3%
if 0.0264999999999999993 < z Initial program 99.6%
Taylor expanded in y around inf 68.2%
associate-*r/72.2%
Simplified72.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.5e+185) (not (<= t 2.2e+100))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e+185) || !(t <= 2.2e+100)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.5d+185)) .or. (.not. (t <= 2.2d+100))) then
tmp = x * (t / z)
else
tmp = x * (y / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.5e+185) || !(t <= 2.2e+100)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.5e+185) or not (t <= 2.2e+100): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.5e+185) || !(t <= 2.2e+100)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.5e+185) || ~((t <= 2.2e+100))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.5e+185], N[Not[LessEqual[t, 2.2e+100]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.5 \cdot 10^{+185} \lor \neg \left(t \leq 2.2 \cdot 10^{+100}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -2.49999999999999995e185 or 2.2000000000000001e100 < t Initial program 99.7%
Taylor expanded in y around 0 80.8%
mul-1-neg80.8%
distribute-neg-frac280.8%
neg-sub080.8%
associate--r-80.8%
metadata-eval80.8%
Simplified80.8%
Taylor expanded in z around inf 63.1%
if -2.49999999999999995e185 < t < 2.2000000000000001e100Initial program 97.2%
Taylor expanded in y around inf 76.4%
associate-*r/77.9%
Simplified77.9%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e+20) (not (<= z 1.0))) (* x (/ t z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.8d+20)) .or. (.not. (z <= 1.0d0))) then
tmp = x * (t / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 1.0)) {
tmp = x * (t / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+20) or not (z <= 1.0): tmp = x * (t / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+20) || !(z <= 1.0)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e+20) || ~((z <= 1.0))) tmp = x * (t / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+20], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+20} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.8e20 or 1 < z Initial program 98.9%
Taylor expanded in y around 0 56.1%
mul-1-neg56.1%
distribute-neg-frac256.1%
neg-sub056.1%
associate--r-56.1%
metadata-eval56.1%
Simplified56.1%
Taylor expanded in z around inf 56.1%
if -4.8e20 < z < 1Initial program 96.8%
Taylor expanded in y around 0 35.8%
mul-1-neg35.8%
distribute-neg-frac235.8%
neg-sub035.8%
associate--r-35.8%
metadata-eval35.8%
Simplified35.8%
Taylor expanded in z around 0 34.4%
*-commutative34.4%
neg-mul-134.4%
distribute-rgt-neg-in34.4%
Simplified34.4%
Final simplification45.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.8e+20) (not (<= z 1.0))) (* t (/ x z)) (* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-4.8d+20)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = x * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.8e+20) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.8e+20) or not (z <= 1.0): tmp = t * (x / z) else: tmp = x * -t return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.8e+20) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(x * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.8e+20) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = x * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.8e+20], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * (-t)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{+20} \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -4.8e20 or 1 < z Initial program 98.9%
Taylor expanded in y around 0 56.1%
mul-1-neg56.1%
distribute-neg-frac256.1%
neg-sub056.1%
associate--r-56.1%
metadata-eval56.1%
Simplified56.1%
Taylor expanded in z around inf 52.4%
associate-/l*48.6%
Simplified48.6%
if -4.8e20 < z < 1Initial program 96.8%
Taylor expanded in y around 0 35.8%
mul-1-neg35.8%
distribute-neg-frac235.8%
neg-sub035.8%
associate--r-35.8%
metadata-eval35.8%
Simplified35.8%
Taylor expanded in z around 0 34.4%
*-commutative34.4%
neg-mul-134.4%
distribute-rgt-neg-in34.4%
Simplified34.4%
Final simplification41.6%
(FPCore (x y z t) :precision binary64 (* x (- t)))
double code(double x, double y, double z, double t) {
return x * -t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * -t
end function
public static double code(double x, double y, double z, double t) {
return x * -t;
}
def code(x, y, z, t): return x * -t
function code(x, y, z, t) return Float64(x * Float64(-t)) end
function tmp = code(x, y, z, t) tmp = x * -t; end
code[x_, y_, z_, t_] := N[(x * (-t)), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(-t\right)
\end{array}
Initial program 97.9%
Taylor expanded in y around 0 46.0%
mul-1-neg46.0%
distribute-neg-frac246.0%
neg-sub046.0%
associate--r-46.0%
metadata-eval46.0%
Simplified46.0%
Taylor expanded in z around 0 23.1%
*-commutative23.1%
neg-mul-123.1%
distribute-rgt-neg-in23.1%
Simplified23.1%
(FPCore (x y z t) :precision binary64 (* x t))
double code(double x, double y, double z, double t) {
return x * t;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x * t
end function
public static double code(double x, double y, double z, double t) {
return x * t;
}
def code(x, y, z, t): return x * t
function code(x, y, z, t) return Float64(x * t) end
function tmp = code(x, y, z, t) tmp = x * t; end
code[x_, y_, z_, t_] := N[(x * t), $MachinePrecision]
\begin{array}{l}
\\
x \cdot t
\end{array}
Initial program 97.9%
Taylor expanded in y around 0 46.0%
mul-1-neg46.0%
distribute-neg-frac246.0%
neg-sub046.0%
associate--r-46.0%
metadata-eval46.0%
Simplified46.0%
Taylor expanded in z around 0 23.1%
*-commutative23.1%
neg-mul-123.1%
distribute-rgt-neg-in23.1%
Simplified23.1%
add-sqr-sqrt12.5%
sqrt-unprod16.6%
sqr-neg16.6%
sqrt-unprod3.9%
add-sqr-sqrt7.5%
pow17.5%
Applied egg-rr7.5%
unpow17.5%
Simplified7.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 2024172
(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)))))