
(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 9 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 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 -4e+140) (+ x (/ (* z y) (- a t))) (fma y t_1 x))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -4e+140) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = fma(y, t_1, x);
}
return tmp;
}
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -4e+140) tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); else tmp = fma(y, t_1, x); end return tmp end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+140], N[(x + N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * t$95$1 + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+140}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, t_1, x\right)\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.00000000000000024e140Initial program 76.2%
Taylor expanded in z around inf 99.9%
if -4.00000000000000024e140 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 99.1%
+-commutative99.1%
fma-def99.1%
Simplified99.1%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 -4e+140) (+ x (/ (* z y) (- a t))) (+ x (* t_1 y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -4e+140) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = x + (t_1 * 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 = (z - t) / (a - t)
if (t_1 <= (-4d+140)) then
tmp = x + ((z * y) / (a - t))
else
tmp = x + (t_1 * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (a - t);
double tmp;
if (t_1 <= -4e+140) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = x + (t_1 * y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= -4e+140: tmp = x + ((z * y) / (a - t)) else: tmp = x + (t_1 * y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(a - t)) tmp = 0.0 if (t_1 <= -4e+140) tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); else tmp = Float64(x + Float64(t_1 * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (a - t); tmp = 0.0; if (t_1 <= -4e+140) tmp = x + ((z * y) / (a - t)); else tmp = x + (t_1 * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+140], N[(x + N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+140}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + t_1 \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < -4.00000000000000024e140Initial program 76.2%
Taylor expanded in z around inf 99.9%
if -4.00000000000000024e140 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 99.1%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.9e+30) (not (<= t 3.8e+120))) (+ x y) (+ x (* y (/ z (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.9e+30) || !(t <= 3.8e+120)) {
tmp = x + y;
} 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 ((t <= (-1.9d+30)) .or. (.not. (t <= 3.8d+120))) then
tmp = x + y
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 ((t <= -1.9e+30) || !(t <= 3.8e+120)) {
tmp = x + y;
} else {
tmp = x + (y * (z / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.9e+30) or not (t <= 3.8e+120): tmp = x + y else: tmp = x + (y * (z / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.9e+30) || !(t <= 3.8e+120)) tmp = Float64(x + y); 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 ((t <= -1.9e+30) || ~((t <= 3.8e+120))) tmp = x + y; else tmp = x + (y * (z / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.9e+30], N[Not[LessEqual[t, 3.8e+120]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.9 \cdot 10^{+30} \lor \neg \left(t \leq 3.8 \cdot 10^{+120}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a - t}\\
\end{array}
\end{array}
if t < -1.9000000000000001e30 or 3.7999999999999998e120 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 87.3%
+-commutative87.3%
Simplified87.3%
if -1.9000000000000001e30 < t < 3.7999999999999998e120Initial program 95.8%
Taylor expanded in z around inf 87.1%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.05e+15) (not (<= t 1e+121))) (+ x y) (+ x (/ y (/ (- a t) z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.05e+15) || !(t <= 1e+121)) {
tmp = x + y;
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-1.05d+15)) .or. (.not. (t <= 1d+121))) then
tmp = x + y
else
tmp = x + (y / ((a - t) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.05e+15) || !(t <= 1e+121)) {
tmp = x + y;
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.05e+15) or not (t <= 1e+121): tmp = x + y else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.05e+15) || !(t <= 1e+121)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.05e+15) || ~((t <= 1e+121))) tmp = x + y; else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.05e+15], N[Not[LessEqual[t, 1e+121]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{+15} \lor \neg \left(t \leq 10^{+121}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -1.05e15 or 1.00000000000000004e121 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 87.0%
+-commutative87.0%
Simplified87.0%
if -1.05e15 < t < 1.00000000000000004e121Initial program 95.7%
Taylor expanded in z around inf 85.3%
associate-/l*87.3%
Simplified87.3%
Final simplification87.2%
(FPCore (x y z t a) :precision binary64 (if (<= t -7e+15) (+ x y) (if (<= t 1.02e+92) (+ x (/ y (/ (- a t) z))) (+ x (* (/ y t) (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+15) {
tmp = x + y;
} else if (t <= 1.02e+92) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-7d+15)) then
tmp = x + y
else if (t <= 1.02d+92) then
tmp = x + (y / ((a - t) / z))
else
tmp = x + ((y / t) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+15) {
tmp = x + y;
} else if (t <= 1.02e+92) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7e+15: tmp = x + y elif t <= 1.02e+92: tmp = x + (y / ((a - t) / z)) else: tmp = x + ((y / t) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+15) tmp = Float64(x + y); elseif (t <= 1.02e+92) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x + Float64(Float64(y / t) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7e+15) tmp = x + y; elseif (t <= 1.02e+92) tmp = x + (y / ((a - t) / z)); else tmp = x + ((y / t) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+15], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.02e+92], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+15}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+92}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if t < -7e15Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 84.8%
+-commutative84.8%
Simplified84.8%
if -7e15 < t < 1.02000000000000003e92Initial program 95.6%
Taylor expanded in z around inf 86.7%
associate-/l*87.9%
Simplified87.9%
if 1.02000000000000003e92 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 66.6%
mul-1-neg66.6%
unsub-neg66.6%
associate-/l*91.9%
associate-/r/90.2%
Simplified90.2%
Final simplification87.4%
(FPCore (x y z t a) :precision binary64 (if (<= t -2200000000.0) (- x (/ t (/ (- a t) y))) (if (<= t 3e+91) (+ x (/ y (/ (- a t) z))) (+ x (* (/ y t) (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2200000000.0) {
tmp = x - (t / ((a - t) / y));
} else if (t <= 3e+91) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2200000000.0d0)) then
tmp = x - (t / ((a - t) / y))
else if (t <= 3d+91) then
tmp = x + (y / ((a - t) / z))
else
tmp = x + ((y / t) * (t - z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2200000000.0) {
tmp = x - (t / ((a - t) / y));
} else if (t <= 3e+91) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + ((y / t) * (t - z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2200000000.0: tmp = x - (t / ((a - t) / y)) elif t <= 3e+91: tmp = x + (y / ((a - t) / z)) else: tmp = x + ((y / t) * (t - z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2200000000.0) tmp = Float64(x - Float64(t / Float64(Float64(a - t) / y))); elseif (t <= 3e+91) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x + Float64(Float64(y / t) * Float64(t - z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2200000000.0) tmp = x - (t / ((a - t) / y)); elseif (t <= 3e+91) tmp = x + (y / ((a - t) / z)); else tmp = x + ((y / t) * (t - z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2200000000.0], N[(x - N[(t / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3e+91], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y / t), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2200000000:\\
\;\;\;\;x - \frac{t}{\frac{a - t}{y}}\\
\mathbf{elif}\;t \leq 3 \cdot 10^{+91}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(t - z\right)\\
\end{array}
\end{array}
if t < -2.2e9Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 65.9%
mul-1-neg65.9%
unsub-neg65.9%
associate-/l*89.0%
Simplified89.0%
if -2.2e9 < t < 3.00000000000000006e91Initial program 95.5%
Taylor expanded in z around inf 87.2%
associate-/l*88.4%
Simplified88.4%
if 3.00000000000000006e91 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in a around 0 66.6%
mul-1-neg66.6%
unsub-neg66.6%
associate-/l*91.9%
associate-/r/90.2%
Simplified90.2%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -50000000.0) (not (<= t 2.4e+70))) (+ x y) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -50000000.0) || !(t <= 2.4e+70)) {
tmp = x + y;
} else {
tmp = x + (y * (z / 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 <= (-50000000.0d0)) .or. (.not. (t <= 2.4d+70))) then
tmp = x + y
else
tmp = x + (y * (z / 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 <= -50000000.0) || !(t <= 2.4e+70)) {
tmp = x + y;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -50000000.0) or not (t <= 2.4e+70): tmp = x + y else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -50000000.0) || !(t <= 2.4e+70)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(z / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -50000000.0) || ~((t <= 2.4e+70))) tmp = x + y; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -50000000.0], N[Not[LessEqual[t, 2.4e+70]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -50000000 \lor \neg \left(t \leq 2.4 \cdot 10^{+70}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -5e7 or 2.39999999999999987e70 < t Initial program 99.9%
+-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in t around inf 85.4%
+-commutative85.4%
Simplified85.4%
if -5e7 < t < 2.39999999999999987e70Initial program 95.5%
Taylor expanded in t around 0 75.5%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (<= a -3.8e+170) x (if (<= a 2.6e+148) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -3.8e+170) {
tmp = x;
} else if (a <= 2.6e+148) {
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 <= (-3.8d+170)) then
tmp = x
else if (a <= 2.6d+148) 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 <= -3.8e+170) {
tmp = x;
} else if (a <= 2.6e+148) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -3.8e+170: tmp = x elif a <= 2.6e+148: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -3.8e+170) tmp = x; elseif (a <= 2.6e+148) 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 <= -3.8e+170) tmp = x; elseif (a <= 2.6e+148) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -3.8e+170], x, If[LessEqual[a, 2.6e+148], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+170}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 2.6 \cdot 10^{+148}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -3.7999999999999998e170 or 2.6e148 < a Initial program 99.8%
+-commutative99.8%
fma-def99.8%
Simplified99.8%
Taylor expanded in y around 0 63.4%
if -3.7999999999999998e170 < a < 2.6e148Initial program 96.5%
+-commutative96.5%
fma-def96.5%
Simplified96.5%
Taylor expanded in t around inf 67.1%
+-commutative67.1%
Simplified67.1%
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 97.3%
+-commutative97.3%
fma-def97.3%
Simplified97.3%
Taylor expanded in y around 0 50.2%
Final simplification50.2%
(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 2023271
(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)))))