
(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 (- (+ (* 2.0 (/ 1.0 t)) (+ (/ 2.0 (* t z)) (/ x y))) 2.0))
double code(double x, double y, double z, double t) {
return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 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 = ((2.0d0 * (1.0d0 / t)) + ((2.0d0 / (t * z)) + (x / y))) - 2.0d0
end function
public static double code(double x, double y, double z, double t) {
return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0;
}
def code(x, y, z, t): return ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0
function code(x, y, z, t) return Float64(Float64(Float64(2.0 * Float64(1.0 / t)) + Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y))) - 2.0) end
function tmp = code(x, y, z, t) tmp = ((2.0 * (1.0 / t)) + ((2.0 / (t * z)) + (x / y))) - 2.0; end
code[x_, y_, z_, t_] := N[(N[(N[(2.0 * N[(1.0 / t), $MachinePrecision]), $MachinePrecision] + N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(2 \cdot \frac{1}{t} + \left(\frac{2}{t \cdot z} + \frac{x}{y}\right)\right) - 2
\end{array}
Initial program 85.4%
Taylor expanded in t around inf 98.4%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -5.3e+119)
(+ (/ x y) (+ -2.0 (/ 2.0 t)))
(if (<= (/ x y) 1.65e+33)
(- (+ (/ 2.0 (* t z)) (/ 2.0 t)) 2.0)
(+ (/ x y) (/ (/ 2.0 t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -5.3e+119) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 1.65e+33) {
tmp = ((2.0 / (t * z)) + (2.0 / t)) - 2.0;
} else {
tmp = (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 ((x / y) <= (-5.3d+119)) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else if ((x / y) <= 1.65d+33) then
tmp = ((2.0d0 / (t * z)) + (2.0d0 / t)) - 2.0d0
else
tmp = (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 ((x / y) <= -5.3e+119) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 1.65e+33) {
tmp = ((2.0 / (t * z)) + (2.0 / t)) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -5.3e+119: tmp = (x / y) + (-2.0 + (2.0 / t)) elif (x / y) <= 1.65e+33: tmp = ((2.0 / (t * z)) + (2.0 / t)) - 2.0 else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -5.3e+119) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); elseif (Float64(x / y) <= 1.65e+33) tmp = Float64(Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)) - 2.0); else tmp = 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 ((x / y) <= -5.3e+119) tmp = (x / y) + (-2.0 + (2.0 / t)); elseif ((x / y) <= 1.65e+33) tmp = ((2.0 / (t * z)) + (2.0 / t)) - 2.0; else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -5.3e+119], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.65e+33], N[(N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.3 \cdot 10^{+119}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 1.65 \cdot 10^{+33}:\\
\;\;\;\;\left(\frac{2}{t \cdot z} + \frac{2}{t}\right) - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.29999999999999972e119Initial program 90.2%
Taylor expanded in z around inf 88.1%
div-sub88.1%
sub-neg88.1%
*-inverses88.1%
metadata-eval88.1%
distribute-lft-in88.1%
associate-*r/88.1%
metadata-eval88.1%
metadata-eval88.1%
Simplified88.1%
if -5.29999999999999972e119 < (/.f64 x y) < 1.64999999999999988e33Initial program 86.5%
Taylor expanded in t around inf 99.9%
associate-/r*99.9%
un-div-inv99.9%
frac-add82.7%
un-div-inv82.7%
Applied egg-rr82.7%
+-commutative82.7%
*-commutative82.7%
*-commutative82.7%
fma-define82.7%
*-commutative82.7%
associate-*l/82.7%
Simplified82.7%
Taylor expanded in x around 0 95.9%
associate-*r/95.9%
metadata-eval95.9%
associate-*r/95.9%
metadata-eval95.9%
Simplified95.9%
if 1.64999999999999988e33 < (/.f64 x y) Initial program 80.8%
Taylor expanded in z around 0 87.1%
associate-/r*87.1%
Simplified87.1%
Final simplification92.6%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -2e+140)
(/ x y)
(if (<= (/ x y) -1.55e-98)
(/ 2.0 t)
(if (<= (/ x y) 8.8e-12) -2.0 (/ x y)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+140) {
tmp = x / y;
} else if ((x / y) <= -1.55e-98) {
tmp = 2.0 / t;
} else if ((x / y) <= 8.8e-12) {
tmp = -2.0;
} else {
tmp = x / 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 ((x / y) <= (-2d+140)) then
tmp = x / y
else if ((x / y) <= (-1.55d-98)) then
tmp = 2.0d0 / t
else if ((x / y) <= 8.8d-12) then
tmp = -2.0d0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2e+140) {
tmp = x / y;
} else if ((x / y) <= -1.55e-98) {
tmp = 2.0 / t;
} else if ((x / y) <= 8.8e-12) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2e+140: tmp = x / y elif (x / y) <= -1.55e-98: tmp = 2.0 / t elif (x / y) <= 8.8e-12: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2e+140) tmp = Float64(x / y); elseif (Float64(x / y) <= -1.55e-98) tmp = Float64(2.0 / t); elseif (Float64(x / y) <= 8.8e-12) tmp = -2.0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -2e+140) tmp = x / y; elseif ((x / y) <= -1.55e-98) tmp = 2.0 / t; elseif ((x / y) <= 8.8e-12) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2e+140], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -1.55e-98], N[(2.0 / t), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 8.8e-12], -2.0, N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2 \cdot 10^{+140}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -1.55 \cdot 10^{-98}:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq 8.8 \cdot 10^{-12}:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000012e140 or 8.79999999999999966e-12 < (/.f64 x y) Initial program 84.5%
Taylor expanded in x around inf 72.4%
if -2.00000000000000012e140 < (/.f64 x y) < -1.55e-98Initial program 97.1%
Taylor expanded in t around 0 81.4%
associate-*r/81.4%
metadata-eval81.4%
Simplified81.4%
Taylor expanded in z around inf 45.7%
if -1.55e-98 < (/.f64 x y) < 8.79999999999999966e-12Initial program 82.4%
Taylor expanded in t around inf 99.9%
Taylor expanded in z around inf 59.1%
associate-*r/59.1%
metadata-eval59.1%
+-commutative59.1%
Simplified59.1%
Taylor expanded in x around 0 59.1%
Taylor expanded in t around inf 40.9%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -4.8e+113)
(+ (/ x y) (+ -2.0 (/ 2.0 t)))
(if (<= (/ x y) 5.2e+33)
(- (/ (+ 2.0 (/ 2.0 z)) t) 2.0)
(+ (/ x y) (/ (/ 2.0 t) z)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -4.8e+113) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 5.2e+33) {
tmp = ((2.0 + (2.0 / z)) / t) - 2.0;
} else {
tmp = (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 ((x / y) <= (-4.8d+113)) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else if ((x / y) <= 5.2d+33) then
tmp = ((2.0d0 + (2.0d0 / z)) / t) - 2.0d0
else
tmp = (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 ((x / y) <= -4.8e+113) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else if ((x / y) <= 5.2e+33) {
tmp = ((2.0 + (2.0 / z)) / t) - 2.0;
} else {
tmp = (x / y) + ((2.0 / t) / z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -4.8e+113: tmp = (x / y) + (-2.0 + (2.0 / t)) elif (x / y) <= 5.2e+33: tmp = ((2.0 + (2.0 / z)) / t) - 2.0 else: tmp = (x / y) + ((2.0 / t) / z) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -4.8e+113) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); elseif (Float64(x / y) <= 5.2e+33) tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) - 2.0); else tmp = 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 ((x / y) <= -4.8e+113) tmp = (x / y) + (-2.0 + (2.0 / t)); elseif ((x / y) <= 5.2e+33) tmp = ((2.0 + (2.0 / z)) / t) - 2.0; else tmp = (x / y) + ((2.0 / t) / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -4.8e+113], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 5.2e+33], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4.8 \cdot 10^{+113}:\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{elif}\;\frac{x}{y} \leq 5.2 \cdot 10^{+33}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{\frac{2}{t}}{z}\\
\end{array}
\end{array}
if (/.f64 x y) < -4.79999999999999966e113Initial program 90.2%
Taylor expanded in z around inf 88.1%
div-sub88.1%
sub-neg88.1%
*-inverses88.1%
metadata-eval88.1%
distribute-lft-in88.1%
associate-*r/88.1%
metadata-eval88.1%
metadata-eval88.1%
Simplified88.1%
if -4.79999999999999966e113 < (/.f64 x y) < 5.1999999999999995e33Initial program 86.5%
Taylor expanded in t around inf 99.9%
Taylor expanded in t around 0 95.9%
associate-*r/95.9%
metadata-eval95.9%
Simplified95.9%
if 5.1999999999999995e33 < (/.f64 x y) Initial program 80.8%
Taylor expanded in z around 0 87.1%
associate-/r*87.1%
Simplified87.1%
Final simplification92.6%
(FPCore (x y z t) :precision binary64 (if (or (<= z -6.8e-47) (not (<= z 2.5e-22))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (+ (/ 2.0 (* t z)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e-47) || !(z <= 2.5e-22)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 / (t * z)) + (x / 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 ((z <= (-6.8d-47)) .or. (.not. (z <= 2.5d-22))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
else
tmp = (2.0d0 / (t * z)) + (x / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -6.8e-47) || !(z <= 2.5e-22)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 / (t * z)) + (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -6.8e-47) or not (z <= 2.5e-22): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (2.0 / (t * z)) + (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -6.8e-47) || !(z <= 2.5e-22)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); else tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -6.8e-47) || ~((z <= 2.5e-22))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (2.0 / (t * z)) + (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -6.8e-47], N[Not[LessEqual[z, 2.5e-22]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.8 \cdot 10^{-47} \lor \neg \left(z \leq 2.5 \cdot 10^{-22}\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\end{array}
\end{array}
if z < -6.8000000000000003e-47 or 2.49999999999999977e-22 < z Initial program 76.3%
Taylor expanded in z around inf 96.5%
div-sub96.5%
sub-neg96.5%
*-inverses96.5%
metadata-eval96.5%
distribute-lft-in96.5%
associate-*r/96.5%
metadata-eval96.5%
metadata-eval96.5%
Simplified96.5%
if -6.8000000000000003e-47 < z < 2.49999999999999977e-22Initial program 96.4%
Taylor expanded in z around 0 87.8%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.15e-33) (not (<= t 7400000000.0))) (+ (/ x y) (+ -2.0 (/ 2.0 t))) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.15e-33) || !(t <= 7400000000.0)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} 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 <= (-1.15d-33)) .or. (.not. (t <= 7400000000.0d0))) then
tmp = (x / y) + ((-2.0d0) + (2.0d0 / t))
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 <= -1.15e-33) || !(t <= 7400000000.0)) {
tmp = (x / y) + (-2.0 + (2.0 / t));
} else {
tmp = (2.0 + (2.0 / z)) / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.15e-33) or not (t <= 7400000000.0): tmp = (x / y) + (-2.0 + (2.0 / t)) else: tmp = (2.0 + (2.0 / z)) / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.15e-33) || !(t <= 7400000000.0)) tmp = Float64(Float64(x / y) + Float64(-2.0 + Float64(2.0 / t))); 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 <= -1.15e-33) || ~((t <= 7400000000.0))) tmp = (x / y) + (-2.0 + (2.0 / t)); else tmp = (2.0 + (2.0 / z)) / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.15e-33], N[Not[LessEqual[t, 7400000000.0]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(-2.0 + N[(2.0 / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{-33} \lor \neg \left(t \leq 7400000000\right):\\
\;\;\;\;\frac{x}{y} + \left(-2 + \frac{2}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.14999999999999993e-33 or 7.4e9 < t Initial program 73.0%
Taylor expanded in z around inf 86.9%
div-sub86.9%
sub-neg86.9%
*-inverses86.9%
metadata-eval86.9%
distribute-lft-in86.9%
associate-*r/86.9%
metadata-eval86.9%
metadata-eval86.9%
Simplified86.9%
if -1.14999999999999993e-33 < t < 7.4e9Initial program 97.4%
Taylor expanded in t around 0 88.2%
associate-*r/88.2%
metadata-eval88.2%
Simplified88.2%
Final simplification87.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -2e+140) (not (<= (/ x y) 2.6e+33))) (/ x y) (- (/ 2.0 t) 2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -2e+140) || !((x / y) <= 2.6e+33)) {
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) <= (-2d+140)) .or. (.not. ((x / y) <= 2.6d+33))) 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) <= -2e+140) || !((x / y) <= 2.6e+33)) {
tmp = x / y;
} else {
tmp = (2.0 / t) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -2e+140) or not ((x / y) <= 2.6e+33): 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) <= -2e+140) || !(Float64(x / y) <= 2.6e+33)) 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) <= -2e+140) || ~(((x / y) <= 2.6e+33))) 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], -2e+140], N[Not[LessEqual[N[(x / y), $MachinePrecision], 2.6e+33]], $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 -2 \cdot 10^{+140} \lor \neg \left(\frac{x}{y} \leq 2.6 \cdot 10^{+33}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -2.00000000000000012e140 or 2.5999999999999997e33 < (/.f64 x y) Initial program 83.4%
Taylor expanded in x around inf 76.0%
if -2.00000000000000012e140 < (/.f64 x y) < 2.5999999999999997e33Initial program 86.6%
Taylor expanded in t around inf 99.9%
Taylor expanded in z around inf 60.4%
associate-*r/60.4%
metadata-eval60.4%
+-commutative60.4%
Simplified60.4%
Taylor expanded in x around 0 56.2%
Final simplification63.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -1.9e-33) (not (<= t 7800000000.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 <= -1.9e-33) || !(t <= 7800000000.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 <= (-1.9d-33)) .or. (.not. (t <= 7800000000.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 <= -1.9e-33) || !(t <= 7800000000.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 <= -1.9e-33) or not (t <= 7800000000.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 <= -1.9e-33) || !(t <= 7800000000.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 <= -1.9e-33) || ~((t <= 7800000000.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, -1.9e-33], N[Not[LessEqual[t, 7800000000.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 -1.9 \cdot 10^{-33} \lor \neg \left(t \leq 7800000000\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -1.89999999999999997e-33 or 7.8e9 < t Initial program 73.0%
Taylor expanded in t around inf 86.1%
if -1.89999999999999997e-33 < t < 7.8e9Initial program 97.4%
Taylor expanded in t around 0 88.2%
associate-*r/88.2%
metadata-eval88.2%
Simplified88.2%
Final simplification87.2%
(FPCore (x y z t) :precision binary64 (if (or (<= t -3.4e-83) (not (<= t 1e-81))) (- (/ x y) 2.0) (- (/ 2.0 t) 2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -3.4e-83) || !(t <= 1e-81)) {
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.4d-83)) .or. (.not. (t <= 1d-81))) 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.4e-83) || !(t <= 1e-81)) {
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.4e-83) or not (t <= 1e-81): 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.4e-83) || !(t <= 1e-81)) 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.4e-83) || ~((t <= 1e-81))) 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.4e-83], N[Not[LessEqual[t, 1e-81]], $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.4 \cdot 10^{-83} \lor \neg \left(t \leq 10^{-81}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} - 2\\
\end{array}
\end{array}
if t < -3.3999999999999998e-83 or 9.9999999999999996e-82 < t Initial program 77.8%
Taylor expanded in t around inf 76.0%
if -3.3999999999999998e-83 < t < 9.9999999999999996e-82Initial program 96.8%
Taylor expanded in t around inf 97.0%
Taylor expanded in z around inf 57.7%
associate-*r/57.7%
metadata-eval57.7%
+-commutative57.7%
Simplified57.7%
Taylor expanded in x around 0 47.3%
Final simplification64.4%
(FPCore (x y z t) :precision binary64 (if (<= t -1.25e+27) -2.0 (if (<= t 2800000.0) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.25e+27) {
tmp = -2.0;
} else if (t <= 2800000.0) {
tmp = 2.0 / t;
} else {
tmp = -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 <= (-1.25d+27)) then
tmp = -2.0d0
else if (t <= 2800000.0d0) then
tmp = 2.0d0 / t
else
tmp = -2.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.25e+27) {
tmp = -2.0;
} else if (t <= 2800000.0) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.25e+27: tmp = -2.0 elif t <= 2800000.0: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.25e+27) tmp = -2.0; elseif (t <= 2800000.0) tmp = Float64(2.0 / t); else tmp = -2.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -1.25e+27) tmp = -2.0; elseif (t <= 2800000.0) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.25e+27], -2.0, If[LessEqual[t, 2800000.0], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+27}:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 2800000:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1.24999999999999995e27 or 2.8e6 < t Initial program 72.5%
Taylor expanded in t around inf 100.0%
Taylor expanded in z around inf 86.4%
associate-*r/86.4%
metadata-eval86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around 0 41.0%
Taylor expanded in t around inf 40.9%
if -1.24999999999999995e27 < t < 2.8e6Initial program 96.8%
Taylor expanded in t around 0 85.1%
associate-*r/85.1%
metadata-eval85.1%
Simplified85.1%
Taylor expanded in z around inf 38.5%
(FPCore (x y z t) :precision binary64 (+ (+ (/ x y) -2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
return ((x / y) + -2.0) + ((2.0 + (2.0 / z)) / 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 / y) + (-2.0d0)) + ((2.0d0 + (2.0d0 / z)) / t)
end function
public static double code(double x, double y, double z, double t) {
return ((x / y) + -2.0) + ((2.0 + (2.0 / z)) / t);
}
def code(x, y, z, t): return ((x / y) + -2.0) + ((2.0 + (2.0 / z)) / t)
function code(x, y, z, t) return Float64(Float64(Float64(x / y) + -2.0) + Float64(Float64(2.0 + Float64(2.0 / z)) / t)) end
function tmp = code(x, y, z, t) tmp = ((x / y) + -2.0) + ((2.0 + (2.0 / z)) / t); end
code[x_, y_, z_, t_] := N[(N[(N[(x / y), $MachinePrecision] + -2.0), $MachinePrecision] + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\frac{x}{y} + -2\right) + \frac{2 + \frac{2}{z}}{t}
\end{array}
Initial program 85.4%
+-commutative85.4%
remove-double-neg85.4%
distribute-frac-neg85.4%
unsub-neg85.4%
*-commutative85.4%
associate-*r*85.4%
distribute-rgt1-in85.4%
associate-/l*85.7%
fma-neg85.7%
*-commutative85.7%
fma-define85.7%
*-commutative85.7%
distribute-frac-neg85.7%
remove-double-neg85.7%
Simplified85.7%
Taylor expanded in t around inf 98.4%
associate--l+98.4%
+-commutative98.4%
sub-neg98.4%
metadata-eval98.4%
+-commutative98.4%
associate-*r/98.4%
distribute-lft-in98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t) :precision binary64 -2.0)
double code(double x, double y, double z, double t) {
return -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 = -2.0d0
end function
public static double code(double x, double y, double z, double t) {
return -2.0;
}
def code(x, y, z, t): return -2.0
function code(x, y, z, t) return -2.0 end
function tmp = code(x, y, z, t) tmp = -2.0; end
code[x_, y_, z_, t_] := -2.0
\begin{array}{l}
\\
-2
\end{array}
Initial program 85.4%
Taylor expanded in t around inf 98.4%
Taylor expanded in z around inf 69.8%
associate-*r/69.8%
metadata-eval69.8%
+-commutative69.8%
Simplified69.8%
Taylor expanded in x around 0 39.7%
Taylor expanded in t around inf 20.4%
(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 2024106
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:alt
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))