
(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 (if (or (<= t -2.9e+130) (not (<= t 1.95e+117))) (+ (- x (* a (/ y t))) (* y (/ z t))) (fma (- z t) (/ y (- t a)) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.9e+130) || !(t <= 1.95e+117)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = fma((z - t), (y / (t - a)), (x + y));
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.9e+130) || !(t <= 1.95e+117)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = fma(Float64(z - t), Float64(y / Float64(t - a)), Float64(x + y)); end return tmp end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.9e+130], N[Not[LessEqual[t, 1.95e+117]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.9 \cdot 10^{+130} \lor \neg \left(t \leq 1.95 \cdot 10^{+117}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{t - a}, x + y\right)\\
\end{array}
\end{array}
if t < -2.8999999999999999e130 or 1.94999999999999995e117 < t Initial program 46.3%
+-commutative46.3%
associate--l+46.3%
*-commutative46.3%
Simplified46.3%
Taylor expanded in t around inf 72.5%
sub-neg72.5%
mul-1-neg72.5%
unsub-neg72.5%
associate-/l*81.8%
mul-1-neg81.8%
remove-double-neg81.8%
associate-/l*91.8%
Simplified91.8%
if -2.8999999999999999e130 < t < 1.94999999999999995e117Initial program 85.4%
sub-neg85.4%
+-commutative85.4%
distribute-frac-neg85.4%
distribute-rgt-neg-out85.4%
associate-/l*89.5%
fma-define89.6%
distribute-frac-neg89.6%
distribute-neg-frac289.6%
sub-neg89.6%
distribute-neg-in89.6%
remove-double-neg89.6%
+-commutative89.6%
sub-neg89.6%
Simplified89.6%
Final simplification90.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ (* y (/ z t)) (+ x y))))
(if (<= t -1.1e+129)
x
(if (<= t -1.1e-44)
t_1
(if (<= t 240000000.0)
(+ y (- x (* y (/ z a))))
(if (<= t 9.5e+117) t_1 x))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z / t)) + (x + y);
double tmp;
if (t <= -1.1e+129) {
tmp = x;
} else if (t <= -1.1e-44) {
tmp = t_1;
} else if (t <= 240000000.0) {
tmp = y + (x - (y * (z / a)));
} else if (t <= 9.5e+117) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (y * (z / t)) + (x + y)
if (t <= (-1.1d+129)) then
tmp = x
else if (t <= (-1.1d-44)) then
tmp = t_1
else if (t <= 240000000.0d0) then
tmp = y + (x - (y * (z / a)))
else if (t <= 9.5d+117) then
tmp = t_1
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z / t)) + (x + y);
double tmp;
if (t <= -1.1e+129) {
tmp = x;
} else if (t <= -1.1e-44) {
tmp = t_1;
} else if (t <= 240000000.0) {
tmp = y + (x - (y * (z / a)));
} else if (t <= 9.5e+117) {
tmp = t_1;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z / t)) + (x + y) tmp = 0 if t <= -1.1e+129: tmp = x elif t <= -1.1e-44: tmp = t_1 elif t <= 240000000.0: tmp = y + (x - (y * (z / a))) elif t <= 9.5e+117: tmp = t_1 else: tmp = x return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z / t)) + Float64(x + y)) tmp = 0.0 if (t <= -1.1e+129) tmp = x; elseif (t <= -1.1e-44) tmp = t_1; elseif (t <= 240000000.0) tmp = Float64(y + Float64(x - Float64(y * Float64(z / a)))); elseif (t <= 9.5e+117) tmp = t_1; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z / t)) + (x + y); tmp = 0.0; if (t <= -1.1e+129) tmp = x; elseif (t <= -1.1e-44) tmp = t_1; elseif (t <= 240000000.0) tmp = y + (x - (y * (z / a))); elseif (t <= 9.5e+117) tmp = t_1; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision] + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.1e+129], x, If[LessEqual[t, -1.1e-44], t$95$1, If[LessEqual[t, 240000000.0], N[(y + N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9.5e+117], t$95$1, x]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{t} + \left(x + y\right)\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.1 \cdot 10^{-44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 240000000:\\
\;\;\;\;y + \left(x - y \cdot \frac{z}{a}\right)\\
\mathbf{elif}\;t \leq 9.5 \cdot 10^{+117}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.1e129 or 9.50000000000000041e117 < t Initial program 46.5%
sub-neg46.5%
+-commutative46.5%
distribute-frac-neg46.5%
distribute-rgt-neg-out46.5%
associate-/l*59.9%
fma-define60.2%
distribute-frac-neg60.2%
distribute-neg-frac260.2%
sub-neg60.2%
distribute-neg-in60.2%
remove-double-neg60.2%
+-commutative60.2%
sub-neg60.2%
Simplified60.2%
Taylor expanded in y around 0 71.7%
if -1.1e129 < t < -1.10000000000000006e-44 or 2.4e8 < t < 9.50000000000000041e117Initial program 76.6%
+-commutative76.6%
associate--l+76.6%
*-commutative76.6%
Simplified76.6%
Taylor expanded in z around inf 79.4%
associate-/l*85.0%
Simplified85.0%
Taylor expanded in a around 0 76.5%
sub-neg76.5%
+-commutative76.5%
mul-1-neg76.5%
remove-double-neg76.5%
associate-/l*79.2%
Simplified79.2%
if -1.10000000000000006e-44 < t < 2.4e8Initial program 90.8%
+-commutative90.8%
associate--l+90.9%
*-commutative90.9%
Simplified90.9%
Taylor expanded in t around 0 83.5%
associate-/l*85.2%
Simplified85.2%
Final simplification79.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.3e+131) (not (<= t 2.35e+117))) (+ (- x (* a (/ y t))) (* y (/ z t))) (+ y (+ x (* y (/ z (- t a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.3e+131) || !(t <= 2.35e+117)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = y + (x + (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 ((t <= (-1.3d+131)) .or. (.not. (t <= 2.35d+117))) then
tmp = (x - (a * (y / t))) + (y * (z / t))
else
tmp = y + (x + (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 ((t <= -1.3e+131) || !(t <= 2.35e+117)) {
tmp = (x - (a * (y / t))) + (y * (z / t));
} else {
tmp = y + (x + (y * (z / (t - a))));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.3e+131) or not (t <= 2.35e+117): tmp = (x - (a * (y / t))) + (y * (z / t)) else: tmp = y + (x + (y * (z / (t - a)))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.3e+131) || !(t <= 2.35e+117)) tmp = Float64(Float64(x - Float64(a * Float64(y / t))) + Float64(y * Float64(z / t))); else tmp = Float64(y + Float64(x + Float64(y * Float64(z / Float64(t - a))))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.3e+131) || ~((t <= 2.35e+117))) tmp = (x - (a * (y / t))) + (y * (z / t)); else tmp = y + (x + (y * (z / (t - a)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.3e+131], N[Not[LessEqual[t, 2.35e+117]], $MachinePrecision]], N[(N[(x - N[(a * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + N[(x + N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+131} \lor \neg \left(t \leq 2.35 \cdot 10^{+117}\right):\\
\;\;\;\;\left(x - a \cdot \frac{y}{t}\right) + y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + \left(x + y \cdot \frac{z}{t - a}\right)\\
\end{array}
\end{array}
if t < -1.3e131 or 2.35000000000000003e117 < t Initial program 46.3%
+-commutative46.3%
associate--l+46.3%
*-commutative46.3%
Simplified46.3%
Taylor expanded in t around inf 72.5%
sub-neg72.5%
mul-1-neg72.5%
unsub-neg72.5%
associate-/l*81.8%
mul-1-neg81.8%
remove-double-neg81.8%
associate-/l*91.8%
Simplified91.8%
if -1.3e131 < t < 2.35000000000000003e117Initial program 85.4%
+-commutative85.4%
associate--l+85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in z around inf 86.2%
associate-/l*89.2%
Simplified89.2%
Final simplification90.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -1.28e-49) (not (<= a 720.0))) (+ y (+ x (* y (/ z (- t a))))) (+ x (/ (- (* y z) (* a y)) t))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -1.28e-49) || !(a <= 720.0)) {
tmp = y + (x + (y * (z / (t - a))));
} else {
tmp = x + (((y * z) - (a * y)) / 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.28d-49)) .or. (.not. (a <= 720.0d0))) then
tmp = y + (x + (y * (z / (t - a))))
else
tmp = x + (((y * z) - (a * y)) / 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.28e-49) || !(a <= 720.0)) {
tmp = y + (x + (y * (z / (t - a))));
} else {
tmp = x + (((y * z) - (a * y)) / t);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -1.28e-49) or not (a <= 720.0): tmp = y + (x + (y * (z / (t - a)))) else: tmp = x + (((y * z) - (a * y)) / t) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -1.28e-49) || !(a <= 720.0)) tmp = Float64(y + Float64(x + Float64(y * Float64(z / Float64(t - a))))); else tmp = Float64(x + Float64(Float64(Float64(y * z) - Float64(a * y)) / t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -1.28e-49) || ~((a <= 720.0))) tmp = y + (x + (y * (z / (t - a)))); else tmp = x + (((y * z) - (a * y)) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -1.28e-49], N[Not[LessEqual[a, 720.0]], $MachinePrecision]], N[(y + N[(x + N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(y * z), $MachinePrecision] - N[(a * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.28 \cdot 10^{-49} \lor \neg \left(a \leq 720\right):\\
\;\;\;\;y + \left(x + y \cdot \frac{z}{t - a}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z - a \cdot y}{t}\\
\end{array}
\end{array}
if a < -1.28e-49 or 720 < a Initial program 78.0%
+-commutative78.0%
associate--l+78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in z around inf 79.2%
associate-/l*89.0%
Simplified89.0%
if -1.28e-49 < a < 720Initial program 70.0%
+-commutative70.0%
associate--l+70.0%
*-commutative70.0%
Simplified70.0%
Taylor expanded in t around -inf 85.2%
mul-1-neg85.2%
unsub-neg85.2%
*-commutative85.2%
Simplified85.2%
Final simplification87.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.4e+134) x (if (<= t 1.2e+198) (+ y (+ x (* y (/ z (- t a))))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.4e+134) {
tmp = x;
} else if (t <= 1.2e+198) {
tmp = y + (x + (y * (z / (t - a))));
} 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 <= (-1.4d+134)) then
tmp = x
else if (t <= 1.2d+198) then
tmp = y + (x + (y * (z / (t - a))))
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 <= -1.4e+134) {
tmp = x;
} else if (t <= 1.2e+198) {
tmp = y + (x + (y * (z / (t - a))));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.4e+134: tmp = x elif t <= 1.2e+198: tmp = y + (x + (y * (z / (t - a)))) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.4e+134) tmp = x; elseif (t <= 1.2e+198) tmp = Float64(y + Float64(x + Float64(y * Float64(z / Float64(t - a))))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.4e+134) tmp = x; elseif (t <= 1.2e+198) tmp = y + (x + (y * (z / (t - a)))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.4e+134], x, If[LessEqual[t, 1.2e+198], N[(y + N[(x + N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.4 \cdot 10^{+134}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+198}:\\
\;\;\;\;y + \left(x + y \cdot \frac{z}{t - a}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -1.3999999999999999e134 or 1.2000000000000001e198 < t Initial program 46.4%
sub-neg46.4%
+-commutative46.4%
distribute-frac-neg46.4%
distribute-rgt-neg-out46.4%
associate-/l*55.9%
fma-define56.0%
distribute-frac-neg56.0%
distribute-neg-frac256.0%
sub-neg56.0%
distribute-neg-in56.0%
remove-double-neg56.0%
+-commutative56.0%
sub-neg56.0%
Simplified56.0%
Taylor expanded in y around 0 76.5%
if -1.3999999999999999e134 < t < 1.2000000000000001e198Initial program 81.9%
+-commutative81.9%
associate--l+81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in z around inf 82.2%
associate-/l*86.9%
Simplified86.9%
Final simplification84.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -7.2e+132) x (if (<= t 2.05e+116) (+ y (- x (* y (/ z a)))) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.2e+132) {
tmp = x;
} else if (t <= 2.05e+116) {
tmp = y + (x - (y * (z / a)));
} 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 <= (-7.2d+132)) then
tmp = x
else if (t <= 2.05d+116) then
tmp = y + (x - (y * (z / a)))
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 <= -7.2e+132) {
tmp = x;
} else if (t <= 2.05e+116) {
tmp = y + (x - (y * (z / a)));
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.2e+132: tmp = x elif t <= 2.05e+116: tmp = y + (x - (y * (z / a))) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.2e+132) tmp = x; elseif (t <= 2.05e+116) tmp = Float64(y + Float64(x - Float64(y * Float64(z / a)))); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7.2e+132) tmp = x; elseif (t <= 2.05e+116) tmp = y + (x - (y * (z / a))); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.2e+132], x, If[LessEqual[t, 2.05e+116], N[(y + N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+132}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 2.05 \cdot 10^{+116}:\\
\;\;\;\;y + \left(x - y \cdot \frac{z}{a}\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -7.20000000000000031e132 or 2.0499999999999999e116 < t Initial program 46.3%
sub-neg46.3%
+-commutative46.3%
distribute-frac-neg46.3%
distribute-rgt-neg-out46.3%
associate-/l*58.8%
fma-define59.1%
distribute-frac-neg59.1%
distribute-neg-frac259.1%
sub-neg59.1%
distribute-neg-in59.1%
remove-double-neg59.1%
+-commutative59.1%
sub-neg59.1%
Simplified59.1%
Taylor expanded in y around 0 72.2%
if -7.20000000000000031e132 < t < 2.0499999999999999e116Initial program 85.4%
+-commutative85.4%
associate--l+85.4%
*-commutative85.4%
Simplified85.4%
Taylor expanded in t around 0 75.8%
associate-/l*77.9%
Simplified77.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.1e-19) (not (<= a 24000000000.0))) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.1e-19) || !(a <= 24000000000.0)) {
tmp = x + y;
} 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 ((a <= (-2.1d-19)) .or. (.not. (a <= 24000000000.0d0))) then
tmp = x + y
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 ((a <= -2.1e-19) || !(a <= 24000000000.0)) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.1e-19) or not (a <= 24000000000.0): tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.1e-19) || !(a <= 24000000000.0)) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.1e-19) || ~((a <= 24000000000.0))) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.1e-19], N[Not[LessEqual[a, 24000000000.0]], $MachinePrecision]], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.1 \cdot 10^{-19} \lor \neg \left(a \leq 24000000000\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.0999999999999999e-19 or 2.4e10 < a Initial program 78.3%
sub-neg78.3%
+-commutative78.3%
distribute-frac-neg78.3%
distribute-rgt-neg-out78.3%
associate-/l*90.0%
fma-define90.1%
distribute-frac-neg90.1%
distribute-neg-frac290.1%
sub-neg90.1%
distribute-neg-in90.1%
remove-double-neg90.1%
+-commutative90.1%
sub-neg90.1%
Simplified90.1%
Taylor expanded in a around inf 78.4%
+-commutative78.4%
Simplified78.4%
if -2.0999999999999999e-19 < a < 2.4e10Initial program 70.1%
sub-neg70.1%
+-commutative70.1%
distribute-frac-neg70.1%
distribute-rgt-neg-out70.1%
associate-/l*71.4%
fma-define71.6%
distribute-frac-neg71.6%
distribute-neg-frac271.6%
sub-neg71.6%
distribute-neg-in71.6%
remove-double-neg71.6%
+-commutative71.6%
sub-neg71.6%
Simplified71.6%
Taylor expanded in y around 0 57.8%
Final simplification68.2%
(FPCore (x y z t a) :precision binary64 (if (<= y -9e+87) y (if (<= y 7.5e+127) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9e+87) {
tmp = y;
} else if (y <= 7.5e+127) {
tmp = x;
} else {
tmp = 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) :: tmp
if (y <= (-9d+87)) then
tmp = y
else if (y <= 7.5d+127) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9e+87) {
tmp = y;
} else if (y <= 7.5e+127) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -9e+87: tmp = y elif y <= 7.5e+127: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -9e+87) tmp = y; elseif (y <= 7.5e+127) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -9e+87) tmp = y; elseif (y <= 7.5e+127) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -9e+87], y, If[LessEqual[y, 7.5e+127], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9 \cdot 10^{+87}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{+127}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -9.0000000000000005e87 or 7.4999999999999996e127 < y Initial program 55.4%
+-commutative55.4%
associate--l+55.4%
*-commutative55.4%
Simplified55.4%
Taylor expanded in y around -inf 65.9%
neg-mul-165.9%
unsub-neg65.9%
Simplified65.9%
Taylor expanded in a around inf 35.9%
if -9.0000000000000005e87 < y < 7.4999999999999996e127Initial program 85.0%
sub-neg85.0%
+-commutative85.0%
distribute-frac-neg85.0%
distribute-rgt-neg-out85.0%
associate-/l*86.3%
fma-define86.4%
distribute-frac-neg86.4%
distribute-neg-frac286.4%
sub-neg86.4%
distribute-neg-in86.4%
remove-double-neg86.4%
+-commutative86.4%
sub-neg86.4%
Simplified86.4%
Taylor expanded in y around 0 71.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 74.2%
sub-neg74.2%
+-commutative74.2%
distribute-frac-neg74.2%
distribute-rgt-neg-out74.2%
associate-/l*80.8%
fma-define80.9%
distribute-frac-neg80.9%
distribute-neg-frac280.9%
sub-neg80.9%
distribute-neg-in80.9%
remove-double-neg80.9%
+-commutative80.9%
sub-neg80.9%
Simplified80.9%
Taylor expanded in y around 0 51.9%
(FPCore (x y z t a) :precision binary64 0.0)
double code(double x, double y, double z, double t, double a) {
return 0.0;
}
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 = 0.0d0
end function
public static double code(double x, double y, double z, double t, double a) {
return 0.0;
}
def code(x, y, z, t, a): return 0.0
function code(x, y, z, t, a) return 0.0 end
function tmp = code(x, y, z, t, a) tmp = 0.0; end
code[x_, y_, z_, t_, a_] := 0.0
\begin{array}{l}
\\
0
\end{array}
Initial program 74.2%
+-commutative74.2%
associate--l+74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in t around inf 42.9%
Taylor expanded in x around 0 2.6%
neg-mul-12.6%
Simplified2.6%
Taylor expanded in y around 0 2.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 2024170
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTick from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) -13664970889390727/100000000000000000000000) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)) (if (< (- (+ x y) (/ (* (- z t) y) (- a t))) 14754293444577233/1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (/ (- (* y (- a z)) (* x t)) (- a t)) (- (+ y x) (* (* (- z t) (/ 1 (- a t))) y)))))
(- (+ x y) (/ (* (- z t) y) (- a t))))