
(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 94.5%
Final simplification94.5%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))) (t_2 (* t (/ x z))))
(if (<= t -3.5e-24)
(* y (/ x z))
(if (<= t 3.5e+28)
t_1
(if (<= t 1.95e+198)
t_2
(if (<= t 1.6e+218) t_1 (if (<= t 3.3e+247) (* t (- x)) t_2)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double t_2 = t * (x / z);
double tmp;
if (t <= -3.5e-24) {
tmp = y * (x / z);
} else if (t <= 3.5e+28) {
tmp = t_1;
} else if (t <= 1.95e+198) {
tmp = t_2;
} else if (t <= 1.6e+218) {
tmp = t_1;
} else if (t <= 3.3e+247) {
tmp = t * -x;
} 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 = x * (y / z)
t_2 = t * (x / z)
if (t <= (-3.5d-24)) then
tmp = y * (x / z)
else if (t <= 3.5d+28) then
tmp = t_1
else if (t <= 1.95d+198) then
tmp = t_2
else if (t <= 1.6d+218) then
tmp = t_1
else if (t <= 3.3d+247) then
tmp = t * -x
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 = x * (y / z);
double t_2 = t * (x / z);
double tmp;
if (t <= -3.5e-24) {
tmp = y * (x / z);
} else if (t <= 3.5e+28) {
tmp = t_1;
} else if (t <= 1.95e+198) {
tmp = t_2;
} else if (t <= 1.6e+218) {
tmp = t_1;
} else if (t <= 3.3e+247) {
tmp = t * -x;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) t_2 = t * (x / z) tmp = 0 if t <= -3.5e-24: tmp = y * (x / z) elif t <= 3.5e+28: tmp = t_1 elif t <= 1.95e+198: tmp = t_2 elif t <= 1.6e+218: tmp = t_1 elif t <= 3.3e+247: tmp = t * -x else: tmp = t_2 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) t_2 = Float64(t * Float64(x / z)) tmp = 0.0 if (t <= -3.5e-24) tmp = Float64(y * Float64(x / z)); elseif (t <= 3.5e+28) tmp = t_1; elseif (t <= 1.95e+198) tmp = t_2; elseif (t <= 1.6e+218) tmp = t_1; elseif (t <= 3.3e+247) tmp = Float64(t * Float64(-x)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (y / z); t_2 = t * (x / z); tmp = 0.0; if (t <= -3.5e-24) tmp = y * (x / z); elseif (t <= 3.5e+28) tmp = t_1; elseif (t <= 1.95e+198) tmp = t_2; elseif (t <= 1.6e+218) tmp = t_1; elseif (t <= 3.3e+247) tmp = t * -x; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -3.5e-24], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.5e+28], t$95$1, If[LessEqual[t, 1.95e+198], t$95$2, If[LessEqual[t, 1.6e+218], t$95$1, If[LessEqual[t, 3.3e+247], N[(t * (-x)), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
t_2 := t \cdot \frac{x}{z}\\
\mathbf{if}\;t \leq -3.5 \cdot 10^{-24}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 3.5 \cdot 10^{+28}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+198}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+218}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.3 \cdot 10^{+247}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if t < -3.4999999999999996e-24Initial program 94.4%
Taylor expanded in y around inf 43.2%
*-commutative43.2%
associate-/l*46.7%
Simplified46.7%
if -3.4999999999999996e-24 < t < 3.5e28 or 1.95e198 < t < 1.59999999999999994e218Initial program 95.9%
Taylor expanded in y around inf 83.0%
associate-*r/89.0%
Simplified89.0%
if 3.5e28 < t < 1.95e198 or 3.30000000000000001e247 < t Initial program 89.8%
Taylor expanded in y around 0 59.2%
associate-*r/59.2%
associate-*r*59.2%
neg-mul-159.2%
Simplified59.2%
Taylor expanded in z around inf 50.4%
*-commutative50.4%
Simplified50.4%
*-commutative50.4%
associate-/l*54.8%
Applied egg-rr54.8%
if 1.59999999999999994e218 < t < 3.30000000000000001e247Initial program 100.0%
Taylor expanded in z around 0 71.7%
+-commutative71.7%
associate-*r/71.7%
*-commutative71.7%
associate-*r*71.7%
neg-mul-171.7%
distribute-rgt-out71.7%
unsub-neg71.7%
Simplified71.7%
Taylor expanded in y around 0 71.7%
mul-1-neg71.7%
*-commutative71.7%
distribute-rgt-neg-in71.7%
Simplified71.7%
Final simplification70.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* t (/ x (+ z -1.0)))))
(if (<= y -35000000000000.0)
(/ y (/ z x))
(if (<= y 4.1e-79)
t_1
(if (<= y 4.5e-60)
(/ x (/ z y))
(if (<= y 2.65e-25) t_1 (/ (* x y) z)))))))
double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z + -1.0));
double tmp;
if (y <= -35000000000000.0) {
tmp = y / (z / x);
} else if (y <= 4.1e-79) {
tmp = t_1;
} else if (y <= 4.5e-60) {
tmp = x / (z / y);
} else if (y <= 2.65e-25) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = t * (x / (z + (-1.0d0)))
if (y <= (-35000000000000.0d0)) then
tmp = y / (z / x)
else if (y <= 4.1d-79) then
tmp = t_1
else if (y <= 4.5d-60) then
tmp = x / (z / y)
else if (y <= 2.65d-25) then
tmp = t_1
else
tmp = (x * y) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = t * (x / (z + -1.0));
double tmp;
if (y <= -35000000000000.0) {
tmp = y / (z / x);
} else if (y <= 4.1e-79) {
tmp = t_1;
} else if (y <= 4.5e-60) {
tmp = x / (z / y);
} else if (y <= 2.65e-25) {
tmp = t_1;
} else {
tmp = (x * y) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = t * (x / (z + -1.0)) tmp = 0 if y <= -35000000000000.0: tmp = y / (z / x) elif y <= 4.1e-79: tmp = t_1 elif y <= 4.5e-60: tmp = x / (z / y) elif y <= 2.65e-25: tmp = t_1 else: tmp = (x * y) / z return tmp
function code(x, y, z, t) t_1 = Float64(t * Float64(x / Float64(z + -1.0))) tmp = 0.0 if (y <= -35000000000000.0) tmp = Float64(y / Float64(z / x)); elseif (y <= 4.1e-79) tmp = t_1; elseif (y <= 4.5e-60) tmp = Float64(x / Float64(z / y)); elseif (y <= 2.65e-25) tmp = t_1; else tmp = Float64(Float64(x * y) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = t * (x / (z + -1.0)); tmp = 0.0; if (y <= -35000000000000.0) tmp = y / (z / x); elseif (y <= 4.1e-79) tmp = t_1; elseif (y <= 4.5e-60) tmp = x / (z / y); elseif (y <= 2.65e-25) tmp = t_1; else tmp = (x * y) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(t * N[(x / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -35000000000000.0], N[(y / N[(z / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.1e-79], t$95$1, If[LessEqual[y, 4.5e-60], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.65e-25], t$95$1, N[(N[(x * y), $MachinePrecision] / z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{x}{z + -1}\\
\mathbf{if}\;y \leq -35000000000000:\\
\;\;\;\;\frac{y}{\frac{z}{x}}\\
\mathbf{elif}\;y \leq 4.1 \cdot 10^{-79}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-60}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\mathbf{elif}\;y \leq 2.65 \cdot 10^{-25}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot y}{z}\\
\end{array}
\end{array}
if y < -3.5e13Initial program 90.4%
Taylor expanded in y around inf 78.5%
associate-*r/78.9%
Simplified78.9%
clear-num78.7%
un-div-inv78.7%
Applied egg-rr78.7%
associate-/r/80.6%
Simplified80.6%
*-commutative80.6%
clear-num80.4%
un-div-inv80.6%
Applied egg-rr80.6%
if -3.5e13 < y < 4.09999999999999994e-79 or 4.50000000000000001e-60 < y < 2.6499999999999998e-25Initial program 96.3%
clear-num96.3%
frac-sub61.0%
*-un-lft-identity61.0%
Applied egg-rr61.0%
div-sub61.0%
times-frac68.5%
*-inverses96.3%
*-lft-identity96.3%
remove-double-neg96.3%
distribute-frac-neg96.3%
*-lft-identity96.3%
distribute-rgt-neg-in96.3%
*-inverses68.5%
distribute-neg-frac268.5%
times-frac61.0%
sub-neg61.0%
*-commutative61.0%
associate-/r*61.0%
*-inverses61.0%
Simplified96.3%
Taylor expanded in y around 0 71.3%
sub-neg71.3%
metadata-eval71.3%
associate-/l*69.9%
Simplified69.9%
if 4.09999999999999994e-79 < y < 4.50000000000000001e-60Initial program 99.6%
Taylor expanded in y around inf 87.1%
associate-*r/87.1%
Simplified87.1%
clear-num87.3%
un-div-inv87.3%
Applied egg-rr87.3%
if 2.6499999999999998e-25 < y Initial program 94.0%
Taylor expanded in y around inf 83.6%
Final simplification76.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= t -2.35e+206)
t_1
(if (<= t -1.55e+141)
(* y (/ x z))
(if (or (<= t -2.7e+90) (not (<= t 3.7e+28))) t_1 (* x (/ y z)))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (t <= -2.35e+206) {
tmp = t_1;
} else if (t <= -1.55e+141) {
tmp = y * (x / z);
} else if ((t <= -2.7e+90) || !(t <= 3.7e+28)) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (t <= (-2.35d+206)) then
tmp = t_1
else if (t <= (-1.55d+141)) then
tmp = y * (x / z)
else if ((t <= (-2.7d+90)) .or. (.not. (t <= 3.7d+28))) then
tmp = t_1
else
tmp = x * (y / z)
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 <= -2.35e+206) {
tmp = t_1;
} else if (t <= -1.55e+141) {
tmp = y * (x / z);
} else if ((t <= -2.7e+90) || !(t <= 3.7e+28)) {
tmp = t_1;
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if t <= -2.35e+206: tmp = t_1 elif t <= -1.55e+141: tmp = y * (x / z) elif (t <= -2.7e+90) or not (t <= 3.7e+28): tmp = t_1 else: tmp = x * (y / z) return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (t <= -2.35e+206) tmp = t_1; elseif (t <= -1.55e+141) tmp = Float64(y * Float64(x / z)); elseif ((t <= -2.7e+90) || !(t <= 3.7e+28)) tmp = t_1; else tmp = Float64(x * Float64(y / z)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); tmp = 0.0; if (t <= -2.35e+206) tmp = t_1; elseif (t <= -1.55e+141) tmp = y * (x / z); elseif ((t <= -2.7e+90) || ~((t <= 3.7e+28))) tmp = t_1; else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.35e+206], t$95$1, If[LessEqual[t, -1.55e+141], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -2.7e+90], N[Not[LessEqual[t, 3.7e+28]], $MachinePrecision]], t$95$1, N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;t \leq -2.35 \cdot 10^{+206}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -1.55 \cdot 10^{+141}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq -2.7 \cdot 10^{+90} \lor \neg \left(t \leq 3.7 \cdot 10^{+28}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -2.3499999999999999e206 or -1.55000000000000002e141 < t < -2.7e90 or 3.6999999999999999e28 < t Initial program 94.2%
Taylor expanded in y around 0 65.6%
associate-*r/65.6%
associate-*r*65.6%
neg-mul-165.6%
Simplified65.6%
Taylor expanded in z around inf 52.6%
*-rgt-identity52.6%
times-frac60.4%
/-rgt-identity60.4%
Simplified60.4%
if -2.3499999999999999e206 < t < -1.55000000000000002e141Initial program 95.0%
Taylor expanded in y around inf 43.0%
*-commutative43.0%
associate-/l*52.3%
Simplified52.3%
if -2.7e90 < t < 3.6999999999999999e28Initial program 94.6%
Taylor expanded in y around inf 80.6%
associate-*r/83.4%
Simplified83.4%
Final simplification73.4%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ y z))))
(if (<= y -2e-121)
t_1
(if (<= y 3.05e-227)
(* t (/ x z))
(if (<= y 8.5e-153) (* t (- x)) t_1)))))
double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (y <= -2e-121) {
tmp = t_1;
} else if (y <= 3.05e-227) {
tmp = t * (x / z);
} else if (y <= 8.5e-153) {
tmp = t * -x;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (y / z)
if (y <= (-2d-121)) then
tmp = t_1
else if (y <= 3.05d-227) then
tmp = t * (x / z)
else if (y <= 8.5d-153) then
tmp = t * -x
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (y / z);
double tmp;
if (y <= -2e-121) {
tmp = t_1;
} else if (y <= 3.05e-227) {
tmp = t * (x / z);
} else if (y <= 8.5e-153) {
tmp = t * -x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (y / z) tmp = 0 if y <= -2e-121: tmp = t_1 elif y <= 3.05e-227: tmp = t * (x / z) elif y <= 8.5e-153: tmp = t * -x else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(y / z)) tmp = 0.0 if (y <= -2e-121) tmp = t_1; elseif (y <= 3.05e-227) tmp = Float64(t * Float64(x / z)); elseif (y <= 8.5e-153) tmp = Float64(t * Float64(-x)); 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 <= -2e-121) tmp = t_1; elseif (y <= 3.05e-227) tmp = t * (x / z); elseif (y <= 8.5e-153) tmp = t * -x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2e-121], t$95$1, If[LessEqual[y, 3.05e-227], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 8.5e-153], N[(t * (-x)), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{y}{z}\\
\mathbf{if}\;y \leq -2 \cdot 10^{-121}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.05 \cdot 10^{-227}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{-153}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -2e-121 or 8.4999999999999996e-153 < y Initial program 94.6%
Taylor expanded in y around inf 72.5%
associate-*r/72.3%
Simplified72.3%
if -2e-121 < y < 3.0500000000000001e-227Initial program 92.6%
Taylor expanded in y around 0 74.6%
associate-*r/74.6%
associate-*r*74.6%
neg-mul-174.6%
Simplified74.6%
Taylor expanded in z around inf 56.5%
*-commutative56.5%
Simplified56.5%
*-commutative56.5%
associate-/l*56.9%
Applied egg-rr56.9%
if 3.0500000000000001e-227 < y < 8.4999999999999996e-153Initial program 99.8%
Taylor expanded in z around 0 78.6%
+-commutative78.6%
associate-*r/78.7%
*-commutative78.7%
associate-*r*78.7%
neg-mul-178.7%
distribute-rgt-out78.7%
unsub-neg78.7%
Simplified78.7%
Taylor expanded in y around 0 61.0%
mul-1-neg61.0%
*-commutative61.0%
distribute-rgt-neg-in61.0%
Simplified61.0%
Final simplification68.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.4e+51) (not (<= t 2.6e+27))) (* x (/ t (+ z -1.0))) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.4e+51) || !(t <= 2.6e+27)) {
tmp = x * (t / (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.4d+51)) .or. (.not. (t <= 2.6d+27))) then
tmp = x * (t / (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.4e+51) || !(t <= 2.6e+27)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.4e+51) or not (t <= 2.6e+27): tmp = x * (t / (z + -1.0)) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.4e+51) || !(t <= 2.6e+27)) tmp = Float64(x * Float64(t / 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.4e+51) || ~((t <= 2.6e+27))) tmp = x * (t / (z + -1.0)); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.4e+51], N[Not[LessEqual[t, 2.6e+27]], $MachinePrecision]], N[(x * N[(t / 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.4 \cdot 10^{+51} \lor \neg \left(t \leq 2.6 \cdot 10^{+27}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -1.40000000000000002e51 or 2.60000000000000009e27 < t Initial program 94.7%
Taylor expanded in y around 0 63.5%
mul-1-neg63.5%
*-commutative63.5%
associate-/l*70.3%
distribute-rgt-neg-out70.3%
distribute-neg-frac270.3%
neg-sub070.3%
associate--r-70.3%
metadata-eval70.3%
Simplified70.3%
if -1.40000000000000002e51 < t < 2.60000000000000009e27Initial program 94.3%
Taylor expanded in y around inf 82.3%
associate-*r/85.3%
Simplified85.3%
Final simplification78.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.88) (not (<= z 1.0))) (* (+ y t) (/ x z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.88) || !(z <= 1.0)) {
tmp = (y + t) * (x / 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 <= (-0.88d0)) .or. (.not. (z <= 1.0d0))) then
tmp = (y + t) * (x / 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 <= -0.88) || !(z <= 1.0)) {
tmp = (y + t) * (x / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.88) or not (z <= 1.0): tmp = (y + t) * (x / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.88) || !(z <= 1.0)) tmp = Float64(Float64(y + t) * Float64(x / 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 <= -0.88) || ~((z <= 1.0))) tmp = (y + t) * (x / z); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.88], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.88 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -0.880000000000000004 or 1 < z Initial program 96.4%
Taylor expanded in z around inf 86.1%
*-commutative86.1%
associate-/l*82.8%
cancel-sign-sub-inv82.8%
metadata-eval82.8%
*-lft-identity82.8%
+-commutative82.8%
Simplified82.8%
if -0.880000000000000004 < z < 1Initial program 92.6%
Taylor expanded in z around 0 90.5%
+-commutative90.5%
associate-*r/86.9%
*-commutative86.9%
associate-*r*86.9%
neg-mul-186.9%
distribute-rgt-out91.5%
unsub-neg91.5%
Simplified91.5%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (<= z -2.1e+128) (* x (/ y z)) (if (<= z 1.3e+19) (* x (- (/ y z) t)) (* x (/ t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.1e+128) {
tmp = x * (y / z);
} else if (z <= 1.3e+19) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-2.1d+128)) then
tmp = x * (y / z)
else if (z <= 1.3d+19) then
tmp = x * ((y / z) - t)
else
tmp = x * (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -2.1e+128) {
tmp = x * (y / z);
} else if (z <= 1.3e+19) {
tmp = x * ((y / z) - t);
} else {
tmp = x * (t / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -2.1e+128: tmp = x * (y / z) elif z <= 1.3e+19: tmp = x * ((y / z) - t) else: tmp = x * (t / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -2.1e+128) tmp = Float64(x * Float64(y / z)); elseif (z <= 1.3e+19) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(x * Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -2.1e+128) tmp = x * (y / z); elseif (z <= 1.3e+19) tmp = x * ((y / z) - t); else tmp = x * (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -2.1e+128], N[(x * N[(y / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.3e+19], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{+128}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\mathbf{elif}\;z \leq 1.3 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{t}{z}\\
\end{array}
\end{array}
if z < -2.1e128Initial program 97.0%
Taylor expanded in y around inf 49.1%
associate-*r/61.8%
Simplified61.8%
if -2.1e128 < z < 1.3e19Initial program 93.9%
Taylor expanded in z around 0 86.4%
+-commutative86.4%
associate-*r/83.5%
*-commutative83.5%
associate-*r*83.5%
neg-mul-183.5%
distribute-rgt-out87.3%
unsub-neg87.3%
Simplified87.3%
if 1.3e19 < z Initial program 94.6%
Taylor expanded in y around 0 61.2%
associate-*r/61.2%
associate-*r*61.2%
neg-mul-161.2%
Simplified61.2%
Taylor expanded in z around inf 61.2%
*-rgt-identity61.2%
times-frac65.4%
/-rgt-identity65.4%
Simplified65.4%
Final simplification78.5%
(FPCore (x y z t) :precision binary64 (if (<= z -0.92) (/ (* x (+ y t)) z) (if (<= z 1.0) (* x (- (/ y z) t)) (* (+ y t) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.92) {
tmp = (x * (y + t)) / z;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (y + t) * (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 <= (-0.92d0)) then
tmp = (x * (y + t)) / z
else if (z <= 1.0d0) then
tmp = x * ((y / z) - t)
else
tmp = (y + t) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.92) {
tmp = (x * (y + t)) / z;
} else if (z <= 1.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (y + t) * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.92: tmp = (x * (y + t)) / z elif z <= 1.0: tmp = x * ((y / z) - t) else: tmp = (y + t) * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.92) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (z <= 1.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(y + t) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.92) tmp = (x * (y + t)) / z; elseif (z <= 1.0) tmp = x * ((y / z) - t); else tmp = (y + t) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.92], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 1.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(y + t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.92:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -0.92000000000000004Initial program 98.0%
clear-num97.9%
frac-sub57.9%
*-un-lft-identity57.9%
Applied egg-rr57.9%
div-sub57.9%
times-frac64.6%
*-inverses86.7%
*-lft-identity86.7%
remove-double-neg86.7%
distribute-frac-neg86.7%
*-lft-identity86.7%
distribute-rgt-neg-in86.7%
*-inverses64.6%
distribute-neg-frac264.6%
times-frac57.9%
sub-neg57.9%
*-commutative57.9%
associate-/r*69.1%
*-inverses69.1%
Simplified97.9%
Taylor expanded in z around inf 83.5%
if -0.92000000000000004 < z < 1Initial program 92.6%
Taylor expanded in z around 0 90.5%
+-commutative90.5%
associate-*r/86.9%
*-commutative86.9%
associate-*r*86.9%
neg-mul-186.9%
distribute-rgt-out91.5%
unsub-neg91.5%
Simplified91.5%
if 1 < z Initial program 95.0%
Taylor expanded in z around inf 88.4%
*-commutative88.4%
associate-/l*89.3%
cancel-sign-sub-inv89.3%
metadata-eval89.3%
*-lft-identity89.3%
+-commutative89.3%
Simplified89.3%
Final simplification89.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (* t (/ x z)) (* t (- x))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = t * (x / z)
else
tmp = t * -x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = t * (x / z);
} else {
tmp = t * -x;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = t * (x / z) else: tmp = t * -x return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(t * Float64(x / z)); else tmp = Float64(t * Float64(-x)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.0))) tmp = t * (x / z); else tmp = t * -x; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(t * (-x)), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-x\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 96.4%
Taylor expanded in y around 0 53.6%
associate-*r/53.6%
associate-*r*53.6%
neg-mul-153.6%
Simplified53.6%
Taylor expanded in z around inf 52.7%
*-commutative52.7%
Simplified52.7%
*-commutative52.7%
associate-/l*49.3%
Applied egg-rr49.3%
if -1 < z < 1Initial program 92.6%
Taylor expanded in z around 0 90.5%
+-commutative90.5%
associate-*r/86.9%
*-commutative86.9%
associate-*r*86.9%
neg-mul-186.9%
distribute-rgt-out91.5%
unsub-neg91.5%
Simplified91.5%
Taylor expanded in y around 0 32.4%
mul-1-neg32.4%
*-commutative32.4%
distribute-rgt-neg-in32.4%
Simplified32.4%
Final simplification40.7%
(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(t * Float64(-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}
\\
t \cdot \left(-x\right)
\end{array}
Initial program 94.5%
Taylor expanded in z around 0 63.4%
+-commutative63.4%
associate-*r/62.6%
*-commutative62.6%
associate-*r*62.6%
neg-mul-162.6%
distribute-rgt-out64.9%
unsub-neg64.9%
Simplified64.9%
Taylor expanded in y around 0 21.9%
mul-1-neg21.9%
*-commutative21.9%
distribute-rgt-neg-in21.9%
Simplified21.9%
Final simplification21.9%
(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 2024067
(FPCore (x y z t)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, C"
:precision binary64
:herbie-target
(if (< (* x (- (/ y z) (/ t (- 1.0 z)))) -7.623226303312042e-196) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z))))) (if (< (* x (- (/ y z) (/ t (- 1.0 z)))) 1.4133944927702302e-211) (+ (/ (* y x) z) (- (/ (* t x) (- 1.0 z)))) (* x (- (/ y z) (* t (/ 1.0 (- 1.0 z)))))))
(* x (- (/ y z) (/ t (- 1.0 z)))))