
(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 11 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
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (or (<= t_1 -2e+301) (not (<= t_1 4e+258)))
(+ x (/ (- z t) (/ (- a t) y)))
(+ x t_1))))
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+301) || !(t_1 <= 4e+258)) {
tmp = x + ((z - t) / ((a - t) / y));
} else {
tmp = x + 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 = (y * (z - t)) / (a - t)
if ((t_1 <= (-2d+301)) .or. (.not. (t_1 <= 4d+258))) then
tmp = x + ((z - t) / ((a - t) / y))
else
tmp = x + 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 * (z - t)) / (a - t);
double tmp;
if ((t_1 <= -2e+301) || !(t_1 <= 4e+258)) {
tmp = x + ((z - t) / ((a - t) / y));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if (t_1 <= -2e+301) or not (t_1 <= 4e+258): tmp = x + ((z - t) / ((a - t) / y)) else: tmp = x + t_1 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+301) || !(t_1 <= 4e+258)) tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(a - t) / y))); else tmp = Float64(x + t_1); 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+301) || ~((t_1 <= 4e+258))) tmp = x + ((z - t) / ((a - t) / y)); else tmp = x + t_1; 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[Or[LessEqual[t$95$1, -2e+301], N[Not[LessEqual[t$95$1, 4e+258]], $MachinePrecision]], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\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^{+301} \lor \neg \left(t_1 \leq 4 \cdot 10^{+258}\right):\\
\;\;\;\;x + \frac{z - t}{\frac{a - t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -2.00000000000000011e301 or 4.00000000000000023e258 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 30.3%
*-commutative30.3%
associate-/l*99.8%
Simplified99.8%
if -2.00000000000000011e301 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 4.00000000000000023e258Initial program 99.9%
Final simplification99.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* y (- z t)) (- a t))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 1e+290)))
(+ x (/ (- t z) (/ t y)))
(+ x t_1))))
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 <= -((double) INFINITY)) || !(t_1 <= 1e+290)) {
tmp = x + ((t - z) / (t / y));
} else {
tmp = x + t_1;
}
return tmp;
}
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 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 1e+290)) {
tmp = x + ((t - z) / (t / y));
} else {
tmp = x + t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y * (z - t)) / (a - t) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 1e+290): tmp = x + ((t - z) / (t / y)) else: tmp = x + t_1 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 <= Float64(-Inf)) || !(t_1 <= 1e+290)) tmp = Float64(x + Float64(Float64(t - z) / Float64(t / y))); else tmp = Float64(x + t_1); 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 <= -Inf) || ~((t_1 <= 1e+290))) tmp = x + ((t - z) / (t / y)); else tmp = x + t_1; 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[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 1e+290]], $MachinePrecision]], N[(x + N[(N[(t - z), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + t$95$1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot \left(z - t\right)}{a - t}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 10^{+290}\right):\\
\;\;\;\;x + \frac{t - z}{\frac{t}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < -inf.0 or 1.00000000000000006e290 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) Initial program 28.5%
Taylor expanded in a around 0 26.3%
+-commutative26.3%
mul-1-neg26.3%
*-commutative26.3%
unsub-neg26.3%
associate-/l*77.3%
Simplified77.3%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) (-.f64 a t)) < 1.00000000000000006e290Initial program 99.8%
Final simplification93.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.8e+59)
(+ x (/ (- t z) (/ t y)))
(if (<= t 6400000000.0)
(+ x (/ 1.0 (/ (/ (- a t) y) z)))
(- x (/ y (/ (- a t) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.8e+59) {
tmp = x + ((t - z) / (t / y));
} else if (t <= 6400000000.0) {
tmp = x + (1.0 / (((a - t) / y) / z));
} else {
tmp = x - (y / ((a - t) / 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 (t <= (-4.8d+59)) then
tmp = x + ((t - z) / (t / y))
else if (t <= 6400000000.0d0) then
tmp = x + (1.0d0 / (((a - t) / y) / z))
else
tmp = x - (y / ((a - t) / t))
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+59) {
tmp = x + ((t - z) / (t / y));
} else if (t <= 6400000000.0) {
tmp = x + (1.0 / (((a - t) / y) / z));
} else {
tmp = x - (y / ((a - t) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.8e+59: tmp = x + ((t - z) / (t / y)) elif t <= 6400000000.0: tmp = x + (1.0 / (((a - t) / y) / z)) else: tmp = x - (y / ((a - t) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.8e+59) tmp = Float64(x + Float64(Float64(t - z) / Float64(t / y))); elseif (t <= 6400000000.0) tmp = Float64(x + Float64(1.0 / Float64(Float64(Float64(a - t) / y) / z))); else tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.8e+59) tmp = x + ((t - z) / (t / y)); elseif (t <= 6400000000.0) tmp = x + (1.0 / (((a - t) / y) / z)); else tmp = x - (y / ((a - t) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.8e+59], N[(x + N[(N[(t - z), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 6400000000.0], N[(x + N[(1.0 / N[(N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{+59}:\\
\;\;\;\;x + \frac{t - z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 6400000000:\\
\;\;\;\;x + \frac{1}{\frac{\frac{a - t}{y}}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\end{array}
\end{array}
if t < -4.8000000000000004e59Initial program 71.2%
Taylor expanded in a around 0 68.9%
+-commutative68.9%
mul-1-neg68.9%
*-commutative68.9%
unsub-neg68.9%
associate-/l*86.4%
Simplified86.4%
if -4.8000000000000004e59 < t < 6.4e9Initial program 93.4%
clear-num93.4%
inv-pow93.4%
Applied egg-rr93.4%
unpow-193.4%
Simplified93.4%
Taylor expanded in z around inf 86.3%
associate-/r*90.8%
Simplified90.8%
if 6.4e9 < t Initial program 57.8%
Taylor expanded in z around 0 54.8%
+-commutative54.8%
mul-1-neg54.8%
*-commutative54.8%
associate-*l/92.9%
unsub-neg92.9%
associate-*l/54.8%
*-commutative54.8%
associate-/l*92.9%
Simplified92.9%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -9e+119) (not (<= t 15000000000.0))) (- x (* y (/ t (- a t)))) (+ x (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -9e+119) || !(t <= 15000000000.0)) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + (z * (y / (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 ((t <= (-9d+119)) .or. (.not. (t <= 15000000000.0d0))) then
tmp = x - (y * (t / (a - t)))
else
tmp = x + (z * (y / (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 ((t <= -9e+119) || !(t <= 15000000000.0)) {
tmp = x - (y * (t / (a - t)));
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -9e+119) or not (t <= 15000000000.0): tmp = x - (y * (t / (a - t))) else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -9e+119) || !(t <= 15000000000.0)) tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); else tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -9e+119) || ~((t <= 15000000000.0))) tmp = x - (y * (t / (a - t))); else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -9e+119], N[Not[LessEqual[t, 15000000000.0]], $MachinePrecision]], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{+119} \lor \neg \left(t \leq 15000000000\right):\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -9.00000000000000039e119 or 1.5e10 < t Initial program 61.4%
+-commutative61.4%
associate-*l/95.6%
fma-def95.6%
Simplified95.6%
fma-udef95.6%
associate-*l/61.4%
associate-/l*99.9%
div-inv99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 56.9%
+-commutative56.9%
mul-1-neg56.9%
associate-*r/91.4%
unsub-neg91.4%
Simplified91.4%
if -9.00000000000000039e119 < t < 1.5e10Initial program 93.2%
Taylor expanded in z around inf 84.7%
associate-*l/89.6%
*-commutative89.6%
Simplified89.6%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.6e+112) (+ y x) (if (<= t 3e+115) (+ x (* z (/ y (- a t)))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6e+112) {
tmp = y + x;
} else if (t <= 3e+115) {
tmp = x + (z * (y / (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.6d+112)) then
tmp = y + x
else if (t <= 3d+115) then
tmp = x + (z * (y / (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.6e+112) {
tmp = y + x;
} else if (t <= 3e+115) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.6e+112: tmp = y + x elif t <= 3e+115: tmp = x + (z * (y / (a - t))) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.6e+112) tmp = Float64(y + x); elseif (t <= 3e+115) tmp = Float64(x + Float64(z * Float64(y / 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.6e+112) tmp = y + x; elseif (t <= 3e+115) tmp = x + (z * (y / (a - t))); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.6e+112], N[(y + x), $MachinePrecision], If[LessEqual[t, 3e+115], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+112}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+115}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.59999999999999993e112 or 3e115 < t Initial program 54.5%
Taylor expanded in t around inf 88.4%
if -1.59999999999999993e112 < t < 3e115Initial program 92.9%
Taylor expanded in z around inf 83.4%
associate-*l/88.2%
*-commutative88.2%
Simplified88.2%
Final simplification88.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.6e+112)
(- x (* y (/ t (- a t))))
(if (<= t 2500000000000.0)
(+ x (* z (/ y (- a t))))
(- x (/ y (/ (- a t) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.6e+112) {
tmp = x - (y * (t / (a - t)));
} else if (t <= 2500000000000.0) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / 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 (t <= (-1.6d+112)) then
tmp = x - (y * (t / (a - t)))
else if (t <= 2500000000000.0d0) then
tmp = x + (z * (y / (a - t)))
else
tmp = x - (y / ((a - t) / t))
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.6e+112) {
tmp = x - (y * (t / (a - t)));
} else if (t <= 2500000000000.0) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.6e+112: tmp = x - (y * (t / (a - t))) elif t <= 2500000000000.0: tmp = x + (z * (y / (a - t))) else: tmp = x - (y / ((a - t) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.6e+112) tmp = Float64(x - Float64(y * Float64(t / Float64(a - t)))); elseif (t <= 2500000000000.0) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.6e+112) tmp = x - (y * (t / (a - t))); elseif (t <= 2500000000000.0) tmp = x + (z * (y / (a - t))); else tmp = x - (y / ((a - t) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.6e+112], N[(x - N[(y * N[(t / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2500000000000.0], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.6 \cdot 10^{+112}:\\
\;\;\;\;x - y \cdot \frac{t}{a - t}\\
\mathbf{elif}\;t \leq 2500000000000:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\end{array}
\end{array}
if t < -1.59999999999999993e112Initial program 67.1%
+-commutative67.1%
associate-*l/91.7%
fma-def91.7%
Simplified91.7%
fma-udef91.7%
associate-*l/67.1%
associate-/l*99.9%
div-inv99.9%
clear-num99.9%
Applied egg-rr99.9%
Taylor expanded in z around 0 60.2%
+-commutative60.2%
mul-1-neg60.2%
associate-*r/89.0%
unsub-neg89.0%
Simplified89.0%
if -1.59999999999999993e112 < t < 2.5e12Initial program 93.2%
Taylor expanded in z around inf 84.7%
associate-*l/89.6%
*-commutative89.6%
Simplified89.6%
if 2.5e12 < t Initial program 57.8%
Taylor expanded in z around 0 54.8%
+-commutative54.8%
mul-1-neg54.8%
*-commutative54.8%
associate-*l/92.9%
unsub-neg92.9%
associate-*l/54.8%
*-commutative54.8%
associate-/l*92.9%
Simplified92.9%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -5.6e+59) (+ x (/ (- t z) (/ t y))) (if (<= t 7e+14) (+ x (* z (/ y (- a t)))) (- x (/ y (/ (- a t) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -5.6e+59) {
tmp = x + ((t - z) / (t / y));
} else if (t <= 7e+14) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / 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 (t <= (-5.6d+59)) then
tmp = x + ((t - z) / (t / y))
else if (t <= 7d+14) then
tmp = x + (z * (y / (a - t)))
else
tmp = x - (y / ((a - t) / t))
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+59) {
tmp = x + ((t - z) / (t / y));
} else if (t <= 7e+14) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x - (y / ((a - t) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -5.6e+59: tmp = x + ((t - z) / (t / y)) elif t <= 7e+14: tmp = x + (z * (y / (a - t))) else: tmp = x - (y / ((a - t) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -5.6e+59) tmp = Float64(x + Float64(Float64(t - z) / Float64(t / y))); elseif (t <= 7e+14) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x - Float64(y / Float64(Float64(a - t) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -5.6e+59) tmp = x + ((t - z) / (t / y)); elseif (t <= 7e+14) tmp = x + (z * (y / (a - t))); else tmp = x - (y / ((a - t) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -5.6e+59], N[(x + N[(N[(t - z), $MachinePrecision] / N[(t / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7e+14], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a - t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{+59}:\\
\;\;\;\;x + \frac{t - z}{\frac{t}{y}}\\
\mathbf{elif}\;t \leq 7 \cdot 10^{+14}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a - t}{t}}\\
\end{array}
\end{array}
if t < -5.5999999999999996e59Initial program 71.2%
Taylor expanded in a around 0 68.9%
+-commutative68.9%
mul-1-neg68.9%
*-commutative68.9%
unsub-neg68.9%
associate-/l*86.4%
Simplified86.4%
if -5.5999999999999996e59 < t < 7e14Initial program 93.4%
Taylor expanded in z around inf 86.3%
associate-*l/90.8%
*-commutative90.8%
Simplified90.8%
if 7e14 < t Initial program 57.8%
Taylor expanded in z around 0 54.8%
+-commutative54.8%
mul-1-neg54.8%
*-commutative54.8%
associate-*l/92.9%
unsub-neg92.9%
associate-*l/54.8%
*-commutative54.8%
associate-/l*92.9%
Simplified92.9%
Final simplification90.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -2e+20) (+ y x) (if (<= t 6.6e-14) (+ x (* z (/ y a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2e+20) {
tmp = y + x;
} else if (t <= 6.6e-14) {
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 <= (-2d+20)) then
tmp = y + x
else if (t <= 6.6d-14) 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 <= -2e+20) {
tmp = y + x;
} else if (t <= 6.6e-14) {
tmp = x + (z * (y / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2e+20: tmp = y + x elif t <= 6.6e-14: tmp = x + (z * (y / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2e+20) tmp = Float64(y + x); elseif (t <= 6.6e-14) 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 <= -2e+20) tmp = y + x; elseif (t <= 6.6e-14) tmp = x + (z * (y / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2e+20], N[(y + x), $MachinePrecision], If[LessEqual[t, 6.6e-14], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2 \cdot 10^{+20}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 6.6 \cdot 10^{-14}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -2e20 or 6.5999999999999996e-14 < t Initial program 66.2%
Taylor expanded in t around inf 80.4%
if -2e20 < t < 6.5999999999999996e-14Initial program 94.2%
Taylor expanded in z around inf 87.9%
associate-*l/92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in a around inf 83.7%
Final simplification81.9%
(FPCore (x y z t a) :precision binary64 (+ (* y (/ (- z t) (- a t))) x))
double code(double x, double y, double z, double t, double a) {
return (y * ((z - t) / (a - t))) + 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 * ((z - t) / (a - t))) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y * ((z - t) / (a - t))) + x;
}
def code(x, y, z, t, a): return (y * ((z - t) / (a - t))) + x
function code(x, y, z, t, a) return Float64(Float64(y * Float64(Float64(z - t) / Float64(a - t))) + x) end
function tmp = code(x, y, z, t, a) tmp = (y * ((z - t) / (a - t))) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \frac{z - t}{a - t} + x
\end{array}
Initial program 78.7%
+-commutative78.7%
associate-*l/96.0%
fma-def96.0%
Simplified96.0%
fma-udef96.0%
associate-*l/78.7%
associate-/l*98.7%
div-inv98.7%
clear-num98.8%
Applied egg-rr98.8%
Final simplification98.8%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.3e-161) (+ y x) (if (<= t 8.4e-19) x (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e-161) {
tmp = y + x;
} else if (t <= 8.4e-19) {
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.3d-161)) then
tmp = y + x
else if (t <= 8.4d-19) 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.3e-161) {
tmp = y + x;
} else if (t <= 8.4e-19) {
tmp = x;
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.3e-161: tmp = y + x elif t <= 8.4e-19: tmp = x else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.3e-161) tmp = Float64(y + x); elseif (t <= 8.4e-19) 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.3e-161) tmp = y + x; elseif (t <= 8.4e-19) tmp = x; else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.3e-161], N[(y + x), $MachinePrecision], If[LessEqual[t, 8.4e-19], x, N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{-161}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 8.4 \cdot 10^{-19}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.29999999999999998e-161 or 8.3999999999999996e-19 < t Initial program 69.9%
Taylor expanded in t around inf 76.1%
if -1.29999999999999998e-161 < t < 8.3999999999999996e-19Initial program 95.6%
Taylor expanded in x around inf 56.6%
Final simplification69.5%
(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 78.7%
Taylor expanded in x around inf 49.5%
Final simplification49.5%
(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 2023268
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisTicks from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(+ x (/ y (/ (- a t) (- z t))))
(+ x (/ (* y (- z t)) (- a t))))