
(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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 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(Float64(y * 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[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y \cdot \left(z - t\right)}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
Initial program 85.4%
associate-/l*N/A
clear-numN/A
un-div-invN/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.8
Applied egg-rr97.8%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (* y (- z t)) (- a t)))) (if (<= t_1 -2e+138) y (if (<= t_1 5e+194) x y))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y * (z - t)) / (a - t);
double tmp;
if (t_1 <= -2e+138) {
tmp = y;
} else if (t_1 <= 5e+194) {
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) :: t_1
real(8) :: tmp
t_1 = (y * (z - t)) / (a - t)
if (t_1 <= (-2d+138)) then
tmp = y
else if (t_1 <= 5d+194) 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 t_1 = (y * (z - t)) / (a - t);
double tmp;
if (t_1 <= -2e+138) {
tmp = y;
} else if (t_1 <= 5e+194) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if t_1 <= -2e+138: tmp = y elif t_1 <= 5e+194: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y * Float64(z - t)) / Float64(a - t)) tmp = 0.0 if (t_1 <= -2e+138) tmp = y; elseif (t_1 <= 5e+194) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y * (z - t)) / (a - t); tmp = 0.0; if (t_1 <= -2e+138) tmp = y; elseif (t_1 <= 5e+194) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2e+138], y, If[LessEqual[t$95$1, 5e+194], x, y]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+138}:\\
\;\;\;\;y\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{+194}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -2.0000000000000001e138 or 4.99999999999999989e194 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 52.4%
Taylor expanded in x around 0
/-lowering-/.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
--lowering--.f6451.1
Simplified51.1%
Taylor expanded in t around inf
Simplified31.2%
if -2.0000000000000001e138 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 4.99999999999999989e194Initial program 98.8%
Taylor expanded in x around inf
Simplified71.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.3e+111)
(+ x y)
(if (<= t -2.1e-22)
(fma z (/ y (- t)) x)
(if (<= t 5e+109) (+ x (/ (* y z) a)) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e+111) {
tmp = x + y;
} else if (t <= -2.1e-22) {
tmp = fma(z, (y / -t), x);
} else if (t <= 5e+109) {
tmp = x + ((y * z) / a);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.3e+111) tmp = Float64(x + y); elseif (t <= -2.1e-22) tmp = fma(z, Float64(y / Float64(-t)), x); elseif (t <= 5e+109) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.3e+111], N[(x + y), $MachinePrecision], If[LessEqual[t, -2.1e-22], N[(z * N[(y / (-t)), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t, 5e+109], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+111}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -2.1 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{y}{-t}, x\right)\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+109}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -1.2999999999999999e111 or 5.0000000000000001e109 < t Initial program 60.8%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6479.6
Simplified79.6%
if -1.2999999999999999e111 < t < -2.10000000000000008e-22Initial program 96.8%
+-commutativeN/A
frac-2negN/A
div-invN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
--lowering--.f6499.8
Applied egg-rr99.8%
Taylor expanded in t around inf
mul-1-negN/A
neg-lowering-neg.f64N/A
/-lowering-/.f6481.0
Simplified81.0%
Taylor expanded in z around inf
Simplified83.8%
if -2.10000000000000008e-22 < t < 5.0000000000000001e109Initial program 96.6%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6479.7
Simplified79.7%
Final simplification80.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.7e-65) (fma y (/ (- z t) a) x) (if (<= a 3.45e+19) (fma y (- 1.0 (/ z t)) x) (fma (- z t) (/ y a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.7e-65) {
tmp = fma(y, ((z - t) / a), x);
} else if (a <= 3.45e+19) {
tmp = fma(y, (1.0 - (z / t)), x);
} else {
tmp = fma((z - t), (y / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.7e-65) tmp = fma(y, Float64(Float64(z - t) / a), x); elseif (a <= 3.45e+19) tmp = fma(y, Float64(1.0 - Float64(z / t)), x); else tmp = fma(Float64(z - t), Float64(y / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.7e-65], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 3.45e+19], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-65}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{elif}\;a \leq 3.45 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z - t, \frac{y}{a}, x\right)\\
\end{array}
\end{array}
if a < -2.6999999999999999e-65Initial program 88.2%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.1
Simplified86.1%
if -2.6999999999999999e-65 < a < 3.45e19Initial program 83.5%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6485.1
Simplified85.1%
if 3.45e19 < a Initial program 86.2%
+-commutativeN/A
frac-2negN/A
div-invN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
--lowering--.f6496.4
Applied egg-rr96.4%
Taylor expanded in t around 0
/-lowering-/.f6486.6
Simplified86.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (/ (- z t) a) x))) (if (<= a -5.7e-64) t_1 (if (<= a 7.2e+18) (fma y (- 1.0 (/ z t)) x) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, ((z - t) / a), x);
double tmp;
if (a <= -5.7e-64) {
tmp = t_1;
} else if (a <= 7.2e+18) {
tmp = fma(y, (1.0 - (z / t)), x);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(Float64(z - t) / a), x) tmp = 0.0 if (a <= -5.7e-64) tmp = t_1; elseif (a <= 7.2e+18) tmp = fma(y, Float64(1.0 - Float64(z / t)), x); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -5.7e-64], t$95$1, If[LessEqual[a, 7.2e+18], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{if}\;a \leq -5.7 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 7.2 \cdot 10^{+18}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -5.7000000000000003e-64 or 7.2e18 < a Initial program 87.3%
Taylor expanded in a around inf
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6486.2
Simplified86.2%
if -5.7000000000000003e-64 < a < 7.2e18Initial program 83.5%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6485.1
Simplified85.1%
(FPCore (x y z t a) :precision binary64 (if (<= a -9.2e-85) (fma y (/ t (- t a)) x) (if (<= a 2.95e+49) (fma y (- 1.0 (/ z t)) x) (fma y (/ z a) x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -9.2e-85) {
tmp = fma(y, (t / (t - a)), x);
} else if (a <= 2.95e+49) {
tmp = fma(y, (1.0 - (z / t)), x);
} else {
tmp = fma(y, (z / a), x);
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (a <= -9.2e-85) tmp = fma(y, Float64(t / Float64(t - a)), x); elseif (a <= 2.95e+49) tmp = fma(y, Float64(1.0 - Float64(z / t)), x); else tmp = fma(y, Float64(z / a), x); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -9.2e-85], N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[a, 2.95e+49], N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -9.2 \cdot 10^{-85}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{t}{t - a}, x\right)\\
\mathbf{elif}\;a \leq 2.95 \cdot 10^{+49}:\\
\;\;\;\;\mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\end{array}
\end{array}
if a < -9.2000000000000001e-85Initial program 89.1%
+-commutativeN/A
frac-2negN/A
div-invN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
neg-lowering-neg.f64N/A
/-lowering-/.f64N/A
neg-sub0N/A
sub-negN/A
+-commutativeN/A
associate--r+N/A
neg-sub0N/A
remove-double-negN/A
--lowering--.f6492.4
Applied egg-rr92.4%
Taylor expanded in z around 0
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f6481.5
Simplified81.5%
if -9.2000000000000001e-85 < a < 2.9500000000000001e49Initial program 82.2%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6484.7
Simplified84.7%
if 2.9500000000000001e49 < a Initial program 87.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6484.6
Simplified84.6%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (fma y (- 1.0 (/ z t)) x))) (if (<= t -6.5e-24) t_1 (if (<= t 5e+109) (+ x (/ (* y z) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = fma(y, (1.0 - (z / t)), x);
double tmp;
if (t <= -6.5e-24) {
tmp = t_1;
} else if (t <= 5e+109) {
tmp = x + ((y * z) / a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a) t_1 = fma(y, Float64(1.0 - Float64(z / t)), x) tmp = 0.0 if (t <= -6.5e-24) tmp = t_1; elseif (t <= 5e+109) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(1.0 - N[(z / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -6.5e-24], t$95$1, If[LessEqual[t, 5e+109], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, 1 - \frac{z}{t}, x\right)\\
\mathbf{if}\;t \leq -6.5 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+109}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -6.5e-24 or 5.0000000000000001e109 < t Initial program 70.6%
Taylor expanded in a around 0
+-commutativeN/A
mul-1-negN/A
associate-/l*N/A
distribute-rgt-neg-inN/A
accelerator-lowering-fma.f64N/A
neg-sub0N/A
div-subN/A
*-inversesN/A
associate-+l-N/A
neg-sub0N/A
mul-1-negN/A
+-commutativeN/A
mul-1-negN/A
unsub-negN/A
--lowering--.f64N/A
/-lowering-/.f6487.3
Simplified87.3%
if -6.5e-24 < t < 5.0000000000000001e109Initial program 96.6%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6479.7
Simplified79.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.6e+45) (+ x y) (if (<= t 1.4e+114) (+ x (/ (* y z) a)) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e+45) {
tmp = x + y;
} else if (t <= 1.4e+114) {
tmp = x + ((y * z) / a);
} else {
tmp = x + 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 (t <= (-5.6d+45)) then
tmp = x + y
else if (t <= 1.4d+114) then
tmp = x + ((y * z) / a)
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e+45) {
tmp = x + y;
} else if (t <= 1.4e+114) {
tmp = x + ((y * z) / a);
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.6e+45: tmp = x + y elif t <= 1.4e+114: tmp = x + ((y * z) / a) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.6e+45) tmp = Float64(x + y); elseif (t <= 1.4e+114) tmp = Float64(x + Float64(Float64(y * z) / a)); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.6e+45) tmp = x + y; elseif (t <= 1.4e+114) tmp = x + ((y * z) / a); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.6e+45], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.4e+114], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+45}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.4 \cdot 10^{+114}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -5.5999999999999999e45 or 1.4e114 < t Initial program 65.3%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6480.4
Simplified80.4%
if -5.5999999999999999e45 < t < 1.4e114Initial program 96.9%
Taylor expanded in t around 0
/-lowering-/.f64N/A
*-lowering-*.f6477.0
Simplified77.0%
Final simplification78.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.8e+45) (+ x y) (if (<= t 5e+109) (fma y (/ z a) x) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.8e+45) {
tmp = x + y;
} else if (t <= 5e+109) {
tmp = fma(y, (z / a), x);
} else {
tmp = x + y;
}
return tmp;
}
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.8e+45) tmp = Float64(x + y); elseif (t <= 5e+109) tmp = fma(y, Float64(z / a), x); else tmp = Float64(x + y); end return tmp end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.8e+45], N[(x + y), $MachinePrecision], If[LessEqual[t, 5e+109], N[(y * N[(z / a), $MachinePrecision] + x), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.8 \cdot 10^{+45}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+109}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{a}, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -5.7999999999999994e45 or 5.0000000000000001e109 < t Initial program 65.3%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6480.4
Simplified80.4%
if -5.7999999999999994e45 < t < 5.0000000000000001e109Initial program 96.9%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f6474.8
Simplified74.8%
Final simplification76.8%
(FPCore (x y z t a) :precision binary64 (fma (/ (- z t) (- a t)) y x))
double code(double x, double y, double z, double t, double a) {
return fma(((z - t) / (a - t)), y, x);
}
function code(x, y, z, t, a) return fma(Float64(Float64(z - t) / Float64(a - t)), y, x) end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] * y + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{z - t}{a - t}, y, x\right)
\end{array}
Initial program 85.4%
+-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6497.2
Applied egg-rr97.2%
(FPCore (x y z t a) :precision binary64 (fma (/ y (- a t)) (- z t) x))
double code(double x, double y, double z, double t, double a) {
return fma((y / (a - t)), (z - t), x);
}
function code(x, y, z, t, a) return fma(Float64(y / Float64(a - t)), Float64(z - t), x) end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision] * N[(z - t), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(\frac{y}{a - t}, z - t, x\right)
\end{array}
Initial program 85.4%
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
--lowering--.f6494.7
Applied egg-rr94.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.2e+129) x (if (<= a 2.4e+139) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.2e+129) {
tmp = x;
} else if (a <= 2.4e+139) {
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 <= (-1.2d+129)) then
tmp = x
else if (a <= 2.4d+139) 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 <= -1.2e+129) {
tmp = x;
} else if (a <= 2.4e+139) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.2e+129: tmp = x elif a <= 2.4e+139: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.2e+129) tmp = x; elseif (a <= 2.4e+139) 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 <= -1.2e+129) tmp = x; elseif (a <= 2.4e+139) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.2e+129], x, If[LessEqual[a, 2.4e+139], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.2 \cdot 10^{+129}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.4 \cdot 10^{+139}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.1999999999999999e129 or 2.40000000000000008e139 < a Initial program 85.3%
Taylor expanded in x around inf
Simplified71.9%
if -1.1999999999999999e129 < a < 2.40000000000000008e139Initial program 85.4%
Taylor expanded in t around inf
+-commutativeN/A
+-lowering-+.f6464.2
Simplified64.2%
Final simplification66.4%
(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.4%
Taylor expanded in x around inf
Simplified53.9%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (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 / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
herbie shell --seed 2024198
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- a t) (- z t)))))
(+ x (/ (* y (- z t)) (- a t))))