
(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 (let* ((t_1 (- (/ y z) (/ t (- 1.0 z))))) (if (<= t_1 2e+305) (* x t_1) (/ (* y x) z))))
double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 2e+305) {
tmp = x * t_1;
} else {
tmp = (y * x) / z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = (y / z) - (t / (1.0d0 - z))
if (t_1 <= 2d+305) then
tmp = x * t_1
else
tmp = (y * x) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (y / z) - (t / (1.0 - z));
double tmp;
if (t_1 <= 2e+305) {
tmp = x * t_1;
} else {
tmp = (y * x) / z;
}
return tmp;
}
def code(x, y, z, t): t_1 = (y / z) - (t / (1.0 - z)) tmp = 0 if t_1 <= 2e+305: tmp = x * t_1 else: tmp = (y * x) / z return tmp
function code(x, y, z, t) t_1 = Float64(Float64(y / z) - Float64(t / Float64(1.0 - z))) tmp = 0.0 if (t_1 <= 2e+305) tmp = Float64(x * t_1); else tmp = Float64(Float64(y * x) / z); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (y / z) - (t / (1.0 - z)); tmp = 0.0; if (t_1 <= 2e+305) tmp = x * t_1; else tmp = (y * x) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(y / z), $MachinePrecision] - N[(t / N[(1.0 - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+305], N[(x * t$95$1), $MachinePrecision], N[(N[(y * x), $MachinePrecision] / z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{z} - \frac{t}{1 - z}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+305}:\\
\;\;\;\;x \cdot t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{y \cdot x}{z}\\
\end{array}
\end{array}
if (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) < 1.9999999999999999e305Initial program 96.8%
if 1.9999999999999999e305 < (-.f64 (/.f64 y z) (/.f64 t (-.f64 #s(literal 1 binary64) z))) Initial program 57.6%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6457.6
Applied rewrites57.6%
Applied rewrites99.9%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (* x (/ t z))) (t_2 (* x (- t))))
(if (<= t -2.9e+279)
t_1
(if (<= t -8.6e+155)
t_2
(if (<= t 6.7e+168) (* y (/ x z)) (if (<= t 8e+247) 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 (t <= -2.9e+279) {
tmp = t_1;
} else if (t <= -8.6e+155) {
tmp = t_2;
} else if (t <= 6.7e+168) {
tmp = y * (x / z);
} else if (t <= 8e+247) {
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 (t <= (-2.9d+279)) then
tmp = t_1
else if (t <= (-8.6d+155)) then
tmp = t_2
else if (t <= 6.7d+168) then
tmp = y * (x / z)
else if (t <= 8d+247) 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 (t <= -2.9e+279) {
tmp = t_1;
} else if (t <= -8.6e+155) {
tmp = t_2;
} else if (t <= 6.7e+168) {
tmp = y * (x / z);
} else if (t <= 8e+247) {
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 t <= -2.9e+279: tmp = t_1 elif t <= -8.6e+155: tmp = t_2 elif t <= 6.7e+168: tmp = y * (x / z) elif t <= 8e+247: 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 (t <= -2.9e+279) tmp = t_1; elseif (t <= -8.6e+155) tmp = t_2; elseif (t <= 6.7e+168) tmp = Float64(y * Float64(x / z)); elseif (t <= 8e+247) 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 (t <= -2.9e+279) tmp = t_1; elseif (t <= -8.6e+155) tmp = t_2; elseif (t <= 6.7e+168) tmp = y * (x / z); elseif (t <= 8e+247) 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[t, -2.9e+279], t$95$1, If[LessEqual[t, -8.6e+155], t$95$2, If[LessEqual[t, 6.7e+168], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8e+247], 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}\;t \leq -2.9 \cdot 10^{+279}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq -8.6 \cdot 10^{+155}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t \leq 6.7 \cdot 10^{+168}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+247}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -2.89999999999999975e279 or 7.99999999999999962e247 < t Initial program 95.2%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6488.1
Applied rewrites88.1%
Taylor expanded in y around 0
Applied rewrites88.1%
if -2.89999999999999975e279 < t < -8.6000000000000005e155 or 6.7000000000000003e168 < t < 7.99999999999999962e247Initial program 97.5%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6469.8
Applied rewrites69.8%
Taylor expanded in y around 0
Applied rewrites65.3%
if -8.6000000000000005e155 < t < 6.7000000000000003e168Initial program 92.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
Applied rewrites79.1%
Final simplification77.8%
(FPCore (x y z t) :precision binary64 (if (or (<= z -0.95) (not (<= z 880000.0))) (* x (/ (+ t y) z)) (/ (* x (- y (* t z))) z)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.95) || !(z <= 880000.0)) {
tmp = x * ((t + y) / z);
} else {
tmp = (x * (y - (t * z))) / 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.95d0)) .or. (.not. (z <= 880000.0d0))) then
tmp = x * ((t + y) / z)
else
tmp = (x * (y - (t * z))) / z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -0.95) || !(z <= 880000.0)) {
tmp = x * ((t + y) / z);
} else {
tmp = (x * (y - (t * z))) / z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -0.95) or not (z <= 880000.0): tmp = x * ((t + y) / z) else: tmp = (x * (y - (t * z))) / z return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -0.95) || !(z <= 880000.0)) tmp = Float64(x * Float64(Float64(t + y) / z)); else tmp = Float64(Float64(x * Float64(y - Float64(t * z))) / z); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -0.95) || ~((z <= 880000.0))) tmp = x * ((t + y) / z); else tmp = (x * (y - (t * z))) / z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -0.95], N[Not[LessEqual[z, 880000.0]], $MachinePrecision]], N[(x * N[(N[(t + y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision], N[(N[(x * N[(y - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.95 \lor \neg \left(z \leq 880000\right):\\
\;\;\;\;x \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y - t \cdot z\right)}{z}\\
\end{array}
\end{array}
if z < -0.94999999999999996 or 8.8e5 < z Initial program 96.3%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.1
Applied rewrites94.1%
if -0.94999999999999996 < z < 8.8e5Initial program 91.1%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
associate-*r*N/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-out--N/A
unsub-negN/A
mul-1-negN/A
lower-*.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-*.f6491.9
Applied rewrites91.9%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 0.54))) (* x (/ (+ t y) z)) (* x (- (/ y z) t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 0.54)) {
tmp = x * ((t + y) / 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 <= (-1.0d0)) .or. (.not. (z <= 0.54d0))) then
tmp = x * ((t + y) / 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 <= -1.0) || !(z <= 0.54)) {
tmp = x * ((t + y) / z);
} else {
tmp = x * ((y / z) - t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 0.54): tmp = x * ((t + y) / z) else: tmp = x * ((y / z) - t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 0.54)) tmp = Float64(x * Float64(Float64(t + y) / 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 <= -1.0) || ~((z <= 0.54))) tmp = x * ((t + y) / z); 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, 0.54]], $MachinePrecision]], N[(x * N[(N[(t + y), $MachinePrecision] / z), $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 0.54\right):\\
\;\;\;\;x \cdot \frac{t + y}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\end{array}
\end{array}
if z < -1 or 0.54000000000000004 < z Initial program 96.4%
Taylor expanded in z around inf
lower-/.f64N/A
cancel-sign-sub-invN/A
metadata-evalN/A
*-lft-identityN/A
+-commutativeN/A
lower-+.f6494.2
Applied rewrites94.2%
if -1 < z < 0.54000000000000004Initial program 91.0%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6490.9
Applied rewrites90.9%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6490.1
Applied rewrites90.1%
Taylor expanded in y around 0
Applied rewrites90.1%
Final simplification92.2%
(FPCore (x y z t) :precision binary64 (if (or (<= y -4.9e-148) (not (<= y 7e-89))) (/ (* x (+ y t)) z) (/ (* t x) (- z 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e-148) || !(y <= 7e-89)) {
tmp = (x * (y + t)) / z;
} else {
tmp = (t * x) / (z - 1.0);
}
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 ((y <= (-4.9d-148)) .or. (.not. (y <= 7d-89))) then
tmp = (x * (y + t)) / z
else
tmp = (t * x) / (z - 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((y <= -4.9e-148) || !(y <= 7e-89)) {
tmp = (x * (y + t)) / z;
} else {
tmp = (t * x) / (z - 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (y <= -4.9e-148) or not (y <= 7e-89): tmp = (x * (y + t)) / z else: tmp = (t * x) / (z - 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((y <= -4.9e-148) || !(y <= 7e-89)) tmp = Float64(Float64(x * Float64(y + t)) / z); else tmp = Float64(Float64(t * x) / Float64(z - 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((y <= -4.9e-148) || ~((y <= 7e-89))) tmp = (x * (y + t)) / z; else tmp = (t * x) / (z - 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[y, -4.9e-148], N[Not[LessEqual[y, 7e-89]], $MachinePrecision]], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], N[(N[(t * x), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -4.9 \cdot 10^{-148} \lor \neg \left(y \leq 7 \cdot 10^{-89}\right):\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot x}{z - 1}\\
\end{array}
\end{array}
if y < -4.9e-148 or 6.9999999999999994e-89 < y Initial program 92.8%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites73.4%
Taylor expanded in z around inf
Applied rewrites81.3%
if -4.9e-148 < y < 6.9999999999999994e-89Initial program 95.7%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6481.3
Applied rewrites81.3%
Final simplification81.3%
(FPCore (x y z t) :precision binary64 (if (or (<= t -45000000000.0) (not (<= t 1.35e+168))) (/ (* t x) (- z 1.0)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -45000000000.0) || !(t <= 1.35e+168)) {
tmp = (t * x) / (z - 1.0);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-45000000000.0d0)) .or. (.not. (t <= 1.35d+168))) then
tmp = (t * x) / (z - 1.0d0)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -45000000000.0) || !(t <= 1.35e+168)) {
tmp = (t * x) / (z - 1.0);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -45000000000.0) or not (t <= 1.35e+168): tmp = (t * x) / (z - 1.0) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -45000000000.0) || !(t <= 1.35e+168)) tmp = Float64(Float64(t * x) / Float64(z - 1.0)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -45000000000.0) || ~((t <= 1.35e+168))) tmp = (t * x) / (z - 1.0); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -45000000000.0], N[Not[LessEqual[t, 1.35e+168]], $MachinePrecision]], N[(N[(t * x), $MachinePrecision] / N[(z - 1.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -45000000000 \lor \neg \left(t \leq 1.35 \cdot 10^{+168}\right):\\
\;\;\;\;\frac{t \cdot x}{z - 1}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -4.5e10 or 1.35000000000000008e168 < t Initial program 96.6%
Taylor expanded in y around 0
mul-1-negN/A
distribute-neg-frac2N/A
lower-/.f64N/A
lower-*.f64N/A
sub-negN/A
mul-1-negN/A
+-commutativeN/A
distribute-neg-inN/A
mul-1-negN/A
remove-double-negN/A
sub-negN/A
lower--.f6474.2
Applied rewrites74.2%
if -4.5e10 < t < 1.35000000000000008e168Initial program 92.2%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
Applied rewrites84.5%
Final simplification81.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -9.8e-12) (not (<= z 880000.0))) (* (+ t y) (/ x z)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.8e-12) || !(z <= 880000.0)) {
tmp = (t + y) * (x / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-9.8d-12)) .or. (.not. (z <= 880000.0d0))) then
tmp = (t + y) * (x / z)
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -9.8e-12) || !(z <= 880000.0)) {
tmp = (t + y) * (x / z);
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -9.8e-12) or not (z <= 880000.0): tmp = (t + y) * (x / z) else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -9.8e-12) || !(z <= 880000.0)) tmp = Float64(Float64(t + y) * Float64(x / z)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -9.8e-12) || ~((z <= 880000.0))) tmp = (t + y) * (x / z); else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -9.8e-12], N[Not[LessEqual[z, 880000.0]], $MachinePrecision]], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.8 \cdot 10^{-12} \lor \neg \left(z \leq 880000\right):\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -9.79999999999999944e-12 or 8.8e5 < z Initial program 96.4%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.7%
Taylor expanded in z around inf
Applied rewrites86.1%
Applied rewrites87.9%
if -9.79999999999999944e-12 < z < 8.8e5Initial program 90.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6462.0
Applied rewrites62.0%
Applied rewrites70.1%
Final simplification79.2%
(FPCore (x y z t) :precision binary64 (if (<= z -0.00135) (/ (* x (+ y t)) z) (if (<= z 880000.0) (* x (- (/ y z) t)) (* (+ t y) (/ x z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00135) {
tmp = (x * (y + t)) / z;
} else if (z <= 880000.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (t + y) * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-0.00135d0)) then
tmp = (x * (y + t)) / z
else if (z <= 880000.0d0) then
tmp = x * ((y / z) - t)
else
tmp = (t + y) * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -0.00135) {
tmp = (x * (y + t)) / z;
} else if (z <= 880000.0) {
tmp = x * ((y / z) - t);
} else {
tmp = (t + y) * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -0.00135: tmp = (x * (y + t)) / z elif z <= 880000.0: tmp = x * ((y / z) - t) else: tmp = (t + y) * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -0.00135) tmp = Float64(Float64(x * Float64(y + t)) / z); elseif (z <= 880000.0) tmp = Float64(x * Float64(Float64(y / z) - t)); else tmp = Float64(Float64(t + y) * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -0.00135) tmp = (x * (y + t)) / z; elseif (z <= 880000.0) tmp = x * ((y / z) - t); else tmp = (t + y) * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -0.00135], N[(N[(x * N[(y + t), $MachinePrecision]), $MachinePrecision] / z), $MachinePrecision], If[LessEqual[z, 880000.0], N[(x * N[(N[(y / z), $MachinePrecision] - t), $MachinePrecision]), $MachinePrecision], N[(N[(t + y), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -0.00135:\\
\;\;\;\;\frac{x \cdot \left(y + t\right)}{z}\\
\mathbf{elif}\;z \leq 880000:\\
\;\;\;\;x \cdot \left(\frac{y}{z} - t\right)\\
\mathbf{else}:\\
\;\;\;\;\left(t + y\right) \cdot \frac{x}{z}\\
\end{array}
\end{array}
if z < -0.0013500000000000001Initial program 98.1%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites89.2%
Taylor expanded in z around inf
Applied rewrites88.3%
if -0.0013500000000000001 < z < 8.8e5Initial program 91.1%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6491.0
Applied rewrites91.0%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6490.2
Applied rewrites90.2%
Taylor expanded in y around 0
Applied rewrites90.2%
if 8.8e5 < z Initial program 94.9%
Taylor expanded in z around inf
*-lft-identityN/A
metadata-evalN/A
associate-*r*N/A
distribute-lft-out--N/A
mul-1-negN/A
distribute-rgt-neg-inN/A
remove-double-negN/A
mul-1-negN/A
distribute-neg-inN/A
+-commutativeN/A
mul-1-negN/A
lower-/.f64N/A
Applied rewrites85.1%
Taylor expanded in z around inf
Applied rewrites84.9%
Applied rewrites91.8%
Final simplification90.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -8.6e+155) (not (<= t 6.7e+168))) (* x (- t)) (* y (/ x z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.6e+155) || !(t <= 6.7e+168)) {
tmp = x * -t;
} else {
tmp = y * (x / z);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-8.6d+155)) .or. (.not. (t <= 6.7d+168))) then
tmp = x * -t
else
tmp = y * (x / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -8.6e+155) || !(t <= 6.7e+168)) {
tmp = x * -t;
} else {
tmp = y * (x / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -8.6e+155) or not (t <= 6.7e+168): tmp = x * -t else: tmp = y * (x / z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -8.6e+155) || !(t <= 6.7e+168)) tmp = Float64(x * Float64(-t)); else tmp = Float64(y * Float64(x / z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -8.6e+155) || ~((t <= 6.7e+168))) tmp = x * -t; else tmp = y * (x / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -8.6e+155], N[Not[LessEqual[t, 6.7e+168]], $MachinePrecision]], N[(x * (-t)), $MachinePrecision], N[(y * N[(x / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.6 \cdot 10^{+155} \lor \neg \left(t \leq 6.7 \cdot 10^{+168}\right):\\
\;\;\;\;x \cdot \left(-t\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{x}{z}\\
\end{array}
\end{array}
if t < -8.6000000000000005e155 or 6.7000000000000003e168 < t Initial program 96.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6496.7
Applied rewrites96.7%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6453.7
Applied rewrites53.7%
Taylor expanded in y around 0
Applied rewrites47.7%
if -8.6000000000000005e155 < t < 6.7000000000000003e168Initial program 92.8%
Taylor expanded in y around inf
associate-/l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-/.f6476.1
Applied rewrites76.1%
Applied rewrites79.1%
Final simplification72.0%
(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 93.7%
lift-/.f64N/A
clear-numN/A
lower-/.f64N/A
lower-/.f6493.7
Applied rewrites93.7%
Taylor expanded in z around 0
lower-/.f64N/A
+-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
mul-1-negN/A
lower-neg.f6465.7
Applied rewrites65.7%
Taylor expanded in y around 0
Applied rewrites26.0%
Final simplification26.0%
(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 2024321
(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)))))