
(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 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(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 2e+119) (fma y t_1 x) (+ x (/ z (/ (- a t) 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 <= 2e+119) {
tmp = fma(y, t_1, x);
} else {
tmp = x + (z / ((a - t) / 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 <= 2e+119) tmp = fma(y, t_1, x); else tmp = Float64(x + Float64(z / Float64(Float64(a - t) / y))); 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, 2e+119], N[(y * t$95$1 + x), $MachinePrecision], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+119}:\\
\;\;\;\;\mathsf{fma}\left(y, t\_1, x\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1.99999999999999989e119Initial program 97.8%
+-commutative97.8%
fma-define97.8%
Simplified97.8%
if 1.99999999999999989e119 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 77.3%
associate-*r/99.7%
Simplified99.7%
*-commutative99.7%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.9%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.1e-40)
(+ y x)
(if (<= t 3.8e-97)
(+ x (/ (* z y) a))
(if (<= t 2.5e+68) (- x (/ (* z y) t)) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e-40) {
tmp = y + x;
} else if (t <= 3.8e-97) {
tmp = x + ((z * y) / a);
} else if (t <= 2.5e+68) {
tmp = x - ((z * y) / t);
} else {
tmp = y + x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-1.1d-40)) then
tmp = y + x
else if (t <= 3.8d-97) then
tmp = x + ((z * y) / a)
else if (t <= 2.5d+68) then
tmp = x - ((z * y) / t)
else
tmp = y + x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.1e-40) {
tmp = y + x;
} else if (t <= 3.8e-97) {
tmp = x + ((z * y) / a);
} else if (t <= 2.5e+68) {
tmp = x - ((z * y) / t);
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.1e-40: tmp = y + x elif t <= 3.8e-97: tmp = x + ((z * y) / a) elif t <= 2.5e+68: tmp = x - ((z * y) / t) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.1e-40) tmp = Float64(y + x); elseif (t <= 3.8e-97) tmp = Float64(x + Float64(Float64(z * y) / a)); elseif (t <= 2.5e+68) tmp = Float64(x - Float64(Float64(z * y) / t)); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.1e-40) tmp = y + x; elseif (t <= 3.8e-97) tmp = x + ((z * y) / a); elseif (t <= 2.5e+68) tmp = x - ((z * y) / t); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.1e-40], N[(y + x), $MachinePrecision], If[LessEqual[t, 3.8e-97], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.5e+68], N[(x - N[(N[(z * y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.1 \cdot 10^{-40}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 3.8 \cdot 10^{-97}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{elif}\;t \leq 2.5 \cdot 10^{+68}:\\
\;\;\;\;x - \frac{z \cdot y}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.10000000000000004e-40 or 2.5000000000000002e68 < t Initial program 99.9%
Taylor expanded in t around inf 80.6%
+-commutative80.6%
Simplified80.6%
if -1.10000000000000004e-40 < t < 3.8000000000000001e-97Initial program 92.2%
Taylor expanded in t around 0 79.2%
if 3.8000000000000001e-97 < t < 2.5000000000000002e68Initial program 90.5%
Taylor expanded in t around inf 64.5%
associate-+r+64.5%
associate--l+64.5%
distribute-lft-out--64.5%
div-sub64.5%
associate-+r+64.5%
+-commutative64.5%
mul-1-neg64.5%
unsub-neg64.5%
*-commutative64.5%
distribute-lft-out--64.5%
Simplified64.5%
Taylor expanded in z around inf 70.9%
associate-*r/70.9%
neg-mul-170.9%
distribute-rgt-neg-in70.9%
Simplified70.9%
Final simplification78.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -8e-41)
(+ y x)
(if (<= t 2.6e-60)
(+ x (/ (* z y) a))
(if (<= t 4.4e+67) (- x (* y (/ z t))) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e-41) {
tmp = y + x;
} else if (t <= 2.6e-60) {
tmp = x + ((z * y) / a);
} else if (t <= 4.4e+67) {
tmp = x - (y * (z / 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 <= (-8d-41)) then
tmp = y + x
else if (t <= 2.6d-60) then
tmp = x + ((z * y) / a)
else if (t <= 4.4d+67) then
tmp = x - (y * (z / 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 <= -8e-41) {
tmp = y + x;
} else if (t <= 2.6e-60) {
tmp = x + ((z * y) / a);
} else if (t <= 4.4e+67) {
tmp = x - (y * (z / t));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8e-41: tmp = y + x elif t <= 2.6e-60: tmp = x + ((z * y) / a) elif t <= 4.4e+67: tmp = x - (y * (z / t)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e-41) tmp = Float64(y + x); elseif (t <= 2.6e-60) tmp = Float64(x + Float64(Float64(z * y) / a)); elseif (t <= 4.4e+67) tmp = Float64(x - Float64(y * Float64(z / t))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8e-41) tmp = y + x; elseif (t <= 2.6e-60) tmp = x + ((z * y) / a); elseif (t <= 4.4e+67) tmp = x - (y * (z / t)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e-41], N[(y + x), $MachinePrecision], If[LessEqual[t, 2.6e-60], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.4e+67], N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{-41}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 2.6 \cdot 10^{-60}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\mathbf{elif}\;t \leq 4.4 \cdot 10^{+67}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -8.00000000000000005e-41 or 4.4e67 < t Initial program 99.9%
Taylor expanded in t around inf 80.6%
+-commutative80.6%
Simplified80.6%
if -8.00000000000000005e-41 < t < 2.5999999999999998e-60Initial program 90.3%
Taylor expanded in t around 0 77.1%
if 2.5999999999999998e-60 < t < 4.4e67Initial program 99.7%
Taylor expanded in t around inf 68.9%
associate-+r+68.9%
associate--l+68.9%
distribute-lft-out--68.9%
div-sub68.9%
associate-+r+68.9%
+-commutative68.9%
mul-1-neg68.9%
unsub-neg68.9%
*-commutative68.9%
distribute-lft-out--68.9%
Simplified68.9%
Taylor expanded in z around inf 77.5%
mul-1-neg77.5%
associate-/l*77.3%
distribute-rgt-neg-in77.3%
Simplified77.3%
Taylor expanded in y around 0 77.5%
mul-1-neg77.5%
associate-*r/77.3%
sub-neg77.3%
Simplified77.3%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- a t)))) (if (<= t_1 2e+119) (+ x (* t_1 y)) (+ x (/ z (/ (- a t) 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 <= 2e+119) {
tmp = x + (t_1 * y);
} else {
tmp = x + (z / ((a - t) / 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 <= 2d+119) then
tmp = x + (t_1 * y)
else
tmp = x + (z / ((a - t) / 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 <= 2e+119) {
tmp = x + (t_1 * y);
} else {
tmp = x + (z / ((a - t) / y));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (a - t) tmp = 0 if t_1 <= 2e+119: tmp = x + (t_1 * y) else: tmp = x + (z / ((a - t) / 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 <= 2e+119) tmp = Float64(x + Float64(t_1 * y)); else tmp = Float64(x + Float64(z / Float64(Float64(a - t) / 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 <= 2e+119) tmp = x + (t_1 * y); else tmp = x + (z / ((a - t) / 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, 2e+119], N[(x + N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision], N[(x + N[(z / N[(N[(a - t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{a - t}\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{+119}:\\
\;\;\;\;x + t\_1 \cdot y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z}{\frac{a - t}{y}}\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 a t)) < 1.99999999999999989e119Initial program 97.8%
if 1.99999999999999989e119 < (/.f64 (-.f64 z t) (-.f64 a t)) Initial program 77.3%
associate-*r/99.7%
Simplified99.7%
*-commutative99.7%
associate-/l*99.7%
Applied egg-rr99.7%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in z around inf 99.9%
Final simplification98.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.22e-60) (not (<= t 1.8e+67))) (+ x (* y (/ (- t z) t))) (+ x (/ (* z y) (- a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.22e-60) || !(t <= 1.8e+67)) {
tmp = x + (y * ((t - z) / 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 <= (-1.22d-60)) .or. (.not. (t <= 1.8d+67))) then
tmp = x + (y * ((t - z) / 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 <= -1.22e-60) || !(t <= 1.8e+67)) {
tmp = x + (y * ((t - z) / t));
} else {
tmp = x + ((z * y) / (a - t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.22e-60) or not (t <= 1.8e+67): tmp = x + (y * ((t - z) / t)) else: tmp = x + ((z * y) / (a - t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.22e-60) || !(t <= 1.8e+67)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); else tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.22e-60) || ~((t <= 1.8e+67))) tmp = x + (y * ((t - z) / t)); else tmp = x + ((z * y) / (a - t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.22e-60], N[Not[LessEqual[t, 1.8e+67]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{-60} \lor \neg \left(t \leq 1.8 \cdot 10^{+67}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\end{array}
\end{array}
if t < -1.22e-60 or 1.7999999999999999e67 < t Initial program 99.9%
Taylor expanded in a around 0 72.3%
mul-1-neg72.3%
associate-/l*91.9%
distribute-rgt-neg-in91.9%
distribute-frac-neg91.9%
neg-sub091.9%
sub-neg91.9%
+-commutative91.9%
associate--r+91.9%
neg-sub091.9%
remove-double-neg91.9%
Simplified91.9%
if -1.22e-60 < t < 1.7999999999999999e67Initial program 91.6%
Taylor expanded in z around inf 90.6%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -5.8e-58) (not (<= t 4.8e+47))) (+ x (* y (/ (- t z) t))) (+ x (* z (/ y (- a t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -5.8e-58) || !(t <= 4.8e+47)) {
tmp = x + (y * ((t - z) / 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 <= (-5.8d-58)) .or. (.not. (t <= 4.8d+47))) then
tmp = x + (y * ((t - z) / 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 <= -5.8e-58) || !(t <= 4.8e+47)) {
tmp = x + (y * ((t - z) / t));
} else {
tmp = x + (z * (y / (a - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -5.8e-58) or not (t <= 4.8e+47): tmp = x + (y * ((t - z) / t)) else: tmp = x + (z * (y / (a - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -5.8e-58) || !(t <= 4.8e+47)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / 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 <= -5.8e-58) || ~((t <= 4.8e+47))) tmp = x + (y * ((t - z) / t)); else tmp = x + (z * (y / (a - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -5.8e-58], N[Not[LessEqual[t, 4.8e+47]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $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 -5.8 \cdot 10^{-58} \lor \neg \left(t \leq 4.8 \cdot 10^{+47}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -5.7999999999999998e-58 or 4.80000000000000037e47 < t Initial program 99.9%
Taylor expanded in a around 0 73.0%
mul-1-neg73.0%
associate-/l*92.1%
distribute-rgt-neg-in92.1%
distribute-frac-neg92.1%
neg-sub092.1%
sub-neg92.1%
+-commutative92.1%
associate--r+92.1%
neg-sub092.1%
remove-double-neg92.1%
Simplified92.1%
if -5.7999999999999998e-58 < t < 4.80000000000000037e47Initial program 91.4%
associate-*r/97.0%
Simplified97.0%
*-commutative97.0%
associate-/l*94.5%
Applied egg-rr94.5%
Taylor expanded in z around inf 89.1%
Final simplification90.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3e-62) (not (<= t 1.22e-39))) (+ x (* y (/ (- t z) t))) (+ x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3e-62) || !(t <= 1.22e-39)) {
tmp = x + (y * ((t - z) / t));
} 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 <= (-3d-62)) .or. (.not. (t <= 1.22d-39))) then
tmp = x + (y * ((t - z) / t))
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 <= -3e-62) || !(t <= 1.22e-39)) {
tmp = x + (y * ((t - z) / t));
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3e-62) or not (t <= 1.22e-39): tmp = x + (y * ((t - z) / t)) else: tmp = x + ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3e-62) || !(t <= 1.22e-39)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); else tmp = Float64(x + Float64(Float64(z * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3e-62) || ~((t <= 1.22e-39))) tmp = x + (y * ((t - z) / t)); else tmp = x + ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3e-62], N[Not[LessEqual[t, 1.22e-39]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3 \cdot 10^{-62} \lor \neg \left(t \leq 1.22 \cdot 10^{-39}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if t < -3.0000000000000001e-62 or 1.2200000000000001e-39 < t Initial program 99.9%
Taylor expanded in a around 0 72.7%
mul-1-neg72.7%
associate-/l*89.4%
distribute-rgt-neg-in89.4%
distribute-frac-neg89.4%
neg-sub089.4%
sub-neg89.4%
+-commutative89.4%
associate--r+89.4%
neg-sub089.4%
remove-double-neg89.4%
Simplified89.4%
if -3.0000000000000001e-62 < t < 1.2200000000000001e-39Initial program 90.1%
Taylor expanded in t around 0 77.4%
Final simplification84.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.22e-60) (+ x (* y (/ (- t z) t))) (if (<= t 2e+67) (+ x (/ (* z y) (- a t))) (+ x (- y (* y (/ z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.22e-60) {
tmp = x + (y * ((t - z) / t));
} else if (t <= 2e+67) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = x + (y - (y * (z / 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.22d-60)) then
tmp = x + (y * ((t - z) / t))
else if (t <= 2d+67) then
tmp = x + ((z * y) / (a - t))
else
tmp = x + (y - (y * (z / 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.22e-60) {
tmp = x + (y * ((t - z) / t));
} else if (t <= 2e+67) {
tmp = x + ((z * y) / (a - t));
} else {
tmp = x + (y - (y * (z / t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.22e-60: tmp = x + (y * ((t - z) / t)) elif t <= 2e+67: tmp = x + ((z * y) / (a - t)) else: tmp = x + (y - (y * (z / t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.22e-60) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); elseif (t <= 2e+67) tmp = Float64(x + Float64(Float64(z * y) / Float64(a - t))); else tmp = Float64(x + Float64(y - Float64(y * Float64(z / t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.22e-60) tmp = x + (y * ((t - z) / t)); elseif (t <= 2e+67) tmp = x + ((z * y) / (a - t)); else tmp = x + (y - (y * (z / t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.22e-60], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2e+67], N[(x + N[(N[(z * y), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.22 \cdot 10^{-60}:\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+67}:\\
\;\;\;\;x + \frac{z \cdot y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + \left(y - y \cdot \frac{z}{t}\right)\\
\end{array}
\end{array}
if t < -1.22e-60Initial program 99.9%
Taylor expanded in a around 0 71.1%
mul-1-neg71.1%
associate-/l*90.6%
distribute-rgt-neg-in90.6%
distribute-frac-neg90.6%
neg-sub090.6%
sub-neg90.6%
+-commutative90.6%
associate--r+90.6%
neg-sub090.6%
remove-double-neg90.6%
Simplified90.6%
if -1.22e-60 < t < 1.99999999999999997e67Initial program 91.6%
Taylor expanded in z around inf 90.6%
if 1.99999999999999997e67 < t Initial program 99.9%
Taylor expanded in t around inf 71.7%
associate-+r+71.7%
associate--l+71.7%
distribute-lft-out--71.7%
div-sub71.7%
associate-+r+71.7%
+-commutative71.7%
mul-1-neg71.7%
unsub-neg71.7%
*-commutative71.7%
distribute-lft-out--74.3%
Simplified74.3%
Taylor expanded in z around inf 87.3%
associate-/l*94.8%
Simplified94.8%
Final simplification91.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -1.05e-40) (not (<= t 1.35e+33))) (+ y x) (+ x (/ (* z y) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -1.05e-40) || !(t <= 1.35e+33)) {
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 <= (-1.05d-40)) .or. (.not. (t <= 1.35d+33))) 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 <= -1.05e-40) || !(t <= 1.35e+33)) {
tmp = y + x;
} else {
tmp = x + ((z * y) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -1.05e-40) or not (t <= 1.35e+33): tmp = y + x else: tmp = x + ((z * y) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -1.05e-40) || !(t <= 1.35e+33)) tmp = Float64(y + x); else tmp = Float64(x + Float64(Float64(z * y) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -1.05e-40) || ~((t <= 1.35e+33))) tmp = y + x; else tmp = x + ((z * y) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -1.05e-40], N[Not[LessEqual[t, 1.35e+33]], $MachinePrecision]], N[(y + x), $MachinePrecision], N[(x + N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.05 \cdot 10^{-40} \lor \neg \left(t \leq 1.35 \cdot 10^{+33}\right):\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z \cdot y}{a}\\
\end{array}
\end{array}
if t < -1.05000000000000009e-40 or 1.34999999999999996e33 < t Initial program 99.9%
Taylor expanded in t around inf 79.9%
+-commutative79.9%
Simplified79.9%
if -1.05000000000000009e-40 < t < 1.34999999999999996e33Initial program 91.6%
Taylor expanded in t around 0 73.8%
Final simplification76.7%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.6e+138) x (if (<= a 5.8e+155) (+ y x) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.6e+138) {
tmp = x;
} else if (a <= 5.8e+155) {
tmp = y + x;
} 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 <= (-2.6d+138)) then
tmp = x
else if (a <= 5.8d+155) then
tmp = y + x
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 <= -2.6e+138) {
tmp = x;
} else if (a <= 5.8e+155) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.6e+138: tmp = x elif a <= 5.8e+155: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.6e+138) tmp = x; elseif (a <= 5.8e+155) tmp = Float64(y + x); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -2.6e+138) tmp = x; elseif (a <= 5.8e+155) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.6e+138], x, If[LessEqual[a, 5.8e+155], N[(y + x), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+138}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{+155}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.6000000000000001e138 or 5.7999999999999998e155 < a Initial program 97.2%
Taylor expanded in x around inf 73.3%
if -2.6000000000000001e138 < a < 5.7999999999999998e155Initial program 94.9%
Taylor expanded in t around inf 56.6%
+-commutative56.6%
Simplified56.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 95.5%
Taylor expanded in x around inf 44.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 2024110
(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)))))