
(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 12 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 (if (or (<= t -1.25e+194) (not (<= t 9.6e+23))) (+ (- x (* a (/ y t))) (/ (* y z) t)) (fma (- z t) (/ y (- t a)) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.25e+194) || !(t <= 9.6e+23)) {
tmp = (x - (a * (y / t))) + ((y * z) / t);
} else {
tmp = fma((z - t), (y / (t - a)), (y + x));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.25e+194) || !(t <= 9.6e+23)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(Float64(y * z) / t)); else tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(y + x)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.25e+194], N[Not[LessEqual[t, 9.6e+23]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(y + x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+194} \lor \neg \left(t \leq 9.6 \cdot 10^{+23}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, y + x\right)\\
\end{array}
\end{array}
if t < -1.24999999999999997e194 or 9.6e23 < t Initial program 61.3%
Taylor expanded in t around inf 87.1%
+-commutative87.1%
mul-1-neg87.1%
associate-/l*92.2%
associate-*r/92.2%
associate-*r*92.2%
neg-mul-192.2%
Simplified92.2%
if -1.24999999999999997e194 < t < 9.6e23Initial program 84.2%
sub-neg84.2%
+-commutative84.2%
distribute-frac-neg84.2%
distribute-rgt-neg-out84.2%
associate-/l*91.5%
fma-define91.6%
distribute-frac-neg91.6%
distribute-neg-frac291.6%
sub-neg91.6%
distribute-neg-in91.6%
remove-double-neg91.6%
+-commutative91.6%
sub-neg91.6%
Simplified91.6%
Final simplification91.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (+ y x) (/ (* y (- t z)) (- a t)))))
(if (or (<= t_1 -1e-157) (not (<= t_1 5e-117)))
(+ (+ y x) (* (- z t) (/ y (- t a))))
(+ x (/ (* y (- z a)) t)))))
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 <= -1e-157) || !(t_1 <= 5e-117)) {
tmp = (y + x) + ((z - t) * (y / (t - 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) :: t_1
real(8) :: tmp
t_1 = (y + x) + ((y * (t - z)) / (a - t))
if ((t_1 <= (-1d-157)) .or. (.not. (t_1 <= 5d-117))) then
tmp = (y + x) + ((z - t) * (y / (t - 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 t_1 = (y + x) + ((y * (t - z)) / (a - t));
double tmp;
if ((t_1 <= -1e-157) || !(t_1 <= 5e-117)) {
tmp = (y + x) + ((z - t) * (y / (t - a)));
} else {
tmp = x + ((y * (z - a)) / t);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y + x) + ((y * (t - z)) / (a - t)) tmp = 0 if (t_1 <= -1e-157) or not (t_1 <= 5e-117): tmp = (y + x) + ((z - t) * (y / (t - a))) else: tmp = x + ((y * (z - a)) / t) 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 <= -1e-157) || !(t_1 <= 5e-117)) tmp = Float64(Float64(y + x) + Float64(Float64(z - t) * Float64(y / Float64(t - a)))); else tmp = Float64(x + Float64(Float64(y * Float64(z - a)) / t)); 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 <= -1e-157) || ~((t_1 <= 5e-117))) tmp = (y + x) + ((z - t) * (y / (t - a))); else tmp = x + ((y * (z - a)) / t); 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[Or[LessEqual[t$95$1, -1e-157], N[Not[LessEqual[t$95$1, 5e-117]], $MachinePrecision]], N[(N[(y + x), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * N[(z - a), $MachinePrecision]), $MachinePrecision] / t), $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 -1 \cdot 10^{-157} \lor \neg \left(t\_1 \leq 5 \cdot 10^{-117}\right):\\
\;\;\;\;\left(y + x\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot \left(z - a\right)}{t}\\
\end{array}
\end{array}
if (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < -9.99999999999999943e-158 or 5e-117 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) Initial program 83.0%
Taylor expanded in y around 0 83.0%
associate-*l/91.1%
Simplified91.1%
if -9.99999999999999943e-158 < (-.f64 (+.f64 x y) (/.f64 (*.f64 (-.f64 z t) y) (-.f64 a t))) < 5e-117Initial program 18.9%
Taylor expanded in t around inf 94.5%
associate--l+94.5%
distribute-lft-out--94.5%
div-sub94.4%
mul-1-neg94.4%
unsub-neg94.4%
*-commutative94.4%
distribute-lft-out--94.5%
Simplified94.5%
Final simplification91.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.6e-97) (not (<= a 9.2e-66))) (- (+ y x) (* y (/ z a))) (+ (- x (/ (* a y) t)) (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.6e-97) || !(a <= 9.2e-66)) {
tmp = (y + x) - (y * (z / a));
} else {
tmp = (x - ((a * y) / t)) + (y / (t / 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 ((a <= (-1.6d-97)) .or. (.not. (a <= 9.2d-66))) then
tmp = (y + x) - (y * (z / a))
else
tmp = (x - ((a * y) / t)) + (y / (t / z))
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-97) || !(a <= 9.2e-66)) {
tmp = (y + x) - (y * (z / a));
} else {
tmp = (x - ((a * y) / t)) + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.6e-97) or not (a <= 9.2e-66): tmp = (y + x) - (y * (z / a)) else: tmp = (x - ((a * y) / t)) + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.6e-97) || !(a <= 9.2e-66)) tmp = Float64(Float64(y + x) - Float64(y * Float64(z / a))); else tmp = Float64(Float64(x - Float64(Float64(a * y) / t)) + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.6e-97) || ~((a <= 9.2e-66))) tmp = (y + x) - (y * (z / a)); else tmp = (x - ((a * y) / t)) + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.6e-97], N[Not[LessEqual[a, 9.2e-66]], $MachinePrecision]], N[(N[(y + x), $MachinePrecision] - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(N[(a * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision] + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.6 \cdot 10^{-97} \lor \neg \left(a \leq 9.2 \cdot 10^{-66}\right):\\
\;\;\;\;\left(y + x\right) - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(x - \frac{a \cdot y}{t}\right) + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -1.5999999999999999e-97 or 9.19999999999999967e-66 < a Initial program 77.1%
Taylor expanded in t around 0 80.0%
+-commutative80.0%
associate-/l*84.8%
Simplified84.8%
if -1.5999999999999999e-97 < a < 9.19999999999999967e-66Initial program 78.2%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
mul-1-neg90.6%
associate-/l*82.3%
associate-*r/82.3%
associate-*r*82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in a around 0 90.6%
sub-neg90.6%
mul-1-neg90.6%
sub-neg90.6%
*-commutative90.6%
mul-1-neg90.6%
associate-*r/92.6%
remove-double-neg92.6%
associate-*r/90.6%
associate-*l/90.5%
associate-/r/93.5%
Simplified93.5%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.45e+194) (not (<= t 1e+24))) (+ (- x (* a (/ y t))) (/ (* y z) t)) (+ (+ y x) (* (- z t) (/ y (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.45e+194) || !(t <= 1e+24)) {
tmp = (x - (a * (y / t))) + ((y * z) / t);
} else {
tmp = (y + x) + ((z - t) * (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 ((t <= (-2.45d+194)) .or. (.not. (t <= 1d+24))) then
tmp = (x - (a * (y / t))) + ((y * z) / t)
else
tmp = (y + x) + ((z - t) * (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 ((t <= -2.45e+194) || !(t <= 1e+24)) {
tmp = (x - (a * (y / t))) + ((y * z) / t);
} else {
tmp = (y + x) + ((z - t) * (y / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.45e+194) or not (t <= 1e+24): tmp = (x - (a * (y / t))) + ((y * z) / t) else: tmp = (y + x) + ((z - t) * (y / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.45e+194) || !(t <= 1e+24)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(Float64(y * z) / t)); else tmp = Float64(Float64(y + x) + Float64(Float64(z - t) * Float64(y / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -2.45e+194) || ~((t <= 1e+24))) tmp = (x - (a * (y / t))) + ((y * z) / t); else tmp = (y + x) + ((z - t) * (y / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.45e+194], N[Not[LessEqual[t, 1e+24]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(y + x), $MachinePrecision] + N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.45 \cdot 10^{+194} \lor \neg \left(t \leq 10^{+24}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + \frac{y \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(y + x\right) + \left(z - t\right) \cdot \frac{y}{t - a}\\
\end{array}
\end{array}
if t < -2.45000000000000013e194 or 9.9999999999999998e23 < t Initial program 61.3%
Taylor expanded in t around inf 87.1%
+-commutative87.1%
mul-1-neg87.1%
associate-/l*92.2%
associate-*r/92.2%
associate-*r*92.2%
neg-mul-192.2%
Simplified92.2%
if -2.45000000000000013e194 < t < 9.9999999999999998e23Initial program 84.2%
Taylor expanded in y around 0 84.2%
associate-*l/91.5%
Simplified91.5%
Final simplification91.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -5.6e-98) (not (<= a 3.3e-65))) (- (+ y x) (/ (* y z) a)) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -5.6e-98) || !(a <= 3.3e-65)) {
tmp = (y + x) - ((y * z) / a);
} else {
tmp = x + (y / (t / 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 ((a <= (-5.6d-98)) .or. (.not. (a <= 3.3d-65))) then
tmp = (y + x) - ((y * z) / a)
else
tmp = x + (y / (t / z))
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.6e-98) || !(a <= 3.3e-65)) {
tmp = (y + x) - ((y * z) / a);
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -5.6e-98) or not (a <= 3.3e-65): tmp = (y + x) - ((y * z) / a) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -5.6e-98) || !(a <= 3.3e-65)) tmp = Float64(Float64(y + x) - Float64(Float64(y * z) / a)); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -5.6e-98) || ~((a <= 3.3e-65))) tmp = (y + x) - ((y * z) / a); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -5.6e-98], N[Not[LessEqual[a, 3.3e-65]], $MachinePrecision]], N[(N[(y + x), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -5.6 \cdot 10^{-98} \lor \neg \left(a \leq 3.3 \cdot 10^{-65}\right):\\
\;\;\;\;\left(y + x\right) - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -5.5999999999999998e-98 or 3.3000000000000001e-65 < a Initial program 77.1%
Taylor expanded in t around 0 80.0%
if -5.5999999999999998e-98 < a < 3.3000000000000001e-65Initial program 78.2%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
mul-1-neg90.6%
associate-/l*82.3%
associate-*r/82.3%
associate-*r*82.3%
neg-mul-182.3%
Simplified82.3%
Taylor expanded in a around 0 89.4%
sub-neg89.4%
mul-1-neg89.4%
associate-*r/91.3%
remove-double-neg91.3%
associate-*r/89.4%
associate-*l/89.7%
associate-/r/92.2%
Simplified92.2%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -6.4e-65) (not (<= a 5e-73))) (- (+ y x) (* y (/ z a))) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.4e-65) || !(a <= 5e-73)) {
tmp = (y + x) - (y * (z / a));
} else {
tmp = x + (y / (t / 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 ((a <= (-6.4d-65)) .or. (.not. (a <= 5d-73))) then
tmp = (y + x) - (y * (z / a))
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -6.4e-65) || !(a <= 5e-73)) {
tmp = (y + x) - (y * (z / a));
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -6.4e-65) or not (a <= 5e-73): tmp = (y + x) - (y * (z / a)) else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -6.4e-65) || !(a <= 5e-73)) tmp = Float64(Float64(y + x) - Float64(y * Float64(z / a))); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -6.4e-65) || ~((a <= 5e-73))) tmp = (y + x) - (y * (z / a)); else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -6.4e-65], N[Not[LessEqual[a, 5e-73]], $MachinePrecision]], N[(N[(y + x), $MachinePrecision] - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6.4 \cdot 10^{-65} \lor \neg \left(a \leq 5 \cdot 10^{-73}\right):\\
\;\;\;\;\left(y + x\right) - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -6.3999999999999998e-65 or 4.9999999999999998e-73 < a Initial program 77.1%
Taylor expanded in t around 0 80.2%
+-commutative80.2%
associate-/l*86.5%
Simplified86.5%
if -6.3999999999999998e-65 < a < 4.9999999999999998e-73Initial program 78.1%
Taylor expanded in t around inf 87.7%
+-commutative87.7%
mul-1-neg87.7%
associate-/l*80.0%
associate-*r/80.0%
associate-*r*80.0%
neg-mul-180.0%
Simplified80.0%
Taylor expanded in a around 0 87.5%
sub-neg87.5%
mul-1-neg87.5%
associate-*r/89.2%
remove-double-neg89.2%
associate-*r/87.5%
associate-*l/87.8%
associate-/r/90.1%
Simplified90.1%
Final simplification87.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -1.45e-102) (not (<= x 1.06e-108))) (+ y x) (* y (/ z (- t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -1.45e-102) || !(x <= 1.06e-108)) {
tmp = y + x;
} else {
tmp = y * (z / (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 ((x <= (-1.45d-102)) .or. (.not. (x <= 1.06d-108))) then
tmp = y + x
else
tmp = y * (z / (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 ((x <= -1.45e-102) || !(x <= 1.06e-108)) {
tmp = y + x;
} else {
tmp = y * (z / (t - a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -1.45e-102) or not (x <= 1.06e-108): tmp = y + x else: tmp = y * (z / (t - a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -1.45e-102) || !(x <= 1.06e-108)) tmp = Float64(y + x); else tmp = Float64(y * Float64(z / Float64(t - a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -1.45e-102) || ~((x <= 1.06e-108))) tmp = y + x; else tmp = y * (z / (t - a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -1.45e-102], N[Not[LessEqual[x, 1.06e-108]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.45 \cdot 10^{-102} \lor \neg \left(x \leq 1.06 \cdot 10^{-108}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t - a}\\
\end{array}
\end{array}
if x < -1.44999999999999993e-102 or 1.06e-108 < x Initial program 84.4%
Taylor expanded in a around inf 71.7%
+-commutative71.7%
Simplified71.7%
if -1.44999999999999993e-102 < x < 1.06e-108Initial program 60.4%
sub-neg60.4%
+-commutative60.4%
distribute-frac-neg60.4%
distribute-rgt-neg-out60.4%
associate-/l*61.3%
fma-define61.9%
distribute-frac-neg61.9%
distribute-neg-frac261.9%
sub-neg61.9%
distribute-neg-in61.9%
remove-double-neg61.9%
+-commutative61.9%
sub-neg61.9%
Simplified61.9%
Taylor expanded in z around inf 55.9%
associate-/l*60.9%
Simplified60.9%
Final simplification68.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -800.0) (not (<= a 4.7e+55))) (+ y x) (+ x (/ y (/ t z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -800.0) || !(a <= 4.7e+55)) {
tmp = y + x;
} else {
tmp = x + (y / (t / 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 ((a <= (-800.0d0)) .or. (.not. (a <= 4.7d+55))) then
tmp = y + x
else
tmp = x + (y / (t / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -800.0) || !(a <= 4.7e+55)) {
tmp = y + x;
} else {
tmp = x + (y / (t / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -800.0) or not (a <= 4.7e+55): tmp = y + x else: tmp = x + (y / (t / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -800.0) || !(a <= 4.7e+55)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(t / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -800.0) || ~((a <= 4.7e+55))) tmp = y + x; else tmp = x + (y / (t / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -800.0], N[Not[LessEqual[a, 4.7e+55]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -800 \lor \neg \left(a \leq 4.7 \cdot 10^{+55}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if a < -800 or 4.7000000000000001e55 < a Initial program 78.8%
Taylor expanded in a around inf 78.8%
+-commutative78.8%
Simplified78.8%
if -800 < a < 4.7000000000000001e55Initial program 76.5%
Taylor expanded in t around inf 78.1%
+-commutative78.1%
mul-1-neg78.1%
associate-/l*72.5%
associate-*r/72.5%
associate-*r*72.5%
neg-mul-172.5%
Simplified72.5%
Taylor expanded in a around 0 78.1%
sub-neg78.1%
mul-1-neg78.1%
associate-*r/80.0%
remove-double-neg80.0%
associate-*r/78.1%
associate-*l/78.3%
associate-/r/80.6%
Simplified80.6%
Final simplification79.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -5e-104) (not (<= x 3.9e-175))) (+ y x) (* y (/ z t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -5e-104) || !(x <= 3.9e-175)) {
tmp = y + x;
} else {
tmp = 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 ((x <= (-5d-104)) .or. (.not. (x <= 3.9d-175))) then
tmp = y + x
else
tmp = 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 ((x <= -5e-104) || !(x <= 3.9e-175)) {
tmp = y + x;
} else {
tmp = y * (z / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -5e-104) or not (x <= 3.9e-175): tmp = y + x else: tmp = y * (z / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -5e-104) || !(x <= 3.9e-175)) tmp = Float64(y + x); else tmp = Float64(y * Float64(z / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -5e-104) || ~((x <= 3.9e-175))) tmp = y + x; else tmp = y * (z / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -5e-104], N[Not[LessEqual[x, 3.9e-175]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-104} \lor \neg \left(x \leq 3.9 \cdot 10^{-175}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{t}\\
\end{array}
\end{array}
if x < -4.99999999999999979e-104 or 3.89999999999999998e-175 < x Initial program 83.9%
Taylor expanded in a around inf 70.3%
+-commutative70.3%
Simplified70.3%
if -4.99999999999999979e-104 < x < 3.89999999999999998e-175Initial program 58.0%
sub-neg58.0%
+-commutative58.0%
distribute-frac-neg58.0%
distribute-rgt-neg-out58.0%
associate-/l*56.1%
fma-define56.8%
distribute-frac-neg56.8%
distribute-neg-frac256.8%
sub-neg56.8%
distribute-neg-in56.8%
remove-double-neg56.8%
+-commutative56.8%
sub-neg56.8%
Simplified56.8%
Taylor expanded in z around inf 58.8%
Taylor expanded in t around inf 47.9%
associate-/l*49.4%
Simplified49.4%
Final simplification65.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= x -7e-104) (not (<= x 2.35e-174))) (+ y x) (/ y (/ t z))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -7e-104) || !(x <= 2.35e-174)) {
tmp = y + x;
} else {
tmp = y / (t / 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 ((x <= (-7d-104)) .or. (.not. (x <= 2.35d-174))) then
tmp = y + x
else
tmp = y / (t / z)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((x <= -7e-104) || !(x <= 2.35e-174)) {
tmp = y + x;
} else {
tmp = y / (t / z);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (x <= -7e-104) or not (x <= 2.35e-174): tmp = y + x else: tmp = y / (t / z) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((x <= -7e-104) || !(x <= 2.35e-174)) tmp = Float64(y + x); else tmp = Float64(y / Float64(t / z)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((x <= -7e-104) || ~((x <= 2.35e-174))) tmp = y + x; else tmp = y / (t / z); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[x, -7e-104], N[Not[LessEqual[x, 2.35e-174]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{-104} \lor \neg \left(x \leq 2.35 \cdot 10^{-174}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{\frac{t}{z}}\\
\end{array}
\end{array}
if x < -7.00000000000000057e-104 or 2.34999999999999993e-174 < x Initial program 83.9%
Taylor expanded in a around inf 70.3%
+-commutative70.3%
Simplified70.3%
if -7.00000000000000057e-104 < x < 2.34999999999999993e-174Initial program 58.0%
sub-neg58.0%
+-commutative58.0%
distribute-frac-neg58.0%
distribute-rgt-neg-out58.0%
associate-/l*56.1%
fma-define56.8%
distribute-frac-neg56.8%
distribute-neg-frac256.8%
sub-neg56.8%
distribute-neg-in56.8%
remove-double-neg56.8%
+-commutative56.8%
sub-neg56.8%
Simplified56.8%
Taylor expanded in z around inf 58.8%
Taylor expanded in t around inf 47.9%
associate-/l*49.4%
Simplified49.4%
Taylor expanded in y around 0 47.9%
associate-*l/44.8%
associate-/r/49.4%
Simplified49.4%
Final simplification65.1%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 = y + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 77.5%
Taylor expanded in a around inf 59.0%
+-commutative59.0%
Simplified59.0%
Final simplification59.0%
(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 77.5%
Taylor expanded in x around inf 47.2%
Final simplification47.2%
(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 2024115
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(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))))