
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- (+ x y) (/ (* (- z t) y) (- a t))))
double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = (x + y) - (((z - t) * y) / (a - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x + y) - (((z - t) * y) / (a - t));
}
def code(x, y, z, t, a): return (x + y) - (((z - t) * y) / (a - t))
function code(x, y, z, t, a) return Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) end
function tmp = code(x, y, z, t, a) tmp = (x + y) - (((z - t) * y) / (a - t)); end
code[x_, y_, z_, t_, a_] := N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (* y (+ (/ z (- a t)) (- -1.0 (/ t (- a t)))))))
double code(double x, double y, double z, double t, double a) {
return x - (y * ((z / (a - t)) + (-1.0 - (t / (a - t)))));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - (y * ((z / (a - t)) + ((-1.0d0) - (t / (a - t)))))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y * ((z / (a - t)) + (-1.0 - (t / (a - t)))));
}
def code(x, y, z, t, a): return x - (y * ((z / (a - t)) + (-1.0 - (t / (a - t)))))
function code(x, y, z, t, a) return Float64(x - Float64(y * Float64(Float64(z / Float64(a - t)) + Float64(-1.0 - Float64(t / Float64(a - t)))))) end
function tmp = code(x, y, z, t, a) tmp = x - (y * ((z / (a - t)) + (-1.0 - (t / (a - t))))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y * N[(N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision] + N[(-1.0 - N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - y \cdot \left(\frac{z}{a - t} + \left(-1 - \frac{t}{a - t}\right)\right)
\end{array}
Initial program 72.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in y around 0 95.4%
Final simplification95.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (+ y x) (/ (* y (- t z)) (- a t)))))
(if (<= t_1 -5e-272)
(+ x (- y (* (- z t) (/ y (- a t)))))
(if (<= t_1 0.0)
(- x (/ (* y (- a z)) t))
(+ x (+ y (/ (- t z) (/ (- a t) y))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) + ((y * (t - z)) / (a - t));
double tmp;
if (t_1 <= -5e-272) {
tmp = x + (y - ((z - t) * (y / (a - t))));
} else if (t_1 <= 0.0) {
tmp = x - ((y * (a - z)) / t);
} else {
tmp = x + (y + ((t - z) / ((a - t) / y)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (y + x) + ((y * (t - z)) / (a - t))
if (t_1 <= (-5d-272)) then
tmp = x + (y - ((z - t) * (y / (a - t))))
else if (t_1 <= 0.0d0) then
tmp = x - ((y * (a - z)) / t)
else
tmp = x + (y + ((t - z) / ((a - t) / y)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) + ((y * (t - z)) / (a - t));
double tmp;
if (t_1 <= -5e-272) {
tmp = x + (y - ((z - t) * (y / (a - t))));
} else if (t_1 <= 0.0) {
tmp = x - ((y * (a - z)) / t);
} else {
tmp = x + (y + ((t - z) / ((a - t) / y)));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) + ((y * (t - z)) / (a - t)) tmp = 0 if t_1 <= -5e-272: tmp = x + (y - ((z - t) * (y / (a - t)))) elif t_1 <= 0.0: tmp = x - ((y * (a - z)) / t) else: tmp = x + (y + ((t - z) / ((a - t) / y))) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) + Float64(Float64(y * Float64(t - z)) / Float64(a - t))) tmp = 0.0 if (t_1 <= -5e-272) tmp = Float64(x + Float64(y - Float64(Float64(z - t) * Float64(y / Float64(a - t))))); elseif (t_1 <= 0.0) tmp = Float64(x - Float64(Float64(y * Float64(a - z)) / t)); else tmp = Float64(x + Float64(y + Float64(Float64(t - z) / Float64(Float64(a - t) / y)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) + ((y * (t - z)) / (a - t)); tmp = 0.0; if (t_1 <= -5e-272) tmp = x + (y - ((z - t) * (y / (a - t)))); elseif (t_1 <= 0.0) tmp = x - ((y * (a - z)) / t); else tmp = x + (y + ((t - z) / ((a - t) / y))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-272], N[(x + N[(y - N[(N[(z - t), $MachinePrecision] * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(x - N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(x + N[(y + N[(N[(t - z), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) + \frac{y \cdot \left(t - z\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-272}:\\
\;\;\;\;x + \left(y - \left(z - t\right) \cdot \frac{y}{a - t}\right)\\
\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;x - \frac{y \cdot \left(a - z\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y + \frac{t - z}{\frac{a - t}{y}}\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -4.99999999999999982e-272Initial program 75.3%
associate--l+75.3%
associate-/l*91.7%
Simplified91.7%
div-inv91.6%
clear-num92.5%
Applied egg-rr92.5%
if -4.99999999999999982e-272 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 0.0Initial program 4.1%
associate-*l/4.1%
Simplified4.1%
Taylor expanded in t around -inf 99.8%
+-commutative99.8%
mul-1-neg99.8%
unsub-neg99.8%
distribute-lft-out--99.7%
Simplified99.7%
if 0.0 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 80.6%
associate--l+80.6%
associate-/l*93.3%
Simplified93.3%
Final simplification93.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ z t)))))
(if (<= a -8.8e+101)
(+ y x)
(if (<= a -3.7e-22)
(- x (* z (/ y a)))
(if (<= a 1.02e+18)
t_1
(if (<= a 1.02e+45)
(- y (/ (* y z) a))
(if (<= a 1.2e+51) t_1 (+ y x))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / t));
double tmp;
if (a <= -8.8e+101) {
tmp = y + x;
} else if (a <= -3.7e-22) {
tmp = x - (z * (y / a));
} else if (a <= 1.02e+18) {
tmp = t_1;
} else if (a <= 1.02e+45) {
tmp = y - ((y * z) / a);
} else if (a <= 1.2e+51) {
tmp = t_1;
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = x + (y * (z / t))
if (a <= (-8.8d+101)) then
tmp = y + x
else if (a <= (-3.7d-22)) then
tmp = x - (z * (y / a))
else if (a <= 1.02d+18) then
tmp = t_1
else if (a <= 1.02d+45) then
tmp = y - ((y * z) / a)
else if (a <= 1.2d+51) then
tmp = t_1
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * (z / t));
double tmp;
if (a <= -8.8e+101) {
tmp = y + x;
} else if (a <= -3.7e-22) {
tmp = x - (z * (y / a));
} else if (a <= 1.02e+18) {
tmp = t_1;
} else if (a <= 1.02e+45) {
tmp = y - ((y * z) / a);
} else if (a <= 1.2e+51) {
tmp = t_1;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * (z / t)) tmp = 0 if a <= -8.8e+101: tmp = y + x elif a <= -3.7e-22: tmp = x - (z * (y / a)) elif a <= 1.02e+18: tmp = t_1 elif a <= 1.02e+45: tmp = y - ((y * z) / a) elif a <= 1.2e+51: tmp = t_1 else: tmp = y + x return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(z / t))) tmp = 0.0 if (a <= -8.8e+101) tmp = Float64(y + x); elseif (a <= -3.7e-22) tmp = Float64(x - Float64(z * Float64(y / a))); elseif (a <= 1.02e+18) tmp = t_1; elseif (a <= 1.02e+45) tmp = Float64(y - Float64(Float64(y * z) / a)); elseif (a <= 1.2e+51) tmp = t_1; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * (z / t)); tmp = 0.0; if (a <= -8.8e+101) tmp = y + x; elseif (a <= -3.7e-22) tmp = x - (z * (y / a)); elseif (a <= 1.02e+18) tmp = t_1; elseif (a <= 1.02e+45) tmp = y - ((y * z) / a); elseif (a <= 1.2e+51) tmp = t_1; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -8.8e+101], N[(y + x), $MachinePrecision], If[LessEqual[a, -3.7e-22], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.02e+18], t$95$1, If[LessEqual[a, 1.02e+45], N[(y - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.2e+51], t$95$1, N[(y + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z}{t}\\
\mathbf{if}\;a \leq -8.8 \cdot 10^{+101}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq -3.7 \cdot 10^{-22}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 1.02 \cdot 10^{+45}:\\
\;\;\;\;y - \frac{y \cdot z}{a}\\
\mathbf{elif}\;a \leq 1.2 \cdot 10^{+51}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -8.8000000000000003e101 or 1.1999999999999999e51 < a Initial program 74.5%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in a around inf 87.3%
if -8.8000000000000003e101 < a < -3.7e-22Initial program 69.0%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in y around 0 99.7%
Taylor expanded in t around inf 88.5%
Taylor expanded in a around inf 62.4%
+-commutative62.4%
mul-1-neg62.4%
associate-/l*82.3%
unsub-neg82.3%
associate-/r/82.3%
*-commutative82.3%
Simplified82.3%
if -3.7e-22 < a < 1.02e18 or 1.02e45 < a < 1.1999999999999999e51Initial program 70.0%
associate-*l/75.9%
Simplified75.9%
Taylor expanded in y around 0 93.4%
Taylor expanded in t around inf 90.2%
Taylor expanded in a around 0 76.2%
associate-*r/81.2%
Simplified81.2%
if 1.02e18 < a < 1.02e45Initial program 100.0%
associate-*l/100.0%
Simplified100.0%
Taylor expanded in t around 0 100.0%
Taylor expanded in x around 0 85.8%
Final simplification83.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.6e-120) (not (<= a 750000.0))) (+ x (+ y (* (/ y (- a t)) (- t z)))) (- x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6e-120) || !(a <= 750000.0)) {
tmp = x + (y + ((y / (a - t)) * (t - z)));
} else {
tmp = x - (y * (z / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-1.6d-120)) .or. (.not. (a <= 750000.0d0))) then
tmp = x + (y + ((y / (a - t)) * (t - z)))
else
tmp = x - (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6e-120) || !(a <= 750000.0)) {
tmp = x + (y + ((y / (a - t)) * (t - z)));
} else {
tmp = x - (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.6e-120) or not (a <= 750000.0): tmp = x + (y + ((y / (a - t)) * (t - z))) else: tmp = x - (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.6e-120) || !(a <= 750000.0)) tmp = Float64(x + Float64(y + Float64(Float64(y / Float64(a - t)) * Float64(t - z)))); else tmp = Float64(x - Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.6e-120) || ~((a <= 750000.0))) tmp = x + (y + ((y / (a - t)) * (t - z))); else tmp = x - (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6e-120], N[Not[LessEqual[a, 750000.0]], $MachinePrecision]], N[(x + N[(y + N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{-120} \lor \neg \left(a \leq 750000\right):\\
\;\;\;\;x + \left(y + \frac{y}{a - t} \cdot \left(t - z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if a < -1.6e-120 or 7.5e5 < a Initial program 74.4%
associate--l+77.3%
associate-/l*93.8%
Simplified93.8%
div-inv93.8%
clear-num93.7%
Applied egg-rr93.7%
if -1.6e-120 < a < 7.5e5Initial program 69.3%
associate-*l/72.6%
Simplified72.6%
Taylor expanded in y around 0 91.3%
Taylor expanded in t around inf 89.9%
Taylor expanded in y around 0 86.7%
+-commutative86.7%
mul-1-neg86.7%
sub-neg86.7%
associate-*r/89.9%
Simplified89.9%
Final simplification92.3%
(FPCore (x y z t a)
:precision binary64
(if (<= a -2.45e+101)
(+ y x)
(if (<= a -1.1e-22)
(- x (* z (/ y a)))
(if (<= a 6.5e+16) (+ x (* y (/ z t))) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.45e+101) {
tmp = y + x;
} else if (a <= -1.1e-22) {
tmp = x - (z * (y / a));
} else if (a <= 6.5e+16) {
tmp = x + (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-2.45d+101)) then
tmp = y + x
else if (a <= (-1.1d-22)) then
tmp = x - (z * (y / a))
else if (a <= 6.5d+16) then
tmp = x + (y * (z / t))
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.45e+101) {
tmp = y + x;
} else if (a <= -1.1e-22) {
tmp = x - (z * (y / a));
} else if (a <= 6.5e+16) {
tmp = x + (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.45e+101: tmp = y + x elif a <= -1.1e-22: tmp = x - (z * (y / a)) elif a <= 6.5e+16: tmp = x + (y * (z / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.45e+101) tmp = Float64(y + x); elseif (a <= -1.1e-22) tmp = Float64(x - Float64(z * Float64(y / a))); elseif (a <= 6.5e+16) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.45e+101) tmp = y + x; elseif (a <= -1.1e-22) tmp = x - (z * (y / a)); elseif (a <= 6.5e+16) tmp = x + (y * (z / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.45e+101], N[(y + x), $MachinePrecision], If[LessEqual[a, -1.1e-22], N[(x - N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 6.5e+16], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.45 \cdot 10^{+101}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq -1.1 \cdot 10^{-22}:\\
\;\;\;\;x - z \cdot \frac{y}{a}\\
\mathbf{elif}\;a \leq 6.5 \cdot 10^{+16}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -2.44999999999999991e101 or 6.5e16 < a Initial program 75.6%
associate-*l/92.4%
Simplified92.4%
Taylor expanded in a around inf 83.5%
if -2.44999999999999991e101 < a < -1.1e-22Initial program 69.0%
associate-*l/99.6%
Simplified99.6%
Taylor expanded in y around 0 99.7%
Taylor expanded in t around inf 88.5%
Taylor expanded in a around inf 62.4%
+-commutative62.4%
mul-1-neg62.4%
associate-/l*82.3%
unsub-neg82.3%
associate-/r/82.3%
*-commutative82.3%
Simplified82.3%
if -1.1e-22 < a < 6.5e16Initial program 70.2%
associate-*l/75.7%
Simplified75.7%
Taylor expanded in y around 0 93.1%
Taylor expanded in t around inf 89.8%
Taylor expanded in a around 0 76.1%
associate-*r/80.6%
Simplified80.6%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.8e-23) (not (<= a 4.4e+17))) (+ x (* y (- 1.0 (/ z a)))) (+ x (* y (/ z t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e-23) || !(a <= 4.4e+17)) {
tmp = x + (y * (1.0 - (z / a)));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-5.8d-23)) .or. (.not. (a <= 4.4d+17))) then
tmp = x + (y * (1.0d0 - (z / a)))
else
tmp = x + (y * (z / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.8e-23) || !(a <= 4.4e+17)) {
tmp = x + (y * (1.0 - (z / a)));
} else {
tmp = x + (y * (z / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.8e-23) or not (a <= 4.4e+17): tmp = x + (y * (1.0 - (z / a))) else: tmp = x + (y * (z / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.8e-23) || !(a <= 4.4e+17)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(z / a)))); else tmp = Float64(x + Float64(y * Float64(z / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.8e-23) || ~((a <= 4.4e+17))) tmp = x + (y * (1.0 - (z / a))); else tmp = x + (y * (z / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.8e-23], N[Not[LessEqual[a, 4.4e+17]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.8 \cdot 10^{-23} \lor \neg \left(a \leq 4.4 \cdot 10^{+17}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if a < -5.8000000000000003e-23 or 4.4e17 < a Initial program 74.8%
associate-*l/93.2%
Simplified93.2%
Taylor expanded in y around 0 97.7%
Taylor expanded in t around 0 89.8%
if -5.8000000000000003e-23 < a < 4.4e17Initial program 70.2%
associate-*l/75.7%
Simplified75.7%
Taylor expanded in y around 0 93.1%
Taylor expanded in t around inf 89.8%
Taylor expanded in a around 0 76.1%
associate-*r/80.6%
Simplified80.6%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.8e+43) (not (<= a 4.5e+15))) (+ x (* y (- 1.0 (/ z a)))) (- x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e+43) || !(a <= 4.5e+15)) {
tmp = x + (y * (1.0 - (z / a)));
} else {
tmp = x - (y * (z / (a - t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-2.8d+43)) .or. (.not. (a <= 4.5d+15))) then
tmp = x + (y * (1.0d0 - (z / a)))
else
tmp = x - (y * (z / (a - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.8e+43) || !(a <= 4.5e+15)) {
tmp = x + (y * (1.0 - (z / a)));
} else {
tmp = x - (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.8e+43) or not (a <= 4.5e+15): tmp = x + (y * (1.0 - (z / a))) else: tmp = x - (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.8e+43) || !(a <= 4.5e+15)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(z / a)))); else tmp = Float64(x - Float64(y * Float64(z / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.8e+43) || ~((a <= 4.5e+15))) tmp = x + (y * (1.0 - (z / a))); else tmp = x - (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.8e+43], N[Not[LessEqual[a, 4.5e+15]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.8 \cdot 10^{+43} \lor \neg \left(a \leq 4.5 \cdot 10^{+15}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if a < -2.80000000000000019e43 or 4.5e15 < a Initial program 73.9%
associate-*l/92.8%
Simplified92.8%
Taylor expanded in y around 0 97.6%
Taylor expanded in t around 0 89.1%
if -2.80000000000000019e43 < a < 4.5e15Initial program 71.3%
associate-*l/77.1%
Simplified77.1%
Taylor expanded in y around 0 93.5%
Taylor expanded in t around inf 90.4%
Taylor expanded in y around 0 85.4%
+-commutative85.4%
mul-1-neg85.4%
sub-neg85.4%
associate-*r/90.4%
Simplified90.4%
Final simplification89.8%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.65e-21) (+ y x) (if (<= a 3.2e+17) (+ x (* y (/ z t))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.65e-21) {
tmp = y + x;
} else if (a <= 3.2e+17) {
tmp = x + (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.65d-21)) then
tmp = y + x
else if (a <= 3.2d+17) then
tmp = x + (y * (z / t))
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.65e-21) {
tmp = y + x;
} else if (a <= 3.2e+17) {
tmp = x + (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.65e-21: tmp = y + x elif a <= 3.2e+17: tmp = x + (y * (z / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.65e-21) tmp = Float64(y + x); elseif (a <= 3.2e+17) tmp = Float64(x + Float64(y * Float64(z / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.65e-21) tmp = y + x; elseif (a <= 3.2e+17) tmp = x + (y * (z / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.65e-21], N[(y + x), $MachinePrecision], If[LessEqual[a, 3.2e+17], N[(x + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.65 \cdot 10^{-21}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;a \leq 3.2 \cdot 10^{+17}:\\
\;\;\;\;x + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if a < -1.65000000000000004e-21 or 3.2e17 < a Initial program 74.8%
associate-*l/93.2%
Simplified93.2%
Taylor expanded in a around inf 78.9%
if -1.65000000000000004e-21 < a < 3.2e17Initial program 70.2%
associate-*l/75.7%
Simplified75.7%
Taylor expanded in y around 0 93.1%
Taylor expanded in t around inf 89.8%
Taylor expanded in a around 0 76.1%
associate-*r/80.6%
Simplified80.6%
Final simplification79.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.8e+218) x (if (<= t 1.76e+195) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.8e+218) {
tmp = x;
} else if (t <= 1.76e+195) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-6.8d+218)) then
tmp = x
else if (t <= 1.76d+195) then
tmp = y + x
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.8e+218) {
tmp = x;
} else if (t <= 1.76e+195) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.8e+218: tmp = x elif t <= 1.76e+195: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.8e+218) tmp = x; elseif (t <= 1.76e+195) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.8e+218) tmp = x; elseif (t <= 1.76e+195) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.8e+218], x, If[LessEqual[t, 1.76e+195], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.8 \cdot 10^{+218}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.76 \cdot 10^{+195}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -6.80000000000000017e218 or 1.7600000000000001e195 < t Initial program 43.3%
associate-*l/59.2%
Simplified59.2%
Taylor expanded in x around inf 77.8%
if -6.80000000000000017e218 < t < 1.7600000000000001e195Initial program 78.4%
associate-*l/89.7%
Simplified89.7%
Taylor expanded in a around inf 62.5%
Final simplification65.1%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 72.5%
associate-*l/84.5%
Simplified84.5%
Taylor expanded in x around inf 49.6%
Final simplification49.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)))
(t_2 (- (+ x y) (/ (* (- z t) y) (- a t)))))
(if (< t_2 -1.3664970889390727e-7)
t_1
(if (< t_2 1.4754293444577233e-239)
(/ (- (* y (- a z)) (* x t)) (- a t))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y + x) - (((z - t) * (1.0d0 / (a - t))) * y)
t_2 = (x + y) - (((z - t) * y) / (a - t))
if (t_2 < (-1.3664970889390727d-7)) then
tmp = t_1
else if (t_2 < 1.4754293444577233d-239) then
tmp = ((y * (a - z)) - (x * t)) / (a - t)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y);
double t_2 = (x + y) - (((z - t) * y) / (a - t));
double tmp;
if (t_2 < -1.3664970889390727e-7) {
tmp = t_1;
} else if (t_2 < 1.4754293444577233e-239) {
tmp = ((y * (a - z)) - (x * t)) / (a - t);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y) t_2 = (x + y) - (((z - t) * y) / (a - t)) tmp = 0 if t_2 < -1.3664970889390727e-7: tmp = t_1 elif t_2 < 1.4754293444577233e-239: tmp = ((y * (a - z)) - (x * t)) / (a - t) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y + x) - Float64(Float64(Float64(z - t) * Float64(1.0 / Float64(a - t))) * y)) t_2 = Float64(Float64(x + y) - Float64(Float64(Float64(z - t) * y) / Float64(a - t))) tmp = 0.0 if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = Float64(Float64(Float64(y * Float64(a - z)) - Float64(x * t)) / Float64(a - t)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y + x) - (((z - t) * (1.0 / (a - t))) * y); t_2 = (x + y) - (((z - t) * y) / (a - t)); tmp = 0.0; if (t_2 < -1.3664970889390727e-7) tmp = t_1; elseif (t_2 < 1.4754293444577233e-239) tmp = ((y * (a - z)) - (x * t)) / (a - t); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y + x), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + y), $MachinePrecision] - N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[t$95$2, -1.3664970889390727e-7], t$95$1, If[Less[t$95$2, 1.4754293444577233e-239], N[(N[(N[(y * N[(a - z), $MachinePrecision]), $MachinePrecision] - N[(x * t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + x\right) - \left(\left(z - t\right) \cdot \frac{1}{a - t}\right) \cdot y\\
t_2 := \left(x + y\right) - \frac{\left(z - t\right) \cdot y}{a - t}\\
\mathbf{if}\;t_2 < -1.3664970889390727 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 < 1.4754293444577233 \cdot 10^{-239}:\\
\;\;\;\;\frac{y \cdot \left(a - z\right) - x \cdot t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023185
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -1.3664970889390727e-7) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 1.4754293444577233e-239) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1.0 (- a t))) y))))
(- (+ x y) (/ (* (- z t) y) (- a t))))