
(FPCore (x y z t a) :precision binary64 (+ x (/ (* (- y z) t) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\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) (- a z))))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
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) / (a - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) * t) / (a - z));
}
def code(x, y, z, t, a): return x + (((y - z) * t) / (a - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) * t) / (a - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left(y - z\right) \cdot t}{a - z}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (* (/ (- y z) (- a z)) t)))
double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) * 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 - z)) * t)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((y - z) / (a - z)) * t);
}
def code(x, y, z, t, a): return x + (((y - z) / (a - z)) * t)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) end
function tmp = code(x, y, z, t, a) tmp = x + (((y - z) / (a - z)) * t); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y - z}{a - z} \cdot t
\end{array}
Initial program 85.9%
associate-*l/97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.3e+111)
(+ x t)
(if (<= z -8e+25)
(- x (* y (/ t z)))
(if (<= z 1.55e-6) (+ x (* y (/ t a))) (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+111) {
tmp = x + t;
} else if (z <= -8e+25) {
tmp = x - (y * (t / z));
} else if (z <= 1.55e-6) {
tmp = x + (y * (t / a));
} else {
tmp = x + 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 (z <= (-2.3d+111)) then
tmp = x + t
else if (z <= (-8d+25)) then
tmp = x - (y * (t / z))
else if (z <= 1.55d-6) then
tmp = x + (y * (t / a))
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.3e+111) {
tmp = x + t;
} else if (z <= -8e+25) {
tmp = x - (y * (t / z));
} else if (z <= 1.55e-6) {
tmp = x + (y * (t / a));
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.3e+111: tmp = x + t elif z <= -8e+25: tmp = x - (y * (t / z)) elif z <= 1.55e-6: tmp = x + (y * (t / a)) else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.3e+111) tmp = Float64(x + t); elseif (z <= -8e+25) tmp = Float64(x - Float64(y * Float64(t / z))); elseif (z <= 1.55e-6) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.3e+111) tmp = x + t; elseif (z <= -8e+25) tmp = x - (y * (t / z)); elseif (z <= 1.55e-6) tmp = x + (y * (t / a)); else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.3e+111], N[(x + t), $MachinePrecision], If[LessEqual[z, -8e+25], N[(x - N[(y * N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-6], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.3 \cdot 10^{+111}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq -8 \cdot 10^{+25}:\\
\;\;\;\;x - y \cdot \frac{t}{z}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-6}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -2.30000000000000002e111 or 1.55e-6 < z Initial program 73.9%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 87.2%
if -2.30000000000000002e111 < z < -8.00000000000000072e25Initial program 89.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in y around inf 83.2%
Taylor expanded in a around 0 77.6%
mul-1-neg77.6%
unsub-neg77.6%
associate-/l*82.5%
associate-/r/82.7%
Simplified82.7%
if -8.00000000000000072e25 < z < 1.55e-6Initial program 95.0%
associate-*l/95.7%
Simplified95.7%
Taylor expanded in z around 0 82.1%
+-commutative82.1%
associate-/l*84.2%
associate-/r/85.5%
Simplified85.5%
Final simplification86.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.35e+119) (not (<= z 1.15e+24))) (+ x t) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+119) || !(z <= 1.15e+24)) {
tmp = x + t;
} else {
tmp = x + (y * (t / (a - z)));
}
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 ((z <= (-1.35d+119)) .or. (.not. (z <= 1.15d+24))) then
tmp = x + t
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.35e+119) || !(z <= 1.15e+24)) {
tmp = x + t;
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.35e+119) or not (z <= 1.15e+24): tmp = x + t else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.35e+119) || !(z <= 1.15e+24)) tmp = Float64(x + t); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.35e+119) || ~((z <= 1.15e+24))) tmp = x + t; else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.35e+119], N[Not[LessEqual[z, 1.15e+24]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+119} \lor \neg \left(z \leq 1.15 \cdot 10^{+24}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -1.3499999999999999e119 or 1.15e24 < z Initial program 73.5%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 88.4%
if -1.3499999999999999e119 < z < 1.15e24Initial program 93.9%
associate-*l/96.3%
Simplified96.3%
Taylor expanded in y around inf 86.6%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
Final simplification89.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.85e+115) (not (<= z 2.2e-62))) (+ x (/ t (- 1.0 (/ a z)))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e+115) || !(z <= 2.2e-62)) {
tmp = x + (t / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / (a - z)));
}
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 ((z <= (-1.85d+115)) .or. (.not. (z <= 2.2d-62))) then
tmp = x + (t / (1.0d0 - (a / z)))
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.85e+115) || !(z <= 2.2e-62)) {
tmp = x + (t / (1.0 - (a / z)));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.85e+115) or not (z <= 2.2e-62): tmp = x + (t / (1.0 - (a / z))) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.85e+115) || !(z <= 2.2e-62)) tmp = Float64(x + Float64(t / Float64(1.0 - Float64(a / z)))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.85e+115) || ~((z <= 2.2e-62))) tmp = x + (t / (1.0 - (a / z))); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.85e+115], N[Not[LessEqual[z, 2.2e-62]], $MachinePrecision]], N[(x + N[(t / N[(1.0 - N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.85 \cdot 10^{+115} \lor \neg \left(z \leq 2.2 \cdot 10^{-62}\right):\\
\;\;\;\;x + \frac{t}{1 - \frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -1.85000000000000003e115 or 2.20000000000000017e-62 < z Initial program 77.3%
associate-*l/99.9%
Simplified99.9%
clear-num99.9%
associate-*l/99.9%
*-un-lft-identity99.9%
Applied egg-rr99.9%
Taylor expanded in y around 0 73.9%
+-commutative73.9%
associate-/l*94.9%
associate-*r/94.9%
neg-mul-194.9%
div-sub94.9%
*-inverses94.9%
Simplified94.9%
frac-2neg94.9%
remove-double-neg94.9%
div-inv95.0%
sub-neg95.0%
distribute-neg-in95.0%
metadata-eval95.0%
metadata-eval95.0%
+-commutative95.0%
Applied egg-rr95.0%
associate-*r/94.9%
*-rgt-identity94.9%
unsub-neg94.9%
Simplified94.9%
if -1.85000000000000003e115 < z < 2.20000000000000017e-62Initial program 93.2%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in y around inf 87.0%
associate-*l/91.7%
*-commutative91.7%
Simplified91.7%
Final simplification93.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.2e+37) (not (<= z 6.9e-6))) (+ x t) (+ x (* t (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.2e+37) || !(z <= 6.9e-6)) {
tmp = x + t;
} else {
tmp = x + (t * (y / a));
}
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 ((z <= (-3.2d+37)) .or. (.not. (z <= 6.9d-6))) then
tmp = x + t
else
tmp = x + (t * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.2e+37) || !(z <= 6.9e-6)) {
tmp = x + t;
} else {
tmp = x + (t * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.2e+37) or not (z <= 6.9e-6): tmp = x + t else: tmp = x + (t * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.2e+37) || !(z <= 6.9e-6)) tmp = Float64(x + t); else tmp = Float64(x + Float64(t * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.2e+37) || ~((z <= 6.9e-6))) tmp = x + t; else tmp = x + (t * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.2e+37], N[Not[LessEqual[z, 6.9e-6]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.2 \cdot 10^{+37} \lor \neg \left(z \leq 6.9 \cdot 10^{-6}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + t \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -3.20000000000000014e37 or 6.9e-6 < z Initial program 76.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.9%
if -3.20000000000000014e37 < z < 6.9e-6Initial program 94.5%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in z around 0 83.9%
Final simplification83.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.58e+38) (not (<= z 1.7e-6))) (+ x t) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.58e+38) || !(z <= 1.7e-6)) {
tmp = x + t;
} else {
tmp = x + (y * (t / a));
}
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 ((z <= (-1.58d+38)) .or. (.not. (z <= 1.7d-6))) then
tmp = x + t
else
tmp = x + (y * (t / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.58e+38) || !(z <= 1.7e-6)) {
tmp = x + t;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.58e+38) or not (z <= 1.7e-6): tmp = x + t else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.58e+38) || !(z <= 1.7e-6)) tmp = Float64(x + t); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.58e+38) || ~((z <= 1.7e-6))) tmp = x + t; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.58e+38], N[Not[LessEqual[z, 1.7e-6]], $MachinePrecision]], N[(x + t), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.58 \cdot 10^{+38} \lor \neg \left(z \leq 1.7 \cdot 10^{-6}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -1.58e38 or 1.70000000000000003e-6 < z Initial program 76.0%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 82.9%
if -1.58e38 < z < 1.70000000000000003e-6Initial program 94.5%
associate-*l/95.8%
Simplified95.8%
Taylor expanded in z around 0 81.9%
+-commutative81.9%
associate-/l*83.9%
associate-/r/85.2%
Simplified85.2%
Final simplification84.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1e-140) (+ x t) (if (<= z 1.6e-307) (* t (/ y a)) (if (<= z 0.00042) x (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-140) {
tmp = x + t;
} else if (z <= 1.6e-307) {
tmp = t * (y / a);
} else if (z <= 0.00042) {
tmp = x;
} else {
tmp = x + 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 (z <= (-1d-140)) then
tmp = x + t
else if (z <= 1.6d-307) then
tmp = t * (y / a)
else if (z <= 0.00042d0) then
tmp = x
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1e-140) {
tmp = x + t;
} else if (z <= 1.6e-307) {
tmp = t * (y / a);
} else if (z <= 0.00042) {
tmp = x;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1e-140: tmp = x + t elif z <= 1.6e-307: tmp = t * (y / a) elif z <= 0.00042: tmp = x else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1e-140) tmp = Float64(x + t); elseif (z <= 1.6e-307) tmp = Float64(t * Float64(y / a)); elseif (z <= 0.00042) tmp = x; else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1e-140) tmp = x + t; elseif (z <= 1.6e-307) tmp = t * (y / a); elseif (z <= 0.00042) tmp = x; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1e-140], N[(x + t), $MachinePrecision], If[LessEqual[z, 1.6e-307], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 0.00042], x, N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{-140}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{-307}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;z \leq 0.00042:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -9.9999999999999998e-141 or 4.2000000000000002e-4 < z Initial program 81.0%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in z around inf 76.6%
if -9.9999999999999998e-141 < z < 1.60000000000000005e-307Initial program 85.6%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in z around 0 85.6%
Taylor expanded in x around 0 51.3%
associate-*r/61.5%
Simplified61.5%
if 1.60000000000000005e-307 < z < 4.2000000000000002e-4Initial program 97.2%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around inf 67.7%
Final simplification72.6%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.3e-141) (+ x t) (if (<= z 3.8e-308) (/ y (/ a t)) (if (<= z 1.9e-6) x (+ x t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e-141) {
tmp = x + t;
} else if (z <= 3.8e-308) {
tmp = y / (a / t);
} else if (z <= 1.9e-6) {
tmp = x;
} else {
tmp = x + 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 (z <= (-1.3d-141)) then
tmp = x + t
else if (z <= 3.8d-308) then
tmp = y / (a / t)
else if (z <= 1.9d-6) then
tmp = x
else
tmp = x + t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.3e-141) {
tmp = x + t;
} else if (z <= 3.8e-308) {
tmp = y / (a / t);
} else if (z <= 1.9e-6) {
tmp = x;
} else {
tmp = x + t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.3e-141: tmp = x + t elif z <= 3.8e-308: tmp = y / (a / t) elif z <= 1.9e-6: tmp = x else: tmp = x + t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.3e-141) tmp = Float64(x + t); elseif (z <= 3.8e-308) tmp = Float64(y / Float64(a / t)); elseif (z <= 1.9e-6) tmp = x; else tmp = Float64(x + t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.3e-141) tmp = x + t; elseif (z <= 3.8e-308) tmp = y / (a / t); elseif (z <= 1.9e-6) tmp = x; else tmp = x + t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.3e-141], N[(x + t), $MachinePrecision], If[LessEqual[z, 3.8e-308], N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.9e-6], x, N[(x + t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.3 \cdot 10^{-141}:\\
\;\;\;\;x + t\\
\mathbf{elif}\;z \leq 3.8 \cdot 10^{-308}:\\
\;\;\;\;\frac{y}{\frac{a}{t}}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-6}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + t\\
\end{array}
\end{array}
if z < -1.30000000000000005e-141 or 1.9e-6 < z Initial program 81.0%
associate-*l/98.7%
Simplified98.7%
Taylor expanded in z around inf 76.6%
if -1.30000000000000005e-141 < z < 3.79999999999999975e-308Initial program 85.6%
associate-*l/95.6%
Simplified95.6%
Taylor expanded in z around 0 85.6%
Taylor expanded in x around 0 51.3%
associate-*r/61.5%
Simplified61.5%
*-commutative61.5%
associate-/r/65.5%
Applied egg-rr65.5%
if 3.79999999999999975e-308 < z < 1.9e-6Initial program 97.2%
associate-*l/96.1%
Simplified96.1%
Taylor expanded in x around inf 67.7%
Final simplification73.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.2e-93) (not (<= z 9e-6))) (+ x t) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.2e-93) || !(z <= 9e-6)) {
tmp = x + t;
} 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 ((z <= (-7.2d-93)) .or. (.not. (z <= 9d-6))) then
tmp = x + t
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 ((z <= -7.2e-93) || !(z <= 9e-6)) {
tmp = x + t;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.2e-93) or not (z <= 9e-6): tmp = x + t else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.2e-93) || !(z <= 9e-6)) tmp = Float64(x + t); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.2e-93) || ~((z <= 9e-6))) tmp = x + t; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.2e-93], N[Not[LessEqual[z, 9e-6]], $MachinePrecision]], N[(x + t), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{-93} \lor \neg \left(z \leq 9 \cdot 10^{-6}\right):\\
\;\;\;\;x + t\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -7.2000000000000003e-93 or 9.00000000000000023e-6 < z Initial program 80.2%
associate-*l/99.9%
Simplified99.9%
Taylor expanded in z around inf 79.4%
if -7.2000000000000003e-93 < z < 9.00000000000000023e-6Initial program 93.8%
associate-*l/94.6%
Simplified94.6%
Taylor expanded in x around inf 58.9%
Final simplification70.8%
(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 85.9%
associate-*l/97.7%
Simplified97.7%
Taylor expanded in x around inf 55.5%
Final simplification55.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ (- y z) (- a z)) t))))
(if (< t -1.0682974490174067e-39)
t_1
(if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} 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) :: tmp
t_1 = x + (((y - z) / (a - z)) * t)
if (t < (-1.0682974490174067d-39)) then
tmp = t_1
else if (t < 3.9110949887586375d-141) then
tmp = x + (((y - z) * t) / (a - z))
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 = x + (((y - z) / (a - z)) * t);
double tmp;
if (t < -1.0682974490174067e-39) {
tmp = t_1;
} else if (t < 3.9110949887586375e-141) {
tmp = x + (((y - z) * t) / (a - z));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (((y - z) / (a - z)) * t) tmp = 0 if t < -1.0682974490174067e-39: tmp = t_1 elif t < 3.9110949887586375e-141: tmp = x + (((y - z) * t) / (a - z)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(Float64(y - z) / Float64(a - z)) * t)) tmp = 0.0 if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = Float64(x + Float64(Float64(Float64(y - z) * t) / Float64(a - z))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (((y - z) / (a - z)) * t); tmp = 0.0; if (t < -1.0682974490174067e-39) tmp = t_1; elseif (t < 3.9110949887586375e-141) tmp = x + (((y - z) * t) / (a - z)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(N[(y - z), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]}, If[Less[t, -1.0682974490174067e-39], t$95$1, If[Less[t, 3.9110949887586375e-141], N[(x + N[(N[(N[(y - z), $MachinePrecision] * t), $MachinePrecision] / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y - z}{a - z} \cdot t\\
\mathbf{if}\;t < -1.0682974490174067 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t < 3.9110949887586375 \cdot 10^{-141}:\\
\;\;\;\;x + \frac{\left(y - z\right) \cdot t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023301
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(if (< t -1.0682974490174067e-39) (+ x (* (/ (- y z) (- a z)) t)) (if (< t 3.9110949887586375e-141) (+ x (/ (* (- y z) t) (- a z))) (+ x (* (/ (- y z) (- a z)) t))))
(+ x (/ (* (- y z) t) (- a z))))