
(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 10 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 (- 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}
Initial program 95.4%
Final simplification95.4%
(FPCore (x y z t)
:precision binary64
(if (or (<= z -1.0)
(and (not (<= z -4.8e-286)) (or (<= z 1.8e-152) (not (<= z 1.0)))))
(* t (/ x z))
(* x (- t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || (!(z <= -4.8e-286) && ((z <= 1.8e-152) || !(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 <= (-1.0d0)) .or. (.not. (z <= (-4.8d-286))) .and. (z <= 1.8d-152) .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 <= -1.0) || (!(z <= -4.8e-286) && ((z <= 1.8e-152) || !(z <= 1.0)))) {
tmp = t * (x / z);
} else {
tmp = x * -t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or (not (z <= -4.8e-286) and ((z <= 1.8e-152) 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 <= -1.0) || (!(z <= -4.8e-286) && ((z <= 1.8e-152) || !(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 <= -1.0) || (~((z <= -4.8e-286)) && ((z <= 1.8e-152) || ~((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, -1.0], And[N[Not[LessEqual[z, -4.8e-286]], $MachinePrecision], Or[LessEqual[z, 1.8e-152], 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 -1 \lor \neg \left(z \leq -4.8 \cdot 10^{-286}\right) \land \left(z \leq 1.8 \cdot 10^{-152} \lor \neg \left(z \leq 1\right)\right):\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(-t\right)\\
\end{array}
\end{array}
if z < -1 or -4.79999999999999987e-286 < z < 1.8e-152 or 1 < z Initial program 94.6%
Taylor expanded in y around 0 49.7%
associate-*r/49.7%
associate-*r*49.7%
neg-mul-149.7%
associate-*l/50.7%
*-commutative50.7%
distribute-frac-neg50.7%
mul-1-neg50.7%
associate-*r/50.7%
*-commutative50.7%
associate-*r/50.7%
metadata-eval50.7%
associate-/r*50.7%
neg-mul-150.7%
associate-*r/50.7%
*-rgt-identity50.7%
neg-sub050.7%
associate--r-50.7%
metadata-eval50.7%
Simplified50.7%
Taylor expanded in z around inf 50.8%
associate-*r/47.7%
Simplified47.7%
if -1 < z < -4.79999999999999987e-286 or 1.8e-152 < z < 1Initial program 97.3%
Taylor expanded in y around 0 43.6%
associate-*r/43.6%
associate-*r*43.6%
neg-mul-143.6%
associate-*l/43.6%
*-commutative43.6%
distribute-frac-neg43.6%
mul-1-neg43.6%
associate-*r/43.6%
*-commutative43.6%
associate-*r/43.6%
metadata-eval43.6%
associate-/r*43.6%
neg-mul-143.6%
associate-*r/43.6%
*-rgt-identity43.6%
neg-sub043.6%
associate--r-43.6%
metadata-eval43.6%
Simplified43.6%
Taylor expanded in z around 0 41.8%
associate-*r*41.8%
neg-mul-141.8%
*-commutative41.8%
Simplified41.8%
Final simplification46.0%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- t))))
(if (<= z -1.0)
t_1
(if (<= z -2.25e-286)
t_2
(if (<= z 1.9e-152) (* t (/ x z)) (if (<= z 1.0) t_2 t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -2.25e-286) {
tmp = t_2;
} else if (z <= 1.9e-152) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = t_2;
} 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 * (t / z)
t_2 = x * -t
if (z <= (-1.0d0)) then
tmp = t_1
else if (z <= (-2.25d-286)) then
tmp = t_2
else if (z <= 1.9d-152) then
tmp = t * (x / z)
else if (z <= 1.0d0) then
tmp = t_2
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 t_2 = x * -t;
double tmp;
if (z <= -1.0) {
tmp = t_1;
} else if (z <= -2.25e-286) {
tmp = t_2;
} else if (z <= 1.9e-152) {
tmp = t * (x / z);
} else if (z <= 1.0) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) t_2 = x * -t tmp = 0 if z <= -1.0: tmp = t_1 elif z <= -2.25e-286: tmp = t_2 elif z <= 1.9e-152: tmp = t * (x / z) elif z <= 1.0: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) t_2 = Float64(x * Float64(-t)) tmp = 0.0 if (z <= -1.0) tmp = t_1; elseif (z <= -2.25e-286) tmp = t_2; elseif (z <= 1.9e-152) tmp = Float64(t * Float64(x / z)); elseif (z <= 1.0) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = x * (t / z); t_2 = x * -t; tmp = 0.0; if (z <= -1.0) tmp = t_1; elseif (z <= -2.25e-286) tmp = t_2; elseif (z <= 1.9e-152) tmp = t * (x / z); elseif (z <= 1.0) tmp = t_2; 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]}, Block[{t$95$2 = N[(x * (-t)), $MachinePrecision]}, If[LessEqual[z, -1.0], t$95$1, If[LessEqual[z, -2.25e-286], t$95$2, If[LessEqual[z, 1.9e-152], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.0], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
t_2 := x \cdot \left(-t\right)\\
\mathbf{if}\;z \leq -1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -2.25 \cdot 10^{-286}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-152}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 1:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 96.4%
Taylor expanded in y around 0 61.2%
associate-*r/61.2%
associate-*r*61.2%
neg-mul-161.2%
associate-*l/62.5%
*-commutative62.5%
distribute-frac-neg62.5%
mul-1-neg62.5%
associate-*r/62.5%
*-commutative62.5%
associate-*r/62.4%
metadata-eval62.4%
associate-/r*62.4%
neg-mul-162.4%
associate-*r/62.5%
*-rgt-identity62.5%
neg-sub062.5%
associate--r-62.5%
metadata-eval62.5%
Simplified62.5%
Taylor expanded in z around inf 60.3%
if -1 < z < -2.25000000000000003e-286 or 1.90000000000000006e-152 < z < 1Initial program 97.3%
Taylor expanded in y around 0 43.6%
associate-*r/43.6%
associate-*r*43.6%
neg-mul-143.6%
associate-*l/43.6%
*-commutative43.6%
distribute-frac-neg43.6%
mul-1-neg43.6%
associate-*r/43.6%
*-commutative43.6%
associate-*r/43.6%
metadata-eval43.6%
associate-/r*43.6%
neg-mul-143.6%
associate-*r/43.6%
*-rgt-identity43.6%
neg-sub043.6%
associate--r-43.6%
metadata-eval43.6%
Simplified43.6%
Taylor expanded in z around 0 41.8%
associate-*r*41.8%
neg-mul-141.8%
*-commutative41.8%
Simplified41.8%
if -2.25000000000000003e-286 < z < 1.90000000000000006e-152Initial program 87.9%
Taylor expanded in y around 0 7.9%
associate-*r/7.9%
associate-*r*7.9%
neg-mul-17.9%
associate-*l/7.9%
*-commutative7.9%
distribute-frac-neg7.9%
mul-1-neg7.9%
associate-*r/7.9%
*-commutative7.9%
associate-*r/7.9%
metadata-eval7.9%
associate-/r*7.9%
neg-mul-17.9%
associate-*r/7.9%
*-rgt-identity7.9%
neg-sub07.9%
associate--r-7.9%
metadata-eval7.9%
Simplified7.9%
Taylor expanded in z around inf 21.0%
associate-*r/33.2%
Simplified33.2%
Final simplification50.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))))
(if (<= z -33000000000.0)
t_1
(if (<= z 11.5)
(* x (- (/ y z) t))
(if (<= z 2e+66)
(* t (/ x z))
(if (<= z 7.6e+161) (* y (/ x z)) t_1))))))
double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -33000000000.0) {
tmp = t_1;
} else if (z <= 11.5) {
tmp = x * ((y / z) - t);
} else if (z <= 2e+66) {
tmp = t * (x / z);
} else if (z <= 7.6e+161) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = x * (t / z)
if (z <= (-33000000000.0d0)) then
tmp = t_1
else if (z <= 11.5d0) then
tmp = x * ((y / z) - t)
else if (z <= 2d+66) then
tmp = t * (x / z)
else if (z <= 7.6d+161) then
tmp = y * (x / z)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = x * (t / z);
double tmp;
if (z <= -33000000000.0) {
tmp = t_1;
} else if (z <= 11.5) {
tmp = x * ((y / z) - t);
} else if (z <= 2e+66) {
tmp = t * (x / z);
} else if (z <= 7.6e+161) {
tmp = y * (x / z);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = x * (t / z) tmp = 0 if z <= -33000000000.0: tmp = t_1 elif z <= 11.5: tmp = x * ((y / z) - t) elif z <= 2e+66: tmp = t * (x / z) elif z <= 7.6e+161: tmp = y * (x / z) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(x * Float64(t / z)) tmp = 0.0 if (z <= -33000000000.0) tmp = t_1; elseif (z <= 11.5) tmp = Float64(x * Float64(Float64(y / z) - t)); elseif (z <= 2e+66) tmp = Float64(t * Float64(x / z)); elseif (z <= 7.6e+161) tmp = Float64(y * Float64(x / z)); 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 <= -33000000000.0) tmp = t_1; elseif (z <= 11.5) tmp = x * ((y / z) - t); elseif (z <= 2e+66) tmp = t * (x / z); elseif (z <= 7.6e+161) tmp = y * (x / z); 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, -33000000000.0], t$95$1, If[LessEqual[z, 11.5], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2e+66], N[(t * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e+161], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot \frac{t}{z}\\
\mathbf{if}\;z \leq -33000000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq 11.5:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{elif}\;z \leq 2 \cdot 10^{+66}:\\
\;\;\;\;t \cdot \frac{x}{z}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{+161}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -3.3e10 or 7.6000000000000005e161 < z Initial program 95.8%
Taylor expanded in y around 0 65.6%
associate-*r/65.6%
associate-*r*65.6%
neg-mul-165.6%
associate-*l/67.7%
*-commutative67.7%
distribute-frac-neg67.7%
mul-1-neg67.7%
associate-*r/67.7%
*-commutative67.7%
associate-*r/67.6%
metadata-eval67.6%
associate-/r*67.6%
neg-mul-167.6%
associate-*r/67.7%
*-rgt-identity67.7%
neg-sub067.7%
associate--r-67.7%
metadata-eval67.7%
Simplified67.7%
Taylor expanded in z around inf 67.4%
if -3.3e10 < z < 11.5Initial program 94.5%
Taylor expanded in z around 0 86.6%
+-commutative86.6%
associate-*r/89.6%
*-commutative89.6%
associate-*r*89.6%
neg-mul-189.6%
distribute-rgt-out91.3%
unsub-neg91.3%
Simplified91.3%
if 11.5 < z < 1.99999999999999989e66Initial program 99.8%
Taylor expanded in y around 0 79.2%
associate-*r/79.2%
associate-*r*79.2%
neg-mul-179.2%
associate-*l/79.2%
*-commutative79.2%
distribute-frac-neg79.2%
mul-1-neg79.2%
associate-*r/79.2%
*-commutative79.2%
associate-*r/78.8%
metadata-eval78.8%
associate-/r*78.8%
neg-mul-178.8%
associate-*r/79.2%
*-rgt-identity79.2%
neg-sub079.2%
associate--r-79.2%
metadata-eval79.2%
Simplified79.2%
Taylor expanded in z around inf 73.1%
associate-*r/73.2%
Simplified73.2%
if 1.99999999999999989e66 < z < 7.6000000000000005e161Initial program 95.8%
Taylor expanded in y around inf 45.6%
associate-/l*62.9%
associate-/r/63.2%
Simplified63.2%
Final simplification78.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.45e+157) (not (<= t 8.8e+86))) (* x (/ t (+ z -1.0))) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.8e+86)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.45d+157)) .or. (.not. (t <= 8.8d+86))) then
tmp = x * (t / (z + (-1.0d0)))
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.8e+86)) {
tmp = x * (t / (z + -1.0));
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.45e+157) or not (t <= 8.8e+86): tmp = x * (t / (z + -1.0)) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.45e+157) || !(t <= 8.8e+86)) tmp = Float64(x * Float64(t / Float64(z + -1.0))); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.45e+157) || ~((t <= 8.8e+86))) tmp = x * (t / (z + -1.0)); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.45e+157], N[Not[LessEqual[t, 8.8e+86]], $MachinePrecision]], N[(x * N[(t / N[(z + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+157} \lor \neg \left(t \leq 8.8 \cdot 10^{+86}\right):\\
\;\;\;\;x \cdot \frac{t}{z + -1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.4500000000000001e157 or 8.80000000000000013e86 < t Initial program 96.2%
Taylor expanded in y around 0 76.7%
associate-*r/76.7%
associate-*r*76.7%
neg-mul-176.7%
associate-*l/82.8%
*-commutative82.8%
distribute-frac-neg82.8%
mul-1-neg82.8%
associate-*r/82.8%
*-commutative82.8%
associate-*r/82.7%
metadata-eval82.7%
associate-/r*82.7%
neg-mul-182.7%
associate-*r/82.8%
*-rgt-identity82.8%
neg-sub082.8%
associate--r-82.8%
metadata-eval82.8%
Simplified82.8%
if -2.4500000000000001e157 < t < 8.80000000000000013e86Initial program 95.0%
Taylor expanded in z around inf 78.9%
associate-/l*79.6%
cancel-sign-sub-inv79.6%
metadata-eval79.6%
*-lft-identity79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in t around 0 78.1%
Final simplification79.5%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.96) (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.96) || !(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.96d0)) .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.96) || !(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.96) 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.96) || !(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.96) || ~((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.96], 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.96 \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.95999999999999996 or 1 < z Initial program 96.4%
Taylor expanded in z around inf 88.5%
associate-/l*94.2%
associate-/r/82.4%
cancel-sign-sub-inv82.4%
metadata-eval82.4%
*-lft-identity82.4%
+-commutative82.4%
Simplified82.4%
if -0.95999999999999996 < z < 1Initial program 94.1%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
associate-*r/91.1%
*-commutative91.1%
associate-*r*91.1%
neg-mul-191.1%
distribute-rgt-out92.9%
unsub-neg92.9%
Simplified92.9%
Final simplification87.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.0))) (/ x (/ z (+ y t))) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} 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 <= (-1.0d0)) .or. (.not. (z <= 1.0d0))) then
tmp = x / (z / (y + t))
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 <= -1.0) || !(z <= 1.0)) {
tmp = x / (z / (y + t));
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.0): tmp = x / (z / (y + t)) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.0)) tmp = Float64(x / Float64(z / Float64(y + t))); 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 <= -1.0) || ~((z <= 1.0))) tmp = x / (z / (y + t)); else tmp = x * ((y / z) - t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.0]], $MachinePrecision]], N[(x / N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1\right):\\
\;\;\;\;\frac{x}{\frac{z}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 1 < z Initial program 96.4%
Taylor expanded in z around inf 88.5%
associate-/l*94.2%
cancel-sign-sub-inv94.2%
metadata-eval94.2%
*-lft-identity94.2%
+-commutative94.2%
Simplified94.2%
if -1 < z < 1Initial program 94.1%
Taylor expanded in z around 0 88.0%
+-commutative88.0%
associate-*r/91.1%
*-commutative91.1%
associate-*r*91.1%
neg-mul-191.1%
distribute-rgt-out92.9%
unsub-neg92.9%
Simplified92.9%
Final simplification93.6%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.45e+157) (not (<= t 8.2e+102))) (* x (/ t z)) (* x (/ y z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.45e+157) || !(t <= 8.2e+102)) {
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.45d+157)) .or. (.not. (t <= 8.2d+102))) 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.45e+157) || !(t <= 8.2e+102)) {
tmp = x * (t / z);
} else {
tmp = x * (y / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.45e+157) or not (t <= 8.2e+102): tmp = x * (t / z) else: tmp = x * (y / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.45e+157) || !(t <= 8.2e+102)) 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.45e+157) || ~((t <= 8.2e+102))) tmp = x * (t / z); else tmp = x * (y / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.45e+157], N[Not[LessEqual[t, 8.2e+102]], $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.45 \cdot 10^{+157} \lor \neg \left(t \leq 8.2 \cdot 10^{+102}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y}{z}\\
\end{array}
\end{array}
if t < -2.4500000000000001e157 or 8.1999999999999999e102 < t Initial program 96.0%
Taylor expanded in y around 0 77.3%
associate-*r/77.3%
associate-*r*77.3%
neg-mul-177.3%
associate-*l/83.8%
*-commutative83.8%
distribute-frac-neg83.8%
mul-1-neg83.8%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.7%
metadata-eval83.7%
associate-/r*83.7%
neg-mul-183.7%
associate-*r/83.8%
*-rgt-identity83.8%
neg-sub083.8%
associate--r-83.8%
metadata-eval83.8%
Simplified83.8%
Taylor expanded in z around inf 73.1%
if -2.4500000000000001e157 < t < 8.1999999999999999e102Initial program 95.1%
Taylor expanded in y around inf 70.7%
associate-*r/76.5%
Simplified76.5%
Final simplification75.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.65e+157) (not (<= t 1.36e+103))) (* x (/ t z)) (/ x (/ z y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+157) || !(t <= 1.36e+103)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.65d+157)) .or. (.not. (t <= 1.36d+103))) then
tmp = x * (t / z)
else
tmp = x / (z / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.65e+157) || !(t <= 1.36e+103)) {
tmp = x * (t / z);
} else {
tmp = x / (z / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.65e+157) or not (t <= 1.36e+103): tmp = x * (t / z) else: tmp = x / (z / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.65e+157) || !(t <= 1.36e+103)) tmp = Float64(x * Float64(t / z)); else tmp = Float64(x / Float64(z / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.65e+157) || ~((t <= 1.36e+103))) tmp = x * (t / z); else tmp = x / (z / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.65e+157], N[Not[LessEqual[t, 1.36e+103]], $MachinePrecision]], N[(x * N[(t / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(z / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.65 \cdot 10^{+157} \lor \neg \left(t \leq 1.36 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot \frac{t}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z}{y}}\\
\end{array}
\end{array}
if t < -2.6499999999999999e157 or 1.36e103 < t Initial program 96.0%
Taylor expanded in y around 0 77.3%
associate-*r/77.3%
associate-*r*77.3%
neg-mul-177.3%
associate-*l/83.8%
*-commutative83.8%
distribute-frac-neg83.8%
mul-1-neg83.8%
associate-*r/83.8%
*-commutative83.8%
associate-*r/83.7%
metadata-eval83.7%
associate-/r*83.7%
neg-mul-183.7%
associate-*r/83.8%
*-rgt-identity83.8%
neg-sub083.8%
associate--r-83.8%
metadata-eval83.8%
Simplified83.8%
Taylor expanded in z around inf 73.1%
if -2.6499999999999999e157 < t < 1.36e103Initial program 95.1%
Taylor expanded in z around inf 78.4%
associate-/l*79.1%
cancel-sign-sub-inv79.1%
metadata-eval79.1%
*-lft-identity79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in t around 0 76.9%
Final simplification75.8%
(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 95.4%
Taylor expanded in y around 0 47.9%
associate-*r/47.9%
associate-*r*47.9%
neg-mul-147.9%
associate-*l/48.6%
*-commutative48.6%
distribute-frac-neg48.6%
mul-1-neg48.6%
associate-*r/48.6%
*-commutative48.6%
associate-*r/48.6%
metadata-eval48.6%
associate-/r*48.6%
neg-mul-148.6%
associate-*r/48.6%
*-rgt-identity48.6%
neg-sub048.6%
associate--r-48.6%
metadata-eval48.6%
Simplified48.6%
Taylor expanded in z around 0 20.1%
associate-*r*20.1%
neg-mul-120.1%
*-commutative20.1%
Simplified20.1%
Final simplification20.1%
(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 2024036
(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)))))