
(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 12 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 99.2%
+-commutative99.2%
fma-define99.2%
Simplified99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (+ x (- y (* y (/ z t))))))
(if (<= t -5.6e-58)
t_1
(if (<= t 7.2e+102)
(- x (* y (/ z (- t a))))
(if (<= t 2.8e+149) (+ x (* t (/ y (- t a)))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = x + (y - (y * (z / t)));
double tmp;
if (t <= -5.6e-58) {
tmp = t_1;
} else if (t <= 7.2e+102) {
tmp = x - (y * (z / (t - a)));
} else if (t <= 2.8e+149) {
tmp = x + (t * (y / (t - a)));
} 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 - (y * (z / t)))
if (t <= (-5.6d-58)) then
tmp = t_1
else if (t <= 7.2d+102) then
tmp = x - (y * (z / (t - a)))
else if (t <= 2.8d+149) then
tmp = x + (t * (y / (t - a)))
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 - (y * (z / t)));
double tmp;
if (t <= -5.6e-58) {
tmp = t_1;
} else if (t <= 7.2e+102) {
tmp = x - (y * (z / (t - a)));
} else if (t <= 2.8e+149) {
tmp = x + (t * (y / (t - a)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = x + (y - (y * (z / t))) tmp = 0 if t <= -5.6e-58: tmp = t_1 elif t <= 7.2e+102: tmp = x - (y * (z / (t - a))) elif t <= 2.8e+149: tmp = x + (t * (y / (t - a))) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(x + Float64(y - Float64(y * Float64(z / t)))) tmp = 0.0 if (t <= -5.6e-58) tmp = t_1; elseif (t <= 7.2e+102) tmp = Float64(x - Float64(y * Float64(z / Float64(t - a)))); elseif (t <= 2.8e+149) tmp = Float64(x + Float64(t * Float64(y / Float64(t - a)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = x + (y - (y * (z / t))); tmp = 0.0; if (t <= -5.6e-58) tmp = t_1; elseif (t <= 7.2e+102) tmp = x - (y * (z / (t - a))); elseif (t <= 2.8e+149) tmp = x + (t * (y / (t - a))); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(x + N[(y - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.6e-58], t$95$1, If[LessEqual[t, 7.2e+102], N[(x - N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.8e+149], N[(x + N[(t * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y - y \cdot \frac{z}{t}\right)\\
\mathbf{if}\;t \leq -5.6 \cdot 10^{-58}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.2 \cdot 10^{+102}:\\
\;\;\;\;x - y \cdot \frac{z}{t - a}\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+149}:\\
\;\;\;\;x + t \cdot \frac{y}{t - a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.6000000000000001e-58 or 2.7999999999999999e149 < t Initial program 99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 66.3%
mul-1-neg66.3%
associate-/l*90.6%
div-sub90.6%
*-inverses90.6%
sub-neg90.6%
metadata-eval90.6%
distribute-rgt-in90.6%
neg-mul-190.6%
*-commutative90.6%
+-commutative90.6%
distribute-neg-out90.6%
remove-double-neg90.6%
unsub-neg90.6%
Simplified90.6%
if -5.6000000000000001e-58 < t < 7.2000000000000003e102Initial program 98.5%
Taylor expanded in z around inf 83.0%
associate-/l*90.6%
Simplified90.6%
if 7.2000000000000003e102 < t < 2.7999999999999999e149Initial program 100.0%
clear-num99.9%
un-div-inv100.0%
Applied egg-rr100.0%
Taylor expanded in z around 0 83.2%
mul-1-neg83.2%
unsub-neg83.2%
associate-/l*99.9%
Simplified99.9%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.5e-47) (not (<= t 5.2e+120))) (+ y x) (- x (* y (/ z (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5e-47) || !(t <= 5.2e+120)) {
tmp = y + x;
} else {
tmp = x - (y * (z / (t - a)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-3.5d-47)) .or. (.not. (t <= 5.2d+120))) then
tmp = y + x
else
tmp = x - (y * (z / (t - a)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.5e-47) || !(t <= 5.2e+120)) {
tmp = y + x;
} else {
tmp = x - (y * (z / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.5e-47) or not (t <= 5.2e+120): tmp = y + x else: tmp = x - (y * (z / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.5e-47) || !(t <= 5.2e+120)) tmp = Float64(y + x); else tmp = Float64(x - Float64(y * Float64(z / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.5e-47) || ~((t <= 5.2e+120))) tmp = y + x; else tmp = x - (y * (z / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.5e-47], N[Not[LessEqual[t, 5.2e+120]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x - N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.5 \cdot 10^{-47} \lor \neg \left(t \leq 5.2 \cdot 10^{+120}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t - a}\\
\end{array}
\end{array}
if t < -3.4999999999999998e-47 or 5.1999999999999998e120 < t Initial program 99.9%
Taylor expanded in t around inf 81.0%
+-commutative81.0%
Simplified81.0%
if -3.4999999999999998e-47 < t < 5.1999999999999998e120Initial program 98.6%
Taylor expanded in z around inf 81.6%
associate-/l*88.8%
Simplified88.8%
Final simplification85.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.6e-58) (not (<= t 1.15e+118))) (+ x (- y (* y (/ z t)))) (- x (* y (/ z (- t a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.6e-58) || !(t <= 1.15e+118)) {
tmp = x + (y - (y * (z / t)));
} else {
tmp = x - (y * (z / (t - a)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((t <= (-5.6d-58)) .or. (.not. (t <= 1.15d+118))) then
tmp = x + (y - (y * (z / t)))
else
tmp = x - (y * (z / (t - a)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.6e-58) || !(t <= 1.15e+118)) {
tmp = x + (y - (y * (z / t)));
} else {
tmp = x - (y * (z / (t - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.6e-58) or not (t <= 1.15e+118): tmp = x + (y - (y * (z / t))) else: tmp = x - (y * (z / (t - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.6e-58) || !(t <= 1.15e+118)) tmp = Float64(x + Float64(y - Float64(y * Float64(z / t)))); else tmp = Float64(x - Float64(y * Float64(z / Float64(t - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -5.6e-58) || ~((t <= 1.15e+118))) tmp = x + (y - (y * (z / t))); else tmp = x - (y * (z / (t - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.6e-58], N[Not[LessEqual[t, 1.15e+118]], $MachinePrecision]], N[(x + N[(y - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.6 \cdot 10^{-58} \lor \neg \left(t \leq 1.15 \cdot 10^{+118}\right):\\
\;\;\;\;x + \left(y - y \cdot \frac{z}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x - y \cdot \frac{z}{t - a}\\
\end{array}
\end{array}
if t < -5.6000000000000001e-58 or 1.15000000000000008e118 < t Initial program 99.9%
clear-num99.9%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 66.7%
mul-1-neg66.7%
associate-/l*89.2%
div-sub89.1%
*-inverses89.1%
sub-neg89.1%
metadata-eval89.1%
distribute-rgt-in89.2%
neg-mul-189.2%
*-commutative89.2%
+-commutative89.2%
distribute-neg-out89.2%
remove-double-neg89.2%
unsub-neg89.2%
Simplified89.2%
if -5.6000000000000001e-58 < t < 1.15000000000000008e118Initial program 98.6%
Taylor expanded in z around inf 82.4%
associate-/l*89.8%
Simplified89.8%
Final simplification89.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.6e-37) (- x (* y (/ z (- t a)))) (if (<= z 4.2e+16) (+ x (* y (/ t (- t a)))) (+ x (/ y (/ (- a t) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.6e-37) {
tmp = x - (y * (z / (t - a)));
} else if (z <= 4.2e+16) {
tmp = x + (y * (t / (t - a)));
} 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 (z <= (-1.6d-37)) then
tmp = x - (y * (z / (t - a)))
else if (z <= 4.2d+16) then
tmp = x + (y * (t / (t - a)))
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 (z <= -1.6e-37) {
tmp = x - (y * (z / (t - a)));
} else if (z <= 4.2e+16) {
tmp = x + (y * (t / (t - a)));
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.6e-37: tmp = x - (y * (z / (t - a))) elif z <= 4.2e+16: tmp = x + (y * (t / (t - a))) else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.6e-37) tmp = Float64(x - Float64(y * Float64(z / Float64(t - a)))); elseif (z <= 4.2e+16) tmp = Float64(x + Float64(y * Float64(t / Float64(t - a)))); 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 (z <= -1.6e-37) tmp = x - (y * (z / (t - a))); elseif (z <= 4.2e+16) tmp = x + (y * (t / (t - a))); else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.6e-37], N[(x - N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+16], N[(x + N[(y * N[(t / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.6 \cdot 10^{-37}:\\
\;\;\;\;x - y \cdot \frac{z}{t - a}\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+16}:\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if z < -1.5999999999999999e-37Initial program 97.6%
Taylor expanded in z around inf 76.4%
associate-/l*88.9%
Simplified88.9%
if -1.5999999999999999e-37 < z < 4.2e16Initial program 99.9%
Taylor expanded in z around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
*-commutative80.7%
associate-/l*94.7%
Simplified94.7%
if 4.2e16 < z Initial program 99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 84.9%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.52e-37) (- x (* y (/ z (- t a)))) (if (<= z 32500.0) (+ x (/ y (/ (- t a) t))) (+ x (/ y (/ (- a t) z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.52e-37) {
tmp = x - (y * (z / (t - a)));
} else if (z <= 32500.0) {
tmp = x + (y / ((t - a) / t));
} 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 (z <= (-1.52d-37)) then
tmp = x - (y * (z / (t - a)))
else if (z <= 32500.0d0) then
tmp = x + (y / ((t - a) / t))
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 (z <= -1.52e-37) {
tmp = x - (y * (z / (t - a)));
} else if (z <= 32500.0) {
tmp = x + (y / ((t - a) / t));
} else {
tmp = x + (y / ((a - t) / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.52e-37: tmp = x - (y * (z / (t - a))) elif z <= 32500.0: tmp = x + (y / ((t - a) / t)) else: tmp = x + (y / ((a - t) / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.52e-37) tmp = Float64(x - Float64(y * Float64(z / Float64(t - a)))); elseif (z <= 32500.0) tmp = Float64(x + Float64(y / Float64(Float64(t - a) / t))); 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 (z <= -1.52e-37) tmp = x - (y * (z / (t - a))); elseif (z <= 32500.0) tmp = x + (y / ((t - a) / t)); else tmp = x + (y / ((a - t) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.52e-37], N[(x - N[(y * N[(z / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 32500.0], N[(x + N[(y / N[(N[(t - a), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.52 \cdot 10^{-37}:\\
\;\;\;\;x - y \cdot \frac{z}{t - a}\\
\mathbf{elif}\;z \leq 32500:\\
\;\;\;\;x + \frac{y}{\frac{t - a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if z < -1.52e-37Initial program 97.6%
Taylor expanded in z around inf 76.4%
associate-/l*88.9%
Simplified88.9%
if -1.52e-37 < z < 32500Initial program 99.9%
Taylor expanded in z around 0 80.7%
mul-1-neg80.7%
unsub-neg80.7%
*-commutative80.7%
associate-/l*94.7%
Simplified94.7%
clear-num94.7%
un-div-inv94.7%
Applied egg-rr94.7%
if 32500 < z Initial program 99.8%
clear-num99.7%
un-div-inv99.8%
Applied egg-rr99.8%
Taylor expanded in z around inf 84.9%
Final simplification91.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.5e-58) (not (<= t 1820.0))) (+ y x) (+ x (* z (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e-58) || !(t <= 1820.0)) {
tmp = y + x;
} else {
tmp = x + (z * (y / 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 <= (-4.5d-58)) .or. (.not. (t <= 1820.0d0))) then
tmp = y + x
else
tmp = x + (z * (y / 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 <= -4.5e-58) || !(t <= 1820.0)) {
tmp = y + x;
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.5e-58) or not (t <= 1820.0): tmp = y + x else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.5e-58) || !(t <= 1820.0)) tmp = Float64(y + x); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.5e-58) || ~((t <= 1820.0))) tmp = y + x; else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.5e-58], N[Not[LessEqual[t, 1820.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-58} \lor \neg \left(t \leq 1820\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -4.5000000000000003e-58 or 1820 < t Initial program 99.9%
Taylor expanded in t around inf 75.7%
+-commutative75.7%
Simplified75.7%
if -4.5000000000000003e-58 < t < 1820Initial program 98.3%
clear-num98.2%
un-div-inv98.2%
Applied egg-rr98.2%
Taylor expanded in t around 0 83.1%
associate-/r/80.7%
Applied egg-rr80.7%
Final simplification78.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.5e-58) (not (<= t 30500.0))) (+ y x) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.5e-58) || !(t <= 30500.0)) {
tmp = y + x;
} else {
tmp = x + (y / (a / 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 <= (-5.5d-58)) .or. (.not. (t <= 30500.0d0))) then
tmp = y + x
else
tmp = x + (y / (a / 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 <= -5.5e-58) || !(t <= 30500.0)) {
tmp = y + x;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.5e-58) or not (t <= 30500.0): tmp = y + x else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.5e-58) || !(t <= 30500.0)) tmp = Float64(y + x); else tmp = Float64(x + Float64(y / Float64(a / z))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -5.5e-58) || ~((t <= 30500.0))) tmp = y + x; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.5e-58], N[Not[LessEqual[t, 30500.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-58} \lor \neg \left(t \leq 30500\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -5.49999999999999996e-58 or 30500 < t Initial program 99.9%
Taylor expanded in t around inf 75.7%
+-commutative75.7%
Simplified75.7%
if -5.49999999999999996e-58 < t < 30500Initial program 98.3%
clear-num98.2%
un-div-inv98.2%
Applied egg-rr98.2%
Taylor expanded in t around 0 83.1%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.15e-58) (not (<= t 3150.0))) (+ y x) (+ x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.15e-58) || !(t <= 3150.0)) {
tmp = y + x;
} 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 <= (-2.15d-58)) .or. (.not. (t <= 3150.0d0))) then
tmp = y + x
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 <= -2.15e-58) || !(t <= 3150.0)) {
tmp = y + x;
} else {
tmp = x + (y * (z / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.15e-58) or not (t <= 3150.0): tmp = y + x else: tmp = x + (y * (z / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.15e-58) || !(t <= 3150.0)) tmp = Float64(y + x); 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 <= -2.15e-58) || ~((t <= 3150.0))) tmp = y + x; else tmp = x + (y * (z / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.15e-58], N[Not[LessEqual[t, 3150.0]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{-58} \lor \neg \left(t \leq 3150\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if t < -2.15e-58 or 3150 < t Initial program 99.9%
Taylor expanded in t around inf 75.7%
+-commutative75.7%
Simplified75.7%
if -2.15e-58 < t < 3150Initial program 98.3%
Taylor expanded in t around 0 76.9%
+-commutative76.9%
associate-/l*83.2%
Simplified83.2%
Final simplification79.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 99.2%
Final simplification99.2%
(FPCore (x y z t a) :precision binary64 (+ y x))
double code(double x, double y, double z, double t, double a) {
return y + 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 + x
end function
public static double code(double x, double y, double z, double t, double a) {
return y + x;
}
def code(x, y, z, t, a): return y + x
function code(x, y, z, t, a) return Float64(y + x) end
function tmp = code(x, y, z, t, a) tmp = y + x; end
code[x_, y_, z_, t_, a_] := N[(y + x), $MachinePrecision]
\begin{array}{l}
\\
y + x
\end{array}
Initial program 99.2%
Taylor expanded in t around inf 62.6%
+-commutative62.6%
Simplified62.6%
Final simplification62.6%
(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 99.2%
Taylor expanded in x around inf 48.6%
Final simplification48.6%
(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 2024076
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:alt
(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)))))