
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * 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) + ((2.0d0 + ((z * 2.0d0) * (1.0d0 - t))) / (t * z))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z));
}
def code(x, y, z, t): return (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(Float64(z * 2.0) * Float64(1.0 - t))) / Float64(t * z))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 + ((z * 2.0) * (1.0 - t))) / (t * z)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(N[(z * 2.0), $MachinePrecision] * N[(1.0 - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \frac{2 + \left(z \cdot 2\right) \cdot \left(1 - t\right)}{t \cdot z}
\end{array}
(FPCore (x y z t) :precision binary64 (+ (/ x y) (+ (/ 2.0 (* t z)) (+ (/ 2.0 t) -2.0))))
double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 / (t * z)) + ((2.0 / t) + -2.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) + ((2.0d0 / (t * z)) + ((2.0d0 / t) + (-2.0d0)))
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + ((2.0 / (t * z)) + ((2.0 / t) + -2.0));
}
def code(x, y, z, t): return (x / y) + ((2.0 / (t * z)) + ((2.0 / t) + -2.0))
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(2.0 / Float64(t * z)) + Float64(Float64(2.0 / t) + -2.0))) end
function tmp = code(x, y, z, t) tmp = (x / y) + ((2.0 / (t * z)) + ((2.0 / t) + -2.0)); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{2}{t \cdot z} + \left(\frac{2}{t} + -2\right)\right)
\end{array}
Initial program 85.1%
Taylor expanded in t around inf 99.5%
sub-neg99.5%
metadata-eval99.5%
associate-*r/99.5%
+-commutative99.5%
metadata-eval99.5%
associate-+l+99.5%
associate-*r/99.5%
metadata-eval99.5%
associate-*r/99.5%
metadata-eval99.5%
Simplified99.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -0.72) (not (<= t 1.0))) (+ -2.0 (+ (/ x y) (/ (/ 2.0 t) z))) (+ (/ x y) (/ (+ 2.0 (* 2.0 z)) (* t z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.72) || !(t <= 1.0)) {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
} else {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (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 ((t <= (-0.72d0)) .or. (.not. (t <= 1.0d0))) then
tmp = (-2.0d0) + ((x / y) + ((2.0d0 / t) / z))
else
tmp = (x / y) + ((2.0d0 + (2.0d0 * z)) / (t * z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -0.72) || !(t <= 1.0)) {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
} else {
tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -0.72) or not (t <= 1.0): tmp = -2.0 + ((x / y) + ((2.0 / t) / z)) else: tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -0.72) || !(t <= 1.0)) tmp = Float64(-2.0 + Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z))); else tmp = Float64(Float64(x / y) + Float64(Float64(2.0 + Float64(2.0 * z)) / Float64(t * z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -0.72) || ~((t <= 1.0))) tmp = -2.0 + ((x / y) + ((2.0 / t) / z)); else tmp = (x / y) + ((2.0 + (2.0 * z)) / (t * z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -0.72], N[Not[LessEqual[t, 1.0]], $MachinePrecision]], N[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 + N[(2.0 * z), $MachinePrecision]), $MachinePrecision] / N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -0.72 \lor \neg \left(t \leq 1\right):\\
\;\;\;\;-2 + \left(\frac{x}{y} + \frac{\frac{2}{t}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2 + 2 \cdot z}{t \cdot z}\\
\end{array}
\end{array}
if t < -0.71999999999999997 or 1 < t Initial program 70.1%
Taylor expanded in t around 0 83.2%
associate-+r+83.2%
associate-*r/83.2%
metadata-eval83.2%
sub-neg83.2%
metadata-eval83.2%
Simplified83.2%
Taylor expanded in z around 0 82.3%
Taylor expanded in z around inf 99.1%
sub-neg99.1%
associate-*r/99.1%
metadata-eval99.1%
metadata-eval99.1%
+-commutative99.1%
associate-/r*99.1%
+-commutative99.1%
Simplified99.1%
if -0.71999999999999997 < t < 1Initial program 99.1%
Taylor expanded in t around 0 98.8%
Final simplification99.0%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.0) (not (<= z 1.16e-5))) (+ (/ x y) (/ (* 2.0 (- 1.0 t)) t)) (+ -2.0 (+ (/ x y) (/ (/ 2.0 t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.16e-5)) {
tmp = (x / y) + ((2.0 * (1.0 - t)) / t);
} else {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-1.0d0)) .or. (.not. (z <= 1.16d-5))) then
tmp = (x / y) + ((2.0d0 * (1.0d0 - t)) / t)
else
tmp = (-2.0d0) + ((x / y) + ((2.0d0 / t) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.0) || !(z <= 1.16e-5)) {
tmp = (x / y) + ((2.0 * (1.0 - t)) / t);
} else {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.0) or not (z <= 1.16e-5): tmp = (x / y) + ((2.0 * (1.0 - t)) / t) else: tmp = -2.0 + ((x / y) + ((2.0 / t) / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.0) || !(z <= 1.16e-5)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 * Float64(1.0 - t)) / t)); else tmp = Float64(-2.0 + Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.0) || ~((z <= 1.16e-5))) tmp = (x / y) + ((2.0 * (1.0 - t)) / t); else tmp = -2.0 + ((x / y) + ((2.0 / t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.0], N[Not[LessEqual[z, 1.16e-5]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 * N[(1.0 - t), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \lor \neg \left(z \leq 1.16 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x}{y} + \frac{2 \cdot \left(1 - t\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;-2 + \left(\frac{x}{y} + \frac{\frac{2}{t}}{z}\right)\\
\end{array}
\end{array}
if z < -1 or 1.1600000000000001e-5 < z Initial program 72.3%
Taylor expanded in z around inf 99.4%
associate-*r/99.4%
Simplified99.4%
if -1 < z < 1.1600000000000001e-5Initial program 99.1%
Taylor expanded in t around 0 89.8%
associate-+r+89.8%
associate-*r/89.8%
metadata-eval89.8%
sub-neg89.8%
metadata-eval89.8%
Simplified89.8%
Taylor expanded in z around 0 88.7%
Taylor expanded in z around inf 98.0%
sub-neg98.0%
associate-*r/98.0%
metadata-eval98.0%
metadata-eval98.0%
+-commutative98.0%
associate-/r*98.0%
+-commutative98.0%
Simplified98.0%
Final simplification98.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.4e-139) (not (<= t 9.5e-47))) (+ -2.0 (+ (/ x y) (/ (/ 2.0 t) z))) (+ (/ 2.0 (* t z)) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4e-139) || !(t <= 9.5e-47)) {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
} else {
tmp = (2.0 / (t * z)) + (2.0 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-2.4d-139)) .or. (.not. (t <= 9.5d-47))) then
tmp = (-2.0d0) + ((x / y) + ((2.0d0 / t) / z))
else
tmp = (2.0d0 / (t * z)) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4e-139) || !(t <= 9.5e-47)) {
tmp = -2.0 + ((x / y) + ((2.0 / t) / z));
} else {
tmp = (2.0 / (t * z)) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.4e-139) or not (t <= 9.5e-47): tmp = -2.0 + ((x / y) + ((2.0 / t) / z)) else: tmp = (2.0 / (t * z)) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.4e-139) || !(t <= 9.5e-47)) tmp = Float64(-2.0 + Float64(Float64(x / y) + Float64(Float64(2.0 / t) / z))); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.4e-139) || ~((t <= 9.5e-47))) tmp = -2.0 + ((x / y) + ((2.0 / t) / z)); else tmp = (2.0 / (t * z)) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.4e-139], N[Not[LessEqual[t, 9.5e-47]], $MachinePrecision]], N[(-2.0 + N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{-139} \lor \neg \left(t \leq 9.5 \cdot 10^{-47}\right):\\
\;\;\;\;-2 + \left(\frac{x}{y} + \frac{\frac{2}{t}}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -2.40000000000000015e-139 or 9.4999999999999991e-47 < t Initial program 76.8%
Taylor expanded in t around 0 86.9%
associate-+r+86.9%
associate-*r/86.9%
metadata-eval86.9%
sub-neg86.9%
metadata-eval86.9%
Simplified86.9%
Taylor expanded in z around 0 82.0%
Taylor expanded in z around inf 95.0%
sub-neg95.0%
associate-*r/95.0%
metadata-eval95.0%
metadata-eval95.0%
+-commutative95.0%
associate-/r*95.0%
+-commutative95.0%
Simplified95.0%
if -2.40000000000000015e-139 < t < 9.4999999999999991e-47Initial program 98.9%
Taylor expanded in t around 0 98.9%
Taylor expanded in x around 0 90.7%
associate-*r/90.7%
metadata-eval90.7%
associate-*r/90.7%
metadata-eval90.7%
Simplified90.7%
Final simplification93.4%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5e+45) (not (<= (/ x y) 1e+83))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+45) || !((x / y) <= 1e+83)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.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 (((x / y) <= (-5d+45)) .or. (.not. ((x / y) <= 1d+83))) then
tmp = x / y
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5e+45) || !((x / y) <= 1e+83)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5e+45) or not ((x / y) <= 1e+83): tmp = x / y else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5e+45) || !(Float64(x / y) <= 1e+83)) tmp = Float64(x / y); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -5e+45) || ~(((x / y) <= 1e+83))) tmp = x / y; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5e+45], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1e+83]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5 \cdot 10^{+45} \lor \neg \left(\frac{x}{y} \leq 10^{+83}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -5e45 or 1.00000000000000003e83 < (/.f64 x y) Initial program 86.4%
Taylor expanded in x around inf 72.5%
if -5e45 < (/.f64 x y) < 1.00000000000000003e83Initial program 84.0%
Taylor expanded in z around inf 69.2%
associate-*r/69.2%
Simplified69.2%
Taylor expanded in y around 0 44.0%
associate-/l*57.5%
Simplified57.5%
Taylor expanded in x around 0 64.0%
div-sub64.0%
*-inverses64.0%
sub-neg64.0%
metadata-eval64.0%
distribute-lft-in64.0%
associate-*r/64.0%
metadata-eval64.0%
metadata-eval64.0%
Simplified64.0%
Final simplification67.7%
(FPCore (x y z t) :precision binary64 (if (<= t -2.8e-22) (/ (+ x (* y -2.0)) y) (if (<= t 650000.0) (+ (/ 2.0 (* t z)) (/ 2.0 t)) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-22) {
tmp = (x + (y * -2.0)) / y;
} else if (t <= 650000.0) {
tmp = (2.0 / (t * z)) + (2.0 / t);
} else {
tmp = (x / y) - 2.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 (t <= (-2.8d-22)) then
tmp = (x + (y * (-2.0d0))) / y
else if (t <= 650000.0d0) then
tmp = (2.0d0 / (t * z)) + (2.0d0 / t)
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -2.8e-22) {
tmp = (x + (y * -2.0)) / y;
} else if (t <= 650000.0) {
tmp = (2.0 / (t * z)) + (2.0 / t);
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -2.8e-22: tmp = (x + (y * -2.0)) / y elif t <= 650000.0: tmp = (2.0 / (t * z)) + (2.0 / t) else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -2.8e-22) tmp = Float64(Float64(x + Float64(y * -2.0)) / y); elseif (t <= 650000.0) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -2.8e-22) tmp = (x + (y * -2.0)) / y; elseif (t <= 650000.0) tmp = (2.0 / (t * z)) + (2.0 / t); else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -2.8e-22], N[(N[(x + N[(y * -2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 650000.0], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{x + y \cdot -2}{y}\\
\mathbf{elif}\;t \leq 650000:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if t < -2.79999999999999995e-22Initial program 71.1%
Taylor expanded in z around inf 88.2%
associate-*r/88.2%
Simplified88.2%
Taylor expanded in y around 0 77.5%
associate-/l*88.2%
Simplified88.2%
Taylor expanded in t around inf 86.7%
*-commutative86.7%
Simplified86.7%
if -2.79999999999999995e-22 < t < 6.5e5Initial program 99.1%
Taylor expanded in t around 0 98.8%
Taylor expanded in x around 0 84.6%
associate-*r/84.6%
metadata-eval84.6%
associate-*r/84.6%
metadata-eval84.6%
Simplified84.6%
if 6.5e5 < t Initial program 71.4%
Taylor expanded in t around inf 94.9%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.1e-21) (not (<= t 4600000.0))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.1e-21) || !(t <= 4600000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-3.1d-21)) .or. (.not. (t <= 4600000.0d0))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 + (2.0d0 / z)) / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.1e-21) || !(t <= 4600000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.1e-21) or not (t <= 4600000.0): tmp = (x / y) - 2.0 else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.1e-21) || !(t <= 4600000.0)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.1e-21) || ~((t <= 4600000.0))) tmp = (x / y) - 2.0; else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.1e-21], N[Not[LessEqual[t, 4600000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-21} \lor \neg \left(t \leq 4600000\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -3.0999999999999998e-21 or 4.6e6 < t Initial program 71.2%
Taylor expanded in t around inf 90.2%
if -3.0999999999999998e-21 < t < 4.6e6Initial program 99.1%
Taylor expanded in t around 0 84.6%
associate-*r/84.6%
metadata-eval84.6%
Simplified84.6%
Final simplification87.4%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.0) (not (<= t 650000.0))) (- (/ x y) 2.0) (+ (/ x y) (/ 2.0 t))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.0) || !(t <= 650000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1.0d0)) .or. (.not. (t <= 650000.0d0))) then
tmp = (x / y) - 2.0d0
else
tmp = (x / y) + (2.0d0 / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.0) || !(t <= 650000.0)) {
tmp = (x / y) - 2.0;
} else {
tmp = (x / y) + (2.0 / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.0) or not (t <= 650000.0): tmp = (x / y) - 2.0 else: tmp = (x / y) + (2.0 / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.0) || !(t <= 650000.0)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(x / y) + Float64(2.0 / t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.0) || ~((t <= 650000.0))) tmp = (x / y) - 2.0; else tmp = (x / y) + (2.0 / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.0], N[Not[LessEqual[t, 650000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \lor \neg \left(t \leq 650000\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{t}\\
\end{array}
\end{array}
if t < -1 or 6.5e5 < t Initial program 69.9%
Taylor expanded in t around inf 91.6%
if -1 < t < 6.5e5Initial program 99.1%
Taylor expanded in t around 0 98.8%
Taylor expanded in z around inf 59.4%
associate-*r/59.4%
metadata-eval59.4%
+-commutative59.4%
Simplified59.4%
Final simplification74.9%
(FPCore (x y z t) :precision binary64 (if (<= t -4.2e-21) (/ (+ x (* y -2.0)) y) (if (<= t 650000.0) (/ (+ 2.0 (/ 2.0 z)) t) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.2e-21) {
tmp = (x + (y * -2.0)) / y;
} else if (t <= 650000.0) {
tmp = (2.0 + (2.0 / z)) / t;
} else {
tmp = (x / y) - 2.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 (t <= (-4.2d-21)) then
tmp = (x + (y * (-2.0d0))) / y
else if (t <= 650000.0d0) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else
tmp = (x / y) - 2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -4.2e-21) {
tmp = (x + (y * -2.0)) / y;
} else if (t <= 650000.0) {
tmp = (2.0 + (2.0 / z)) / t;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -4.2e-21: tmp = (x + (y * -2.0)) / y elif t <= 650000.0: tmp = (2.0 + (2.0 / z)) / t else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -4.2e-21) tmp = Float64(Float64(x + Float64(y * -2.0)) / y); elseif (t <= 650000.0) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -4.2e-21) tmp = (x + (y * -2.0)) / y; elseif (t <= 650000.0) tmp = (2.0 + (2.0 / z)) / t; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -4.2e-21], N[(N[(x + N[(y * -2.0), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision], If[LessEqual[t, 650000.0], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{-21}:\\
\;\;\;\;\frac{x + y \cdot -2}{y}\\
\mathbf{elif}\;t \leq 650000:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if t < -4.20000000000000025e-21Initial program 71.1%
Taylor expanded in z around inf 88.2%
associate-*r/88.2%
Simplified88.2%
Taylor expanded in y around 0 77.5%
associate-/l*88.2%
Simplified88.2%
Taylor expanded in t around inf 86.7%
*-commutative86.7%
Simplified86.7%
if -4.20000000000000025e-21 < t < 6.5e5Initial program 99.1%
Taylor expanded in t around 0 84.6%
associate-*r/84.6%
metadata-eval84.6%
Simplified84.6%
if 6.5e5 < t Initial program 71.4%
Taylor expanded in t around inf 94.9%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.5e-138) (not (<= t 2.9e-46))) (- (/ x y) 2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.5e-138) || !(t <= 2.9e-46)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) + -2.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 ((t <= (-3.5d-138)) .or. (.not. (t <= 2.9d-46))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.5e-138) || !(t <= 2.9e-46)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -3.5e-138) or not (t <= 2.9e-46): tmp = (x / y) - 2.0 else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -3.5e-138) || !(t <= 2.9e-46)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -3.5e-138) || ~((t <= 2.9e-46))) tmp = (x / y) - 2.0; else tmp = (2.0 / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -3.5e-138], N[Not[LessEqual[t, 2.9e-46]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{-138} \lor \neg \left(t \leq 2.9 \cdot 10^{-46}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if t < -3.4999999999999999e-138 or 2.90000000000000005e-46 < t Initial program 76.8%
Taylor expanded in t around inf 79.5%
if -3.4999999999999999e-138 < t < 2.90000000000000005e-46Initial program 98.9%
Taylor expanded in z around inf 60.4%
associate-*r/60.4%
Simplified60.4%
Taylor expanded in y around 0 42.6%
associate-/l*42.7%
Simplified42.7%
Taylor expanded in x around 0 50.1%
div-sub50.1%
*-inverses50.1%
sub-neg50.1%
metadata-eval50.1%
distribute-lft-in50.1%
associate-*r/50.1%
metadata-eval50.1%
metadata-eval50.1%
Simplified50.1%
Final simplification68.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1e-138) (not (<= t 1.2e-46))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e-138) || !(t <= 1.2e-46)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-1d-138)) .or. (.not. (t <= 1.2d-46))) then
tmp = x / y
else
tmp = 2.0d0 / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1e-138) || !(t <= 1.2e-46)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1e-138) or not (t <= 1.2e-46): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1e-138) || !(t <= 1.2e-46)) tmp = Float64(x / y); else tmp = Float64(2.0 / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1e-138) || ~((t <= 1.2e-46))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1e-138], N[Not[LessEqual[t, 1.2e-46]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{-138} \lor \neg \left(t \leq 1.2 \cdot 10^{-46}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if t < -1.00000000000000007e-138 or 1.20000000000000007e-46 < t Initial program 76.8%
Taylor expanded in x around inf 49.1%
if -1.00000000000000007e-138 < t < 1.20000000000000007e-46Initial program 98.9%
Taylor expanded in z around inf 60.4%
associate-*r/60.4%
Simplified60.4%
Taylor expanded in t around 0 50.1%
Final simplification49.5%
(FPCore (x y z t) :precision binary64 (/ 2.0 t))
double code(double x, double y, double z, double t) {
return 2.0 / 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 = 2.0d0 / t
end function
public static double code(double x, double y, double z, double t) {
return 2.0 / t;
}
def code(x, y, z, t): return 2.0 / t
function code(x, y, z, t) return Float64(2.0 / t) end
function tmp = code(x, y, z, t) tmp = 2.0 / t; end
code[x_, y_, z_, t_] := N[(2.0 / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{2}{t}
\end{array}
Initial program 85.1%
Taylor expanded in z around inf 75.4%
associate-*r/75.4%
Simplified75.4%
Taylor expanded in t around 0 22.9%
(FPCore (x y z t) :precision binary64 (- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y))))
double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
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 = (((2.0d0 / z) + 2.0d0) / t) - (2.0d0 - (x / y))
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y));
}
def code(x, y, z, t): return (((2.0 / z) + 2.0) / t) - (2.0 - (x / y))
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / z) + 2.0) / t) - Float64(2.0 - Float64(x / y))) end
function tmp = code(x, y, z, t) tmp = (((2.0 / z) + 2.0) / t) - (2.0 - (x / y)); end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / z), $MachinePrecision] + 2.0), $MachinePrecision] / t), $MachinePrecision] - N[(2.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{2}{z} + 2}{t} - \left(2 - \frac{x}{y}\right)
\end{array}
herbie shell --seed 2024172
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(! :herbie-platform default (- (/ (+ (/ 2 z) 2) t) (- 2 (/ x y))))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))