
(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 10 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 (/ 2.0 z)) t) 2.0)))
double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 + (2.0 / z)) / 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 + (2.0d0 / z)) / t) - 2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x / y) + (((2.0 + (2.0 / z)) / t) - 2.0);
}
def code(x, y, z, t): return (x / y) + (((2.0 + (2.0 / z)) / t) - 2.0)
function code(x, y, z, t) return Float64(Float64(x / y) + Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) - 2.0)) end
function tmp = code(x, y, z, t) tmp = (x / y) + (((2.0 + (2.0 / z)) / t) - 2.0); end
code[x_, y_, z_, t_] := N[(N[(x / y), $MachinePrecision] + N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y} + \left(\frac{2 + \frac{2}{z}}{t} - 2\right)
\end{array}
Initial program 82.3%
+-commutative82.3%
remove-double-neg82.3%
distribute-frac-neg82.3%
unsub-neg82.3%
*-commutative82.3%
associate-*r*82.3%
distribute-rgt1-in82.3%
associate-*r/82.3%
/-rgt-identity82.3%
fma-neg82.3%
/-rgt-identity82.3%
*-commutative82.3%
fma-define82.3%
*-commutative82.3%
distribute-frac-neg82.3%
remove-double-neg82.3%
Simplified82.3%
Taylor expanded in t around inf 98.8%
+-commutative98.8%
associate--l+98.8%
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
(let* ((t_1 (- (/ x y) 2.0)))
(if (<= z -2.1e+246)
t_1
(if (<= z -1.05e+105)
(+ (/ 2.0 t) -2.0)
(if (or (<= z -2.5e-92) (not (<= z 6.4e-21))) t_1 (/ 2.0 (* z t)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -2.1e+246) {
tmp = t_1;
} else if (z <= -1.05e+105) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -2.5e-92) || !(z <= 6.4e-21)) {
tmp = t_1;
} else {
tmp = 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) :: t_1
real(8) :: tmp
t_1 = (x / y) - 2.0d0
if (z <= (-2.1d+246)) then
tmp = t_1
else if (z <= (-1.05d+105)) then
tmp = (2.0d0 / t) + (-2.0d0)
else if ((z <= (-2.5d-92)) .or. (.not. (z <= 6.4d-21))) then
tmp = t_1
else
tmp = 2.0d0 / (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x / y) - 2.0;
double tmp;
if (z <= -2.1e+246) {
tmp = t_1;
} else if (z <= -1.05e+105) {
tmp = (2.0 / t) + -2.0;
} else if ((z <= -2.5e-92) || !(z <= 6.4e-21)) {
tmp = t_1;
} else {
tmp = 2.0 / (z * t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x / y) - 2.0 tmp = 0 if z <= -2.1e+246: tmp = t_1 elif z <= -1.05e+105: tmp = (2.0 / t) + -2.0 elif (z <= -2.5e-92) or not (z <= 6.4e-21): tmp = t_1 else: tmp = 2.0 / (z * t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x / y) - 2.0) tmp = 0.0 if (z <= -2.1e+246) tmp = t_1; elseif (z <= -1.05e+105) tmp = Float64(Float64(2.0 / t) + -2.0); elseif ((z <= -2.5e-92) || !(z <= 6.4e-21)) tmp = t_1; else tmp = Float64(2.0 / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x / y) - 2.0; tmp = 0.0; if (z <= -2.1e+246) tmp = t_1; elseif (z <= -1.05e+105) tmp = (2.0 / t) + -2.0; elseif ((z <= -2.5e-92) || ~((z <= 6.4e-21))) tmp = t_1; else tmp = 2.0 / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]}, If[LessEqual[z, -2.1e+246], t$95$1, If[LessEqual[z, -1.05e+105], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], If[Or[LessEqual[z, -2.5e-92], N[Not[LessEqual[z, 6.4e-21]], $MachinePrecision]], t$95$1, N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x}{y} - 2\\
\mathbf{if}\;z \leq -2.1 \cdot 10^{+246}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{+105}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{elif}\;z \leq -2.5 \cdot 10^{-92} \lor \neg \left(z \leq 6.4 \cdot 10^{-21}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -2.1e246 or -1.05000000000000005e105 < z < -2.50000000000000006e-92 or 6.4000000000000003e-21 < z Initial program 71.2%
Taylor expanded in t around inf 80.5%
if -2.1e246 < z < -1.05000000000000005e105Initial program 71.3%
+-commutative71.3%
remove-double-neg71.3%
distribute-frac-neg71.3%
unsub-neg71.3%
*-commutative71.3%
associate-*r*71.3%
distribute-rgt1-in71.3%
associate-*r/71.3%
/-rgt-identity71.3%
fma-neg71.3%
/-rgt-identity71.3%
*-commutative71.3%
fma-define71.3%
*-commutative71.3%
distribute-frac-neg71.3%
remove-double-neg71.3%
Simplified71.3%
Taylor expanded in t around inf 100.0%
+-commutative100.0%
associate--l+100.0%
associate-*r/100.0%
distribute-lft-in100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in x around 0 84.6%
sub-neg84.6%
associate-*r/84.6%
metadata-eval84.6%
*-commutative84.6%
associate-/r*84.6%
metadata-eval84.6%
associate-*r/84.6%
*-rgt-identity84.6%
associate-*r/84.6%
*-commutative84.6%
associate-*l*84.6%
associate-*r/84.6%
metadata-eval84.6%
distribute-lft-in84.6%
associate-*l/84.6%
*-lft-identity84.6%
metadata-eval84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in z around inf 84.6%
if -2.50000000000000006e-92 < z < 6.4000000000000003e-21Initial program 98.0%
+-commutative98.0%
remove-double-neg98.0%
distribute-frac-neg98.0%
unsub-neg98.0%
*-commutative98.0%
associate-*r*98.0%
distribute-rgt1-in98.0%
associate-*r/98.0%
/-rgt-identity98.0%
fma-neg98.0%
/-rgt-identity98.0%
*-commutative98.0%
fma-define98.0%
*-commutative98.0%
distribute-frac-neg98.0%
remove-double-neg98.0%
Simplified98.0%
Taylor expanded in t around inf 98.0%
+-commutative98.0%
associate--l+98.0%
associate-*r/97.1%
distribute-lft-in97.1%
metadata-eval97.1%
associate-*r/97.1%
metadata-eval97.1%
Simplified97.1%
Taylor expanded in z around 0 70.6%
Final simplification76.9%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -6.2e+234) (not (<= (/ x y) 6.5e+31))) (/ x y) (+ (/ (+ 2.0 (/ 2.0 z)) t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -6.2e+234) || !((x / y) <= 6.5e+31)) {
tmp = x / y;
} else {
tmp = ((2.0 + (2.0 / z)) / 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) <= (-6.2d+234)) .or. (.not. ((x / y) <= 6.5d+31))) then
tmp = x / y
else
tmp = ((2.0d0 + (2.0d0 / z)) / 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) <= -6.2e+234) || !((x / y) <= 6.5e+31)) {
tmp = x / y;
} else {
tmp = ((2.0 + (2.0 / z)) / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -6.2e+234) or not ((x / y) <= 6.5e+31): tmp = x / y else: tmp = ((2.0 + (2.0 / z)) / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -6.2e+234) || !(Float64(x / y) <= 6.5e+31)) tmp = Float64(x / y); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (((x / y) <= -6.2e+234) || ~(((x / y) <= 6.5e+31))) tmp = x / y; else tmp = ((2.0 + (2.0 / z)) / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -6.2e+234], N[Not[LessEqual[N[(x / y), $MachinePrecision], 6.5e+31]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -6.2 \cdot 10^{+234} \lor \neg \left(\frac{x}{y} \leq 6.5 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -6.19999999999999979e234 or 6.5000000000000004e31 < (/.f64 x y) Initial program 82.9%
Taylor expanded in x around inf 77.9%
if -6.19999999999999979e234 < (/.f64 x y) < 6.5000000000000004e31Initial program 82.0%
+-commutative82.0%
remove-double-neg82.0%
distribute-frac-neg82.0%
unsub-neg82.0%
*-commutative82.0%
associate-*r*82.0%
distribute-rgt1-in82.0%
associate-*r/81.9%
/-rgt-identity81.9%
fma-neg81.9%
/-rgt-identity81.9%
*-commutative81.9%
fma-define81.9%
*-commutative81.9%
distribute-frac-neg81.9%
remove-double-neg81.9%
Simplified81.9%
Taylor expanded in t around inf 99.9%
+-commutative99.9%
associate--l+99.9%
associate-*r/99.3%
distribute-lft-in99.3%
metadata-eval99.3%
associate-*r/99.3%
metadata-eval99.3%
Simplified99.3%
Taylor expanded in x around 0 90.2%
sub-neg90.2%
associate-*r/90.2%
metadata-eval90.2%
*-commutative90.2%
associate-/r*90.2%
metadata-eval90.2%
associate-*r/90.2%
*-rgt-identity90.2%
associate-*r/90.1%
*-commutative90.1%
associate-*l*89.6%
associate-*r/89.6%
metadata-eval89.6%
distribute-lft-in89.6%
associate-*l/89.6%
*-lft-identity89.6%
metadata-eval89.6%
+-commutative89.6%
Simplified89.6%
Final simplification85.6%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4.3e+33) (not (<= (/ x y) 72000.0))) (/ x y) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4.3e+33) || !((x / y) <= 72000.0)) {
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) <= (-4.3d+33)) .or. (.not. ((x / y) <= 72000.0d0))) 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) <= -4.3e+33) || !((x / y) <= 72000.0)) {
tmp = x / y;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4.3e+33) or not ((x / y) <= 72000.0): 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) <= -4.3e+33) || !(Float64(x / y) <= 72000.0)) 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) <= -4.3e+33) || ~(((x / y) <= 72000.0))) 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], -4.3e+33], N[Not[LessEqual[N[(x / y), $MachinePrecision], 72000.0]], $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 -4.3 \cdot 10^{+33} \lor \neg \left(\frac{x}{y} \leq 72000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -4.30000000000000028e33 or 72000 < (/.f64 x y) Initial program 83.7%
Taylor expanded in x around inf 69.0%
if -4.30000000000000028e33 < (/.f64 x y) < 72000Initial program 81.1%
+-commutative81.1%
remove-double-neg81.1%
distribute-frac-neg81.1%
unsub-neg81.1%
*-commutative81.1%
associate-*r*81.1%
distribute-rgt1-in81.1%
associate-*r/81.1%
/-rgt-identity81.1%
fma-neg81.1%
/-rgt-identity81.1%
*-commutative81.1%
fma-define81.1%
*-commutative81.1%
distribute-frac-neg81.1%
remove-double-neg81.1%
Simplified81.1%
Taylor expanded in t around inf 99.9%
+-commutative99.9%
associate--l+99.9%
associate-*r/99.2%
distribute-lft-in99.2%
metadata-eval99.2%
associate-*r/99.2%
metadata-eval99.2%
Simplified99.2%
Taylor expanded in x around 0 96.8%
sub-neg96.8%
associate-*r/96.8%
metadata-eval96.8%
*-commutative96.8%
associate-/r*96.7%
metadata-eval96.7%
associate-*r/96.7%
*-rgt-identity96.7%
associate-*r/96.7%
*-commutative96.7%
associate-*l*96.0%
associate-*r/96.0%
metadata-eval96.0%
distribute-lft-in96.0%
associate-*l/96.0%
*-lft-identity96.0%
metadata-eval96.0%
+-commutative96.0%
Simplified96.0%
Taylor expanded in z around inf 59.8%
Final simplification64.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4.2e-14) (not (<= (/ x y) 3.7e-17))) (- (/ x y) 2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4.2e-14) || !((x / y) <= 3.7e-17)) {
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 (((x / y) <= (-4.2d-14)) .or. (.not. ((x / y) <= 3.7d-17))) 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 (((x / y) <= -4.2e-14) || !((x / y) <= 3.7e-17)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4.2e-14) or not ((x / y) <= 3.7e-17): tmp = (x / y) - 2.0 else: tmp = (2.0 / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4.2e-14) || !(Float64(x / y) <= 3.7e-17)) 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 (((x / y) <= -4.2e-14) || ~(((x / y) <= 3.7e-17))) 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[N[(x / y), $MachinePrecision], -4.2e-14], N[Not[LessEqual[N[(x / y), $MachinePrecision], 3.7e-17]], $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}\;\frac{x}{y} \leq -4.2 \cdot 10^{-14} \lor \neg \left(\frac{x}{y} \leq 3.7 \cdot 10^{-17}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -4.1999999999999998e-14 or 3.6999999999999997e-17 < (/.f64 x y) Initial program 82.5%
Taylor expanded in t around inf 66.9%
if -4.1999999999999998e-14 < (/.f64 x y) < 3.6999999999999997e-17Initial program 82.1%
+-commutative82.1%
remove-double-neg82.1%
distribute-frac-neg82.1%
unsub-neg82.1%
*-commutative82.1%
associate-*r*82.1%
distribute-rgt1-in82.1%
associate-*r/82.0%
/-rgt-identity82.0%
fma-neg82.0%
/-rgt-identity82.0%
*-commutative82.0%
fma-define82.0%
*-commutative82.0%
distribute-frac-neg82.0%
remove-double-neg82.0%
Simplified82.0%
Taylor expanded in t around inf 99.9%
+-commutative99.9%
associate--l+99.9%
associate-*r/99.1%
distribute-lft-in99.1%
metadata-eval99.1%
associate-*r/99.1%
metadata-eval99.1%
Simplified99.1%
Taylor expanded in x around 0 99.9%
sub-neg99.9%
associate-*r/99.9%
metadata-eval99.9%
*-commutative99.9%
associate-/r*99.9%
metadata-eval99.9%
associate-*r/99.9%
*-rgt-identity99.9%
associate-*r/99.8%
*-commutative99.8%
associate-*l*99.1%
associate-*r/99.1%
metadata-eval99.1%
distribute-lft-in99.1%
associate-*l/99.1%
*-lft-identity99.1%
metadata-eval99.1%
+-commutative99.1%
Simplified99.1%
Taylor expanded in z around inf 63.1%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (or (<= z -4.4e-48) (not (<= z 3.9e-13))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ (+ 2.0 (/ 2.0 z)) t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e-48) || !(z <= 3.9e-13)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = ((2.0 + (2.0 / z)) / 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 ((z <= (-4.4d-48)) .or. (.not. (z <= 3.9d-13))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = ((2.0d0 + (2.0d0 / z)) / t) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -4.4e-48) || !(z <= 3.9e-13)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = ((2.0 + (2.0 / z)) / t) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -4.4e-48) or not (z <= 3.9e-13): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = ((2.0 + (2.0 / z)) / t) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -4.4e-48) || !(z <= 3.9e-13)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(Float64(2.0 + Float64(2.0 / z)) / t) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -4.4e-48) || ~((z <= 3.9e-13))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = ((2.0 + (2.0 / z)) / t) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -4.4e-48], N[Not[LessEqual[z, 3.9e-13]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{-48} \lor \neg \left(z \leq 3.9 \cdot 10^{-13}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t} + -2\\
\end{array}
\end{array}
if z < -4.40000000000000025e-48 or 3.90000000000000004e-13 < z Initial program 68.8%
Taylor expanded in z around inf 98.9%
div-sub98.9%
sub-neg98.9%
*-inverses98.9%
metadata-eval98.9%
distribute-lft-in98.9%
metadata-eval98.9%
associate-*r/98.9%
metadata-eval98.9%
Simplified98.9%
if -4.40000000000000025e-48 < z < 3.90000000000000004e-13Initial program 98.2%
+-commutative98.2%
remove-double-neg98.2%
distribute-frac-neg98.2%
unsub-neg98.2%
*-commutative98.2%
associate-*r*98.2%
distribute-rgt1-in98.2%
associate-*r/98.2%
/-rgt-identity98.2%
fma-neg98.2%
/-rgt-identity98.2%
*-commutative98.2%
fma-define98.2%
*-commutative98.2%
distribute-frac-neg98.2%
remove-double-neg98.2%
Simplified98.2%
Taylor expanded in t around inf 98.2%
+-commutative98.2%
associate--l+98.2%
associate-*r/97.3%
distribute-lft-in97.3%
metadata-eval97.3%
associate-*r/97.3%
metadata-eval97.3%
Simplified97.3%
Taylor expanded in x around 0 79.8%
sub-neg79.8%
associate-*r/79.8%
metadata-eval79.8%
*-commutative79.8%
associate-/r*79.8%
metadata-eval79.8%
associate-*r/79.8%
*-rgt-identity79.8%
associate-*r/79.7%
*-commutative79.7%
associate-*l*78.9%
associate-*r/78.9%
metadata-eval78.9%
distribute-lft-in78.9%
associate-*l/79.0%
*-lft-identity79.0%
metadata-eval79.0%
+-commutative79.0%
Simplified79.0%
Final simplification89.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5e-55) (not (<= z 9.5e-21))) (+ (/ x y) (+ (/ 2.0 t) -2.0)) (+ (/ x y) (/ 2.0 (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5e-55) || !(z <= 9.5e-21)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + (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 ((z <= (-5d-55)) .or. (.not. (z <= 9.5d-21))) then
tmp = (x / y) + ((2.0d0 / t) + (-2.0d0))
else
tmp = (x / y) + (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 ((z <= -5e-55) || !(z <= 9.5e-21)) {
tmp = (x / y) + ((2.0 / t) + -2.0);
} else {
tmp = (x / y) + (2.0 / (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5e-55) or not (z <= 9.5e-21): tmp = (x / y) + ((2.0 / t) + -2.0) else: tmp = (x / y) + (2.0 / (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5e-55) || !(z <= 9.5e-21)) tmp = Float64(Float64(x / y) + Float64(Float64(2.0 / t) + -2.0)); else tmp = Float64(Float64(x / y) + Float64(2.0 / Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -5e-55) || ~((z <= 9.5e-21))) tmp = (x / y) + ((2.0 / t) + -2.0); else tmp = (x / y) + (2.0 / (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5e-55], N[Not[LessEqual[z, 9.5e-21]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] + N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision], N[(N[(x / y), $MachinePrecision] + N[(2.0 / N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-55} \lor \neg \left(z \leq 9.5 \cdot 10^{-21}\right):\\
\;\;\;\;\frac{x}{y} + \left(\frac{2}{t} + -2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} + \frac{2}{z \cdot t}\\
\end{array}
\end{array}
if z < -5.0000000000000002e-55 or 9.4999999999999994e-21 < z Initial program 70.0%
Taylor expanded in z around inf 98.3%
div-sub98.3%
sub-neg98.3%
*-inverses98.3%
metadata-eval98.3%
distribute-lft-in98.3%
metadata-eval98.3%
associate-*r/98.3%
metadata-eval98.3%
Simplified98.3%
if -5.0000000000000002e-55 < z < 9.4999999999999994e-21Initial program 98.1%
Taylor expanded in z around 0 88.4%
Final simplification94.0%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -4e+35) (not (<= (/ x y) 22000.0))) (/ x y) (/ 2.0 t)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -4e+35) || !((x / y) <= 22000.0)) {
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 (((x / y) <= (-4d+35)) .or. (.not. ((x / y) <= 22000.0d0))) 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 (((x / y) <= -4e+35) || !((x / y) <= 22000.0)) {
tmp = x / y;
} else {
tmp = 2.0 / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -4e+35) or not ((x / y) <= 22000.0): tmp = x / y else: tmp = 2.0 / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -4e+35) || !(Float64(x / y) <= 22000.0)) 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 (((x / y) <= -4e+35) || ~(((x / y) <= 22000.0))) tmp = x / y; else tmp = 2.0 / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -4e+35], N[Not[LessEqual[N[(x / y), $MachinePrecision], 22000.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], N[(2.0 / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -4 \cdot 10^{+35} \lor \neg \left(\frac{x}{y} \leq 22000\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -3.9999999999999999e35 or 22000 < (/.f64 x y) Initial program 83.7%
Taylor expanded in x around inf 69.0%
if -3.9999999999999999e35 < (/.f64 x y) < 22000Initial program 81.1%
Taylor expanded in t around 0 53.8%
associate-*r/53.8%
metadata-eval53.8%
Simplified53.8%
Taylor expanded in z around inf 17.6%
Final simplification41.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -6.6e-97) (not (<= t 7.8))) (- (/ x y) 2.0) (/ (+ 2.0 (/ 2.0 z)) t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -6.6e-97) || !(t <= 7.8)) {
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 <= (-6.6d-97)) .or. (.not. (t <= 7.8d0))) 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 <= -6.6e-97) || !(t <= 7.8)) {
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 <= -6.6e-97) or not (t <= 7.8): 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 <= -6.6e-97) || !(t <= 7.8)) 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 <= -6.6e-97) || ~((t <= 7.8))) 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, -6.6e-97], N[Not[LessEqual[t, 7.8]], $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 -6.6 \cdot 10^{-97} \lor \neg \left(t \leq 7.8\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if t < -6.6000000000000002e-97 or 7.79999999999999982 < t Initial program 72.0%
Taylor expanded in t around inf 84.5%
if -6.6000000000000002e-97 < t < 7.79999999999999982Initial program 97.0%
Taylor expanded in t around 0 83.9%
associate-*r/83.9%
metadata-eval83.9%
Simplified83.9%
Final simplification84.3%
(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 82.3%
Taylor expanded in t around 0 44.9%
associate-*r/44.9%
metadata-eval44.9%
Simplified44.9%
Taylor expanded in z around inf 14.9%
Final simplification14.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 2024036
(FPCore (x y z t)
:name "Data.HashTable.ST.Basic:computeOverhead from hashtables-1.2.0.2"
:precision binary64
:herbie-target
(- (/ (+ (/ 2.0 z) 2.0) t) (- 2.0 (/ x y)))
(+ (/ x y) (/ (+ 2.0 (* (* z 2.0) (- 1.0 t))) (* t z))))