
(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 (* t z)) (/ 2.0 t)) (/ x y)) -2.0))
double code(double x, double y, double z, double t) {
return (((2.0 / (t * z)) + (2.0 / t)) + (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 / (t * z)) + (2.0d0 / t)) + (x / y)) + (-2.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (((2.0 / (t * z)) + (2.0 / t)) + (x / y)) + -2.0;
}
def code(x, y, z, t): return (((2.0 / (t * z)) + (2.0 / t)) + (x / y)) + -2.0
function code(x, y, z, t) return Float64(Float64(Float64(Float64(2.0 / Float64(t * z)) + Float64(2.0 / t)) + Float64(x / y)) + -2.0) end
function tmp = code(x, y, z, t) tmp = (((2.0 / (t * z)) + (2.0 / t)) + (x / y)) + -2.0; end
code[x_, y_, z_, t_] := N[(N[(N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(2.0 / t), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(\frac{2}{t \cdot z} + \frac{2}{t}\right) + \frac{x}{y}\right) + -2
\end{array}
Initial program 87.8%
Taylor expanded in t around 0 98.4%
sub-neg98.4%
associate-+r+98.4%
metadata-eval98.4%
associate-*r/98.4%
+-commutative98.4%
associate-*r/98.4%
metadata-eval98.4%
associate-*r/98.4%
metadata-eval98.4%
metadata-eval98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t)
:precision binary64
(if (<= (/ x y) -1.7e+69)
(/ x y)
(if (<= (/ x y) -46000000.0)
(/ (+ 2.0 (/ 2.0 z)) t)
(if (or (<= (/ x y) -0.0155) (not (<= (/ x y) 4.8e+51)))
(- (/ x y) 2.0)
(+ (/ 2.0 (* t z)) -2.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.7e+69) {
tmp = x / y;
} else if ((x / y) <= -46000000.0) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (((x / y) <= -0.0155) || !((x / y) <= 4.8e+51)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / (t * z)) + -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) <= (-1.7d+69)) then
tmp = x / y
else if ((x / y) <= (-46000000.0d0)) then
tmp = (2.0d0 + (2.0d0 / z)) / t
else if (((x / y) <= (-0.0155d0)) .or. (.not. ((x / y) <= 4.8d+51))) then
tmp = (x / y) - 2.0d0
else
tmp = (2.0d0 / (t * z)) + (-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) <= -1.7e+69) {
tmp = x / y;
} else if ((x / y) <= -46000000.0) {
tmp = (2.0 + (2.0 / z)) / t;
} else if (((x / y) <= -0.0155) || !((x / y) <= 4.8e+51)) {
tmp = (x / y) - 2.0;
} else {
tmp = (2.0 / (t * z)) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.7e+69: tmp = x / y elif (x / y) <= -46000000.0: tmp = (2.0 + (2.0 / z)) / t elif ((x / y) <= -0.0155) or not ((x / y) <= 4.8e+51): tmp = (x / y) - 2.0 else: tmp = (2.0 / (t * z)) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.7e+69) tmp = Float64(x / y); elseif (Float64(x / y) <= -46000000.0) tmp = Float64(Float64(2.0 + Float64(2.0 / z)) / t); elseif ((Float64(x / y) <= -0.0155) || !(Float64(x / y) <= 4.8e+51)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(Float64(2.0 / Float64(t * z)) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -1.7e+69) tmp = x / y; elseif ((x / y) <= -46000000.0) tmp = (2.0 + (2.0 / z)) / t; elseif (((x / y) <= -0.0155) || ~(((x / y) <= 4.8e+51))) tmp = (x / y) - 2.0; else tmp = (2.0 / (t * z)) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.7e+69], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], -46000000.0], N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[Or[LessEqual[N[(x / y), $MachinePrecision], -0.0155], N[Not[LessEqual[N[(x / y), $MachinePrecision], 4.8e+51]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.7 \cdot 10^{+69}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq -46000000:\\
\;\;\;\;\frac{2 + \frac{2}{z}}{t}\\
\mathbf{elif}\;\frac{x}{y} \leq -0.0155 \lor \neg \left(\frac{x}{y} \leq 4.8 \cdot 10^{+51}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -1.69999999999999993e69Initial program 78.0%
Taylor expanded in x around inf 82.0%
if -1.69999999999999993e69 < (/.f64 x y) < -4.6e7Initial program 91.5%
Taylor expanded in t around 0 76.8%
associate-*r/76.8%
metadata-eval76.8%
Simplified76.8%
if -4.6e7 < (/.f64 x y) < -0.0155 or 4.7999999999999997e51 < (/.f64 x y) Initial program 90.9%
Taylor expanded in t around inf 85.5%
if -0.0155 < (/.f64 x y) < 4.7999999999999997e51Initial program 89.7%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 77.8%
*-commutative77.8%
Simplified77.8%
Final simplification80.2%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -5.2e+24) (not (<= (/ x y) 1.42e+35))) (+ (/ 2.0 (* t z)) (/ x y)) (+ -2.0 (/ (+ 2.0 (/ 2.0 z)) t))))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -5.2e+24) || !((x / y) <= 1.42e+35)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = -2.0 + ((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 (((x / y) <= (-5.2d+24)) .or. (.not. ((x / y) <= 1.42d+35))) then
tmp = (2.0d0 / (t * z)) + (x / y)
else
tmp = (-2.0d0) + ((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 (((x / y) <= -5.2e+24) || !((x / y) <= 1.42e+35)) {
tmp = (2.0 / (t * z)) + (x / y);
} else {
tmp = -2.0 + ((2.0 + (2.0 / z)) / t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if ((x / y) <= -5.2e+24) or not ((x / y) <= 1.42e+35): tmp = (2.0 / (t * z)) + (x / y) else: tmp = -2.0 + ((2.0 + (2.0 / z)) / t) return tmp
function code(x, y, z, t) tmp = 0.0 if ((Float64(x / y) <= -5.2e+24) || !(Float64(x / y) <= 1.42e+35)) tmp = Float64(Float64(2.0 / Float64(t * z)) + Float64(x / y)); else tmp = Float64(-2.0 + 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 (((x / y) <= -5.2e+24) || ~(((x / y) <= 1.42e+35))) tmp = (2.0 / (t * z)) + (x / y); else tmp = -2.0 + ((2.0 + (2.0 / z)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[N[(x / y), $MachinePrecision], -5.2e+24], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.42e+35]], $MachinePrecision]], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision], N[(-2.0 + N[(N[(2.0 + N[(2.0 / z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -5.2 \cdot 10^{+24} \lor \neg \left(\frac{x}{y} \leq 1.42 \cdot 10^{+35}\right):\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;-2 + \frac{2 + \frac{2}{z}}{t}\\
\end{array}
\end{array}
if (/.f64 x y) < -5.1999999999999997e24 or 1.41999999999999991e35 < (/.f64 x y) Initial program 84.9%
Taylor expanded in z around 0 90.1%
if -5.1999999999999997e24 < (/.f64 x y) < 1.41999999999999991e35Initial program 90.0%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in t around 0 95.2%
associate-*r/95.2%
metadata-eval95.2%
Simplified95.2%
Final simplification93.0%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -9.5e+77) (/ x y) (if (<= (/ x y) 4.6e+51) (+ (/ 2.0 (* t z)) -2.0) (- (/ x y) 2.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -9.5e+77) {
tmp = x / y;
} else if ((x / y) <= 4.6e+51) {
tmp = (2.0 / (t * z)) + -2.0;
} 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 ((x / y) <= (-9.5d+77)) then
tmp = x / y
else if ((x / y) <= 4.6d+51) then
tmp = (2.0d0 / (t * z)) + (-2.0d0)
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 ((x / y) <= -9.5e+77) {
tmp = x / y;
} else if ((x / y) <= 4.6e+51) {
tmp = (2.0 / (t * z)) + -2.0;
} else {
tmp = (x / y) - 2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -9.5e+77: tmp = x / y elif (x / y) <= 4.6e+51: tmp = (2.0 / (t * z)) + -2.0 else: tmp = (x / y) - 2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -9.5e+77) tmp = Float64(x / y); elseif (Float64(x / y) <= 4.6e+51) tmp = Float64(Float64(2.0 / Float64(t * z)) + -2.0); else tmp = Float64(Float64(x / y) - 2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x / y) <= -9.5e+77) tmp = x / y; elseif ((x / y) <= 4.6e+51) tmp = (2.0 / (t * z)) + -2.0; else tmp = (x / y) - 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -9.5e+77], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 4.6e+51], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -9.5 \cdot 10^{+77}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 4.6 \cdot 10^{+51}:\\
\;\;\;\;\frac{2}{t \cdot z} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y} - 2\\
\end{array}
\end{array}
if (/.f64 x y) < -9.4999999999999998e77Initial program 79.2%
Taylor expanded in x around inf 83.2%
if -9.4999999999999998e77 < (/.f64 x y) < 4.6000000000000001e51Initial program 89.5%
Taylor expanded in t around 0 99.9%
sub-neg99.9%
associate-+r+99.9%
metadata-eval99.9%
associate-*r/99.9%
+-commutative99.9%
associate-*r/99.9%
metadata-eval99.9%
associate-*r/99.9%
metadata-eval99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in z around 0 75.1%
*-commutative75.1%
Simplified75.1%
if 4.6000000000000001e51 < (/.f64 x y) Initial program 90.4%
Taylor expanded in t around inf 84.6%
Final simplification78.5%
(FPCore (x y z t) :precision binary64 (if (or (<= (/ x y) -0.00155) (not (<= (/ x y) 1.02e-7))) (- (/ x y) 2.0) (+ (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (((x / y) <= -0.00155) || !((x / y) <= 1.02e-7)) {
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) <= (-0.00155d0)) .or. (.not. ((x / y) <= 1.02d-7))) 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) <= -0.00155) || !((x / y) <= 1.02e-7)) {
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) <= -0.00155) or not ((x / y) <= 1.02e-7): 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) <= -0.00155) || !(Float64(x / y) <= 1.02e-7)) 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) <= -0.00155) || ~(((x / y) <= 1.02e-7))) 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], -0.00155], N[Not[LessEqual[N[(x / y), $MachinePrecision], 1.02e-7]], $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 -0.00155 \lor \neg \left(\frac{x}{y} \leq 1.02 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t} + -2\\
\end{array}
\end{array}
if (/.f64 x y) < -0.00154999999999999995 or 1.02e-7 < (/.f64 x y) Initial program 86.2%
Taylor expanded in t around inf 72.5%
if -0.00154999999999999995 < (/.f64 x y) < 1.02e-7Initial program 89.4%
Taylor expanded in z around inf 59.9%
associate-*r/59.9%
sub-neg59.9%
distribute-rgt-in59.9%
metadata-eval59.9%
distribute-lft-neg-out59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in x around 0 59.6%
sub-neg59.6%
associate-*r/59.6%
metadata-eval59.6%
metadata-eval59.6%
Simplified59.6%
Final simplification66.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.6e-14) (not (<= z 4.7e-49))) (+ -2.0 (+ (/ 2.0 t) (/ x y))) (+ (/ 2.0 (* t z)) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-14) || !(z <= 4.7e-49)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = (2.0 / (t * z)) + -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 <= (-1.6d-14)) .or. (.not. (z <= 4.7d-49))) then
tmp = (-2.0d0) + ((2.0d0 / t) + (x / y))
else
tmp = (2.0d0 / (t * z)) + (-2.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.6e-14) || !(z <= 4.7e-49)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = (2.0 / (t * z)) + -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.6e-14) or not (z <= 4.7e-49): tmp = -2.0 + ((2.0 / t) + (x / y)) else: tmp = (2.0 / (t * z)) + -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.6e-14) || !(z <= 4.7e-49)) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) + Float64(x / y))); else tmp = Float64(Float64(2.0 / Float64(t * z)) + -2.0); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.6e-14) || ~((z <= 4.7e-49))) tmp = -2.0 + ((2.0 / t) + (x / y)); else tmp = (2.0 / (t * z)) + -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.6e-14], N[Not[LessEqual[z, 4.7e-49]], $MachinePrecision]], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-14} \lor \neg \left(z \leq 4.7 \cdot 10^{-49}\right):\\
\;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + -2\\
\end{array}
\end{array}
if z < -1.6000000000000001e-14 or 4.70000000000000021e-49 < z Initial program 80.8%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 98.1%
associate-*r/98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
if -1.6000000000000001e-14 < z < 4.70000000000000021e-49Initial program 96.4%
Taylor expanded in t around 0 96.4%
sub-neg96.4%
associate-+r+96.4%
metadata-eval96.4%
associate-*r/96.4%
+-commutative96.4%
associate-*r/96.4%
metadata-eval96.4%
associate-*r/96.4%
metadata-eval96.4%
metadata-eval96.4%
Simplified96.4%
Taylor expanded in z around 0 78.7%
*-commutative78.7%
Simplified78.7%
Final simplification89.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -3.2e-31) (not (<= z 2.2e-33))) (+ -2.0 (+ (/ 2.0 t) (/ x y))) (+ (/ 2.0 (* t z)) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -3.2e-31) || !(z <= 2.2e-33)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} 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 <= (-3.2d-31)) .or. (.not. (z <= 2.2d-33))) then
tmp = (-2.0d0) + ((2.0d0 / t) + (x / y))
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 <= -3.2e-31) || !(z <= 2.2e-33)) {
tmp = -2.0 + ((2.0 / t) + (x / y));
} else {
tmp = (2.0 / (t * z)) + (x / y);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -3.2e-31) or not (z <= 2.2e-33): tmp = -2.0 + ((2.0 / t) + (x / y)) else: tmp = (2.0 / (t * z)) + (x / y) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -3.2e-31) || !(z <= 2.2e-33)) tmp = Float64(-2.0 + Float64(Float64(2.0 / t) + Float64(x / y))); 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 <= -3.2e-31) || ~((z <= 2.2e-33))) tmp = -2.0 + ((2.0 / t) + (x / y)); else tmp = (2.0 / (t * z)) + (x / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -3.2e-31], N[Not[LessEqual[z, 2.2e-33]], $MachinePrecision]], N[(-2.0 + N[(N[(2.0 / t), $MachinePrecision] + N[(x / y), $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 -3.2 \cdot 10^{-31} \lor \neg \left(z \leq 2.2 \cdot 10^{-33}\right):\\
\;\;\;\;-2 + \left(\frac{2}{t} + \frac{x}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z} + \frac{x}{y}\\
\end{array}
\end{array}
if z < -3.20000000000000018e-31 or 2.20000000000000005e-33 < z Initial program 80.7%
Taylor expanded in t around 0 100.0%
sub-neg100.0%
associate-+r+100.0%
metadata-eval100.0%
associate-*r/100.0%
+-commutative100.0%
associate-*r/100.0%
metadata-eval100.0%
associate-*r/100.0%
metadata-eval100.0%
metadata-eval100.0%
Simplified100.0%
Taylor expanded in z around inf 98.1%
associate-*r/98.1%
metadata-eval98.1%
+-commutative98.1%
Simplified98.1%
if -3.20000000000000018e-31 < z < 2.20000000000000005e-33Initial program 96.4%
Taylor expanded in z around 0 85.6%
Final simplification92.5%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -1.1e+17) (/ x y) (if (<= (/ x y) 1.25e+35) (+ (/ 2.0 t) -2.0) (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -1.1e+17) {
tmp = x / y;
} else if ((x / y) <= 1.25e+35) {
tmp = (2.0 / t) + -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) <= (-1.1d+17)) then
tmp = x / y
else if ((x / y) <= 1.25d+35) then
tmp = (2.0d0 / t) + (-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) <= -1.1e+17) {
tmp = x / y;
} else if ((x / y) <= 1.25e+35) {
tmp = (2.0 / t) + -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -1.1e+17: tmp = x / y elif (x / y) <= 1.25e+35: tmp = (2.0 / t) + -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -1.1e+17) tmp = Float64(x / y); elseif (Float64(x / y) <= 1.25e+35) tmp = Float64(Float64(2.0 / t) + -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) <= -1.1e+17) tmp = x / y; elseif ((x / y) <= 1.25e+35) tmp = (2.0 / t) + -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -1.1e+17], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1.25e+35], N[(N[(2.0 / t), $MachinePrecision] + -2.0), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -1.1 \cdot 10^{+17}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1.25 \cdot 10^{+35}:\\
\;\;\;\;\frac{2}{t} + -2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -1.1e17 or 1.25000000000000005e35 < (/.f64 x y) Initial program 85.1%
Taylor expanded in x around inf 77.5%
if -1.1e17 < (/.f64 x y) < 1.25000000000000005e35Initial program 89.9%
Taylor expanded in z around inf 59.9%
associate-*r/59.9%
sub-neg59.9%
distribute-rgt-in59.9%
metadata-eval59.9%
distribute-lft-neg-out59.9%
unsub-neg59.9%
Simplified59.9%
Taylor expanded in x around 0 55.2%
sub-neg55.2%
associate-*r/55.2%
metadata-eval55.2%
metadata-eval55.2%
Simplified55.2%
Final simplification65.1%
(FPCore (x y z t) :precision binary64 (if (<= (/ x y) -2.0) (/ x y) (if (<= (/ x y) 1750.0) -2.0 (/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((x / y) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 1750.0) {
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) <= (-2.0d0)) then
tmp = x / y
else if ((x / y) <= 1750.0d0) 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) <= -2.0) {
tmp = x / y;
} else if ((x / y) <= 1750.0) {
tmp = -2.0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x / y) <= -2.0: tmp = x / y elif (x / y) <= 1750.0: tmp = -2.0 else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(x / y) <= -2.0) tmp = Float64(x / y); elseif (Float64(x / y) <= 1750.0) 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) <= -2.0) tmp = x / y; elseif ((x / y) <= 1750.0) tmp = -2.0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(x / y), $MachinePrecision], -2.0], N[(x / y), $MachinePrecision], If[LessEqual[N[(x / y), $MachinePrecision], 1750.0], -2.0, N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\frac{x}{y} \leq -2:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;\frac{x}{y} \leq 1750:\\
\;\;\;\;-2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if (/.f64 x y) < -2 or 1750 < (/.f64 x y) Initial program 85.6%
Taylor expanded in x around inf 72.6%
if -2 < (/.f64 x y) < 1750Initial program 89.8%
Taylor expanded in t around inf 40.1%
Taylor expanded in x around 0 38.5%
Final simplification55.2%
(FPCore (x y z t) :precision binary64 (if (or (<= z -8.5e-32) (not (<= z 1.65e-46))) (- (/ x y) 2.0) (/ 2.0 (* t z))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -8.5e-32) || !(z <= 1.65e-46)) {
tmp = (x / y) - 2.0;
} else {
tmp = 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 <= (-8.5d-32)) .or. (.not. (z <= 1.65d-46))) then
tmp = (x / y) - 2.0d0
else
tmp = 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 <= -8.5e-32) || !(z <= 1.65e-46)) {
tmp = (x / y) - 2.0;
} else {
tmp = 2.0 / (t * z);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -8.5e-32) or not (z <= 1.65e-46): tmp = (x / y) - 2.0 else: tmp = 2.0 / (t * z) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -8.5e-32) || !(z <= 1.65e-46)) tmp = Float64(Float64(x / y) - 2.0); else tmp = Float64(2.0 / Float64(t * z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -8.5e-32) || ~((z <= 1.65e-46))) tmp = (x / y) - 2.0; else tmp = 2.0 / (t * z); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -8.5e-32], N[Not[LessEqual[z, 1.65e-46]], $MachinePrecision]], N[(N[(x / y), $MachinePrecision] - 2.0), $MachinePrecision], N[(2.0 / N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.5 \cdot 10^{-32} \lor \neg \left(z \leq 1.65 \cdot 10^{-46}\right):\\
\;\;\;\;\frac{x}{y} - 2\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{t \cdot z}\\
\end{array}
\end{array}
if z < -8.5000000000000003e-32 or 1.65000000000000007e-46 < z Initial program 81.1%
Taylor expanded in t around inf 73.2%
if -8.5000000000000003e-32 < z < 1.65000000000000007e-46Initial program 96.3%
Taylor expanded in t around 0 67.9%
associate-*r/67.9%
metadata-eval67.9%
Simplified67.9%
Taylor expanded in z around 0 67.9%
Taylor expanded in z around 0 67.9%
Final simplification70.9%
(FPCore (x y z t) :precision binary64 (if (<= t -1.3) -2.0 (if (<= t 0.96) (/ 2.0 t) -2.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -1.3) {
tmp = -2.0;
} else if (t <= 0.96) {
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.3d0)) then
tmp = -2.0d0
else if (t <= 0.96d0) 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.3) {
tmp = -2.0;
} else if (t <= 0.96) {
tmp = 2.0 / t;
} else {
tmp = -2.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -1.3: tmp = -2.0 elif t <= 0.96: tmp = 2.0 / t else: tmp = -2.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -1.3) tmp = -2.0; elseif (t <= 0.96) 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.3) tmp = -2.0; elseif (t <= 0.96) tmp = 2.0 / t; else tmp = -2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -1.3], -2.0, If[LessEqual[t, 0.96], N[(2.0 / t), $MachinePrecision], -2.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3:\\
\;\;\;\;-2\\
\mathbf{elif}\;t \leq 0.96:\\
\;\;\;\;\frac{2}{t}\\
\mathbf{else}:\\
\;\;\;\;-2\\
\end{array}
\end{array}
if t < -1.30000000000000004 or 0.95999999999999996 < t Initial program 78.5%
Taylor expanded in t around inf 82.7%
Taylor expanded in x around 0 40.5%
if -1.30000000000000004 < t < 0.95999999999999996Initial program 96.7%
Taylor expanded in t around 0 70.1%
associate-*r/70.1%
metadata-eval70.1%
Simplified70.1%
Taylor expanded in z around inf 25.3%
Final simplification32.8%
(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 87.8%
Taylor expanded in t around inf 56.4%
Taylor expanded in x around 0 21.1%
Final simplification21.1%
(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 2023293
(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))))