
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{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) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- a t)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (a - t)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(a - t)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)
\end{array}
Initial program 98.6%
+-commutative98.6%
fma-def98.6%
Simplified98.6%
Final simplification98.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* (/ y t) (- t z)))))
(if (<= t -6.5e+76)
t_1
(if (<= t 1.15e-89)
(+ x (* z (/ y (- a t))))
(if (<= t 6200000.0)
(- x (* y (/ (- t z) a)))
(if (<= t 4.3e+81)
t_1
(if (<= t 1.45e+115) (/ y (- 1.0 (/ a t))) (+ y x))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + ((y / t) * (t - z));
double tmp;
if (t <= -6.5e+76) {
tmp = t_1;
} else if (t <= 1.15e-89) {
tmp = x + (z * (y / (a - t)));
} else if (t <= 6200000.0) {
tmp = x - (y * ((t - z) / a));
} else if (t <= 4.3e+81) {
tmp = t_1;
} else if (t <= 1.45e+115) {
tmp = y / (1.0 - (a / 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) :: t_1
real(8) :: tmp
t_1 = x + ((y / t) * (t - z))
if (t <= (-6.5d+76)) then
tmp = t_1
else if (t <= 1.15d-89) then
tmp = x + (z * (y / (a - t)))
else if (t <= 6200000.0d0) then
tmp = x - (y * ((t - z) / a))
else if (t <= 4.3d+81) then
tmp = t_1
else if (t <= 1.45d+115) then
tmp = y / (1.0d0 - (a / 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 t_1 = x + ((y / t) * (t - z));
double tmp;
if (t <= -6.5e+76) {
tmp = t_1;
} else if (t <= 1.15e-89) {
tmp = x + (z * (y / (a - t)));
} else if (t <= 6200000.0) {
tmp = x - (y * ((t - z) / a));
} else if (t <= 4.3e+81) {
tmp = t_1;
} else if (t <= 1.45e+115) {
tmp = y / (1.0 - (a / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + ((y / t) * (t - z)) tmp = 0 if t <= -6.5e+76: tmp = t_1 elif t <= 1.15e-89: tmp = x + (z * (y / (a - t))) elif t <= 6200000.0: tmp = x - (y * ((t - z) / a)) elif t <= 4.3e+81: tmp = t_1 elif t <= 1.45e+115: tmp = y / (1.0 - (a / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(Float64(y / t) * Float64(t - z))) tmp = 0.0 if (t <= -6.5e+76) tmp = t_1; elseif (t <= 1.15e-89) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); elseif (t <= 6200000.0) tmp = Float64(x - Float64(y * Float64(Float64(t - z) / a))); elseif (t <= 4.3e+81) tmp = t_1; elseif (t <= 1.45e+115) tmp = Float64(y / Float64(1.0 - Float64(a / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + ((y / t) * (t - z)); tmp = 0.0; if (t <= -6.5e+76) tmp = t_1; elseif (t <= 1.15e-89) tmp = x + (z * (y / (a - t))); elseif (t <= 6200000.0) tmp = x - (y * ((t - z) / a)); elseif (t <= 4.3e+81) tmp = t_1; elseif (t <= 1.45e+115) tmp = y / (1.0 - (a / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.5e+76], t$95$1, If[LessEqual[t, 1.15e-89], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6200000.0], N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.3e+81], t$95$1, If[LessEqual[t, 1.45e+115], N[(y / N[(1.0 - N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \frac{y}{t} \cdot \left(t - z\right)\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{+76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-89}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t \leq 6200000:\\
\;\;\;\;x - y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;t \leq 4.3 \cdot 10^{+81}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.45 \cdot 10^{+115}:\\
\;\;\;\;\frac{y}{1 - \frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -6.5000000000000005e76 or 6.2e6 < t < 4.3000000000000001e81Initial program 99.9%
Taylor expanded in a around 0 73.1%
mul-1-neg73.1%
unsub-neg73.1%
associate-/l*92.6%
associate-/r/88.1%
Simplified88.1%
if -6.5000000000000005e76 < t < 1.15e-89Initial program 97.4%
Taylor expanded in z around inf 87.7%
associate-/l*91.4%
associate-/r/92.0%
Simplified92.0%
if 1.15e-89 < t < 6.2e6Initial program 99.6%
Taylor expanded in a around inf 99.6%
if 4.3000000000000001e81 < t < 1.45000000000000002e115Initial program 100.0%
Taylor expanded in z around 0 62.3%
mul-1-neg62.3%
unsub-neg62.3%
*-commutative62.3%
associate-/l*99.4%
Simplified99.4%
div-inv99.7%
div-sub99.7%
pow199.7%
pow199.7%
pow-div99.7%
metadata-eval99.7%
metadata-eval99.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 89.7%
metadata-eval89.7%
sub-neg89.7%
metadata-eval89.7%
times-frac89.7%
*-lft-identity89.7%
neg-mul-189.7%
neg-sub089.7%
+-commutative89.7%
associate--r+89.7%
metadata-eval89.7%
Simplified89.7%
if 1.45000000000000002e115 < t Initial program 99.9%
Taylor expanded in t around inf 87.9%
+-commutative87.9%
Simplified87.9%
Final simplification90.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.15e+77)
(+ y x)
(if (<= t 5.6e-89)
(+ x (* z (/ y (- a t))))
(if (<= t 3300000.0)
(- x (* y (/ (- t z) a)))
(if (<= t 3e+29) (- x (* z (/ y t))) (+ y x))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.15e+77) {
tmp = y + x;
} else if (t <= 5.6e-89) {
tmp = x + (z * (y / (a - t)));
} else if (t <= 3300000.0) {
tmp = x - (y * ((t - z) / a));
} else if (t <= 3e+29) {
tmp = x - (z * (y / 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 (t <= (-1.15d+77)) then
tmp = y + x
else if (t <= 5.6d-89) then
tmp = x + (z * (y / (a - t)))
else if (t <= 3300000.0d0) then
tmp = x - (y * ((t - z) / a))
else if (t <= 3d+29) then
tmp = x - (z * (y / 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 (t <= -1.15e+77) {
tmp = y + x;
} else if (t <= 5.6e-89) {
tmp = x + (z * (y / (a - t)));
} else if (t <= 3300000.0) {
tmp = x - (y * ((t - z) / a));
} else if (t <= 3e+29) {
tmp = x - (z * (y / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.15e+77: tmp = y + x elif t <= 5.6e-89: tmp = x + (z * (y / (a - t))) elif t <= 3300000.0: tmp = x - (y * ((t - z) / a)) elif t <= 3e+29: tmp = x - (z * (y / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.15e+77) tmp = Float64(y + x); elseif (t <= 5.6e-89) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); elseif (t <= 3300000.0) tmp = Float64(x - Float64(y * Float64(Float64(t - z) / a))); elseif (t <= 3e+29) tmp = Float64(x - Float64(z * Float64(y / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.15e+77) tmp = y + x; elseif (t <= 5.6e-89) tmp = x + (z * (y / (a - t))); elseif (t <= 3300000.0) tmp = x - (y * ((t - z) / a)); elseif (t <= 3e+29) tmp = x - (z * (y / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.15e+77], N[(y + x), $MachinePrecision], If[LessEqual[t, 5.6e-89], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3300000.0], N[(x - N[(y * N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e+29], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.15 \cdot 10^{+77}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-89}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;t \leq 3300000:\\
\;\;\;\;x - y \cdot \frac{t - z}{a}\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+29}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.14999999999999997e77 or 2.9999999999999999e29 < t Initial program 99.9%
Taylor expanded in t around inf 82.3%
+-commutative82.3%
Simplified82.3%
if -1.14999999999999997e77 < t < 5.5999999999999998e-89Initial program 97.4%
Taylor expanded in z around inf 87.7%
associate-/l*91.4%
associate-/r/92.0%
Simplified92.0%
if 5.5999999999999998e-89 < t < 3.3e6Initial program 99.6%
Taylor expanded in a around inf 99.6%
if 3.3e6 < t < 2.9999999999999999e29Initial program 100.0%
Taylor expanded in a around 0 84.4%
mul-1-neg84.4%
unsub-neg84.4%
associate-/l*84.4%
associate-/r/84.6%
Simplified84.6%
Taylor expanded in t around 0 67.8%
associate-/l*67.8%
Simplified67.8%
associate-/r/68.0%
Applied egg-rr68.0%
Final simplification88.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.05e+79) (+ y x) (if (<= t 8e+29) (+ x (* y (/ z (- a t)))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.05e+79) {
tmp = y + x;
} else if (t <= 8e+29) {
tmp = x + (y * (z / (a - 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 (t <= (-1.05d+79)) then
tmp = y + x
else if (t <= 8d+29) then
tmp = x + (y * (z / (a - 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 (t <= -1.05e+79) {
tmp = y + x;
} else if (t <= 8e+29) {
tmp = x + (y * (z / (a - t)));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.05e+79: tmp = y + x elif t <= 8e+29: tmp = x + (y * (z / (a - t))) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.05e+79) tmp = Float64(y + x); elseif (t <= 8e+29) tmp = Float64(x + Float64(y * Float64(z / Float64(a - t)))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.05e+79) tmp = y + x; elseif (t <= 8e+29) tmp = x + (y * (z / (a - t))); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.05e+79], N[(y + x), $MachinePrecision], If[LessEqual[t, 8e+29], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{+79}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+29}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.05000000000000004e79 or 7.99999999999999931e29 < t Initial program 99.9%
Taylor expanded in t around inf 82.3%
+-commutative82.3%
Simplified82.3%
if -1.05000000000000004e79 < t < 7.99999999999999931e29Initial program 97.8%
clear-num97.4%
associate-/r/97.7%
Applied egg-rr97.7%
Taylor expanded in z around inf 88.3%
Final simplification85.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -5.7e+84) (+ x (* z (/ y (- a t)))) (if (<= z 5.6e-46) (- x (/ y (/ (- a t) t))) (+ x (* y (/ z (- a t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5.7e+84) {
tmp = x + (z * (y / (a - t)));
} else if (z <= 5.6e-46) {
tmp = x - (y / ((a - t) / t));
} 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 (z <= (-5.7d+84)) then
tmp = x + (z * (y / (a - t)))
else if (z <= 5.6d-46) then
tmp = x - (y / ((a - t) / t))
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 (z <= -5.7e+84) {
tmp = x + (z * (y / (a - t)));
} else if (z <= 5.6e-46) {
tmp = x - (y / ((a - t) / t));
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5.7e+84: tmp = x + (z * (y / (a - t))) elif z <= 5.6e-46: tmp = x - (y / ((a - t) / t)) else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5.7e+84) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); elseif (z <= 5.6e-46) tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); 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 (z <= -5.7e+84) tmp = x + (z * (y / (a - t))); elseif (z <= 5.6e-46) tmp = x - (y / ((a - t) / t)); else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5.7e+84], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e-46], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.7 \cdot 10^{+84}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{-46}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if z < -5.6999999999999997e84Initial program 92.6%
Taylor expanded in z around inf 71.8%
associate-/l*82.1%
associate-/r/87.0%
Simplified87.0%
if -5.6999999999999997e84 < z < 5.5999999999999997e-46Initial program 99.6%
Taylor expanded in z around 0 76.3%
mul-1-neg76.3%
unsub-neg76.3%
*-commutative76.3%
associate-/l*91.1%
Simplified91.1%
if 5.5999999999999997e-46 < z Initial program 99.9%
clear-num99.9%
associate-/r/99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 90.5%
Final simplification90.3%
(FPCore (x y z t a) :precision binary64 (if (<= t -4.8e+76) (+ y x) (if (<= t 1.06e-5) (+ x (* y (/ z a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e+76) {
tmp = y + x;
} else if (t <= 1.06e-5) {
tmp = x + (y * (z / a));
} 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 (t <= (-4.8d+76)) then
tmp = y + x
else if (t <= 1.06d-5) then
tmp = x + (y * (z / a))
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 (t <= -4.8e+76) {
tmp = y + x;
} else if (t <= 1.06e-5) {
tmp = x + (y * (z / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.8e+76: tmp = y + x elif t <= 1.06e-5: tmp = x + (y * (z / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.8e+76) tmp = Float64(y + x); elseif (t <= 1.06e-5) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.8e+76) tmp = y + x; elseif (t <= 1.06e-5) tmp = x + (y * (z / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.8e+76], N[(y + x), $MachinePrecision], If[LessEqual[t, 1.06e-5], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+76}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 1.06 \cdot 10^{-5}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -4.8e76 or 1.06e-5 < t Initial program 99.9%
Taylor expanded in t around inf 80.4%
+-commutative80.4%
Simplified80.4%
if -4.8e76 < t < 1.06e-5Initial program 97.7%
Taylor expanded in t around 0 79.9%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -7e+76) (+ y x) (if (<= t 8.5e-6) (+ x (* z (/ y a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+76) {
tmp = y + x;
} else if (t <= 8.5e-6) {
tmp = x + (z * (y / a));
} 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 (t <= (-7d+76)) then
tmp = y + x
else if (t <= 8.5d-6) then
tmp = x + (z * (y / a))
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 (t <= -7e+76) {
tmp = y + x;
} else if (t <= 8.5e-6) {
tmp = x + (z * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7e+76: tmp = y + x elif t <= 8.5e-6: tmp = x + (z * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+76) tmp = Float64(y + x); elseif (t <= 8.5e-6) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7e+76) tmp = y + x; elseif (t <= 8.5e-6) tmp = x + (z * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+76], N[(y + x), $MachinePrecision], If[LessEqual[t, 8.5e-6], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+76}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-6}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -7.00000000000000001e76 or 8.4999999999999999e-6 < t Initial program 99.9%
Taylor expanded in t around inf 80.4%
+-commutative80.4%
Simplified80.4%
if -7.00000000000000001e76 < t < 8.4999999999999999e-6Initial program 97.7%
Taylor expanded in t around 0 75.9%
+-commutative75.9%
associate-/l*79.8%
associate-/r/79.9%
Simplified79.9%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - 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 - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Initial program 98.6%
Final simplification98.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.5e+77) (+ y x) (if (<= t 5e-100) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.5e+77) {
tmp = y + x;
} else if (t <= 5e-100) {
tmp = x;
} 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 (t <= (-1.5d+77)) then
tmp = y + x
else if (t <= 5d-100) then
tmp = x
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 (t <= -1.5e+77) {
tmp = y + x;
} else if (t <= 5e-100) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.5e+77: tmp = y + x elif t <= 5e-100: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.5e+77) tmp = Float64(y + x); elseif (t <= 5e-100) tmp = x; else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.5e+77) tmp = y + x; elseif (t <= 5e-100) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.5e+77], N[(y + x), $MachinePrecision], If[LessEqual[t, 5e-100], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.5 \cdot 10^{+77}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 5 \cdot 10^{-100}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.4999999999999999e77 or 5.0000000000000001e-100 < t Initial program 99.9%
Taylor expanded in t around inf 75.5%
+-commutative75.5%
Simplified75.5%
if -1.4999999999999999e77 < t < 5.0000000000000001e-100Initial program 97.4%
Taylor expanded in x around inf 57.0%
Final simplification66.2%
(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 98.6%
Taylor expanded in x around inf 51.0%
Final simplification51.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (* y (/ (- z t) (- a t))))))
(if (< y -8.508084860551241e-17)
t_1
(if (< y 2.894426862792089e-49)
(+ x (* (* y (- z t)) (/ 1.0 (- a t))))
t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (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) :: tmp
t_1 = x + (y * ((z - t) / (a - t)))
if (y < (-8.508084860551241d-17)) then
tmp = t_1
else if (y < 2.894426862792089d-49) then
tmp = x + ((y * (z - t)) * (1.0d0 / (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 = x + (y * ((z - t) / (a - t)));
double tmp;
if (y < -8.508084860551241e-17) {
tmp = t_1;
} else if (y < 2.894426862792089e-49) {
tmp = x + ((y * (z - t)) * (1.0 / (a - t)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y * ((z - t) / (a - t))) tmp = 0 if y < -8.508084860551241e-17: tmp = t_1 elif y < 2.894426862792089e-49: tmp = x + ((y * (z - t)) * (1.0 / (a - t))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) tmp = 0.0 if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = Float64(x + Float64(Float64(y * Float64(z - t)) * Float64(1.0 / Float64(a - t)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y * ((z - t) / (a - t))); tmp = 0.0; if (y < -8.508084860551241e-17) tmp = t_1; elseif (y < 2.894426862792089e-49) tmp = x + ((y * (z - t)) * (1.0 / (a - t))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -8.508084860551241e-17], t$95$1, If[Less[y, 2.894426862792089e-49], N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] * N[(1.0 / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + y \cdot \frac{z - t}{a - t}\\
\mathbf{if}\;y < -8.508084860551241 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x + \left(y \cdot \left(z - t\right)\right) \cdot \frac{1}{a - t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
herbie shell --seed 2023290
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))