
(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 (+ x (/ y (/ (- a t) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y / ((a - t) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((a - t) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((a - t) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(a - t) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((a - t) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{a - t}{z - t}}
\end{array}
Initial program 98.6%
clear-num98.3%
un-div-inv99.1%
Applied egg-rr99.1%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.3e+156)
(+ x (/ 1.0 (/ 1.0 y)))
(if (<= t -4e-33)
(- x (* z (/ y t)))
(if (<= t 9e-45) (+ x (/ y (/ a z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e+156) {
tmp = x + (1.0 / (1.0 / y));
} else if (t <= -4e-33) {
tmp = x - (z * (y / t));
} else if (t <= 9e-45) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-3.3d+156)) then
tmp = x + (1.0d0 / (1.0d0 / y))
else if (t <= (-4d-33)) then
tmp = x - (z * (y / t))
else if (t <= 9d-45) then
tmp = x + (y / (a / z))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.3e+156) {
tmp = x + (1.0 / (1.0 / y));
} else if (t <= -4e-33) {
tmp = x - (z * (y / t));
} else if (t <= 9e-45) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.3e+156: tmp = x + (1.0 / (1.0 / y)) elif t <= -4e-33: tmp = x - (z * (y / t)) elif t <= 9e-45: tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.3e+156) tmp = Float64(x + Float64(1.0 / Float64(1.0 / y))); elseif (t <= -4e-33) tmp = Float64(x - Float64(z * Float64(y / t))); elseif (t <= 9e-45) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.3e+156) tmp = x + (1.0 / (1.0 / y)); elseif (t <= -4e-33) tmp = x - (z * (y / t)); elseif (t <= 9e-45) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.3e+156], N[(x + N[(1.0 / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -4e-33], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 9e-45], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.3 \cdot 10^{+156}:\\
\;\;\;\;x + \frac{1}{\frac{1}{y}}\\
\mathbf{elif}\;t \leq -4 \cdot 10^{-33}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 9 \cdot 10^{-45}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -3.2999999999999999e156Initial program 99.9%
associate-*r/71.1%
clear-num71.0%
*-commutative71.0%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 77.4%
if -3.2999999999999999e156 < t < -4.0000000000000002e-33Initial program 99.7%
+-commutative99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in a around 0 72.1%
mul-1-neg72.1%
unsub-neg72.1%
associate-/l*82.2%
div-sub82.1%
sub-neg82.1%
*-inverses82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in z around inf 64.3%
associate-*r/72.3%
Simplified72.3%
Taylor expanded in y around 0 64.3%
*-commutative64.3%
associate-/l*72.4%
Simplified72.4%
if -4.0000000000000002e-33 < t < 8.9999999999999997e-45Initial program 96.2%
clear-num95.5%
un-div-inv97.7%
Applied egg-rr97.7%
Taylor expanded in t around 0 79.2%
if 8.9999999999999997e-45 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 78.1%
+-commutative78.1%
Simplified78.1%
Final simplification77.4%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.7e+156)
(+ x (/ 1.0 (/ 1.0 y)))
(if (<= t -1.28e-33)
(- x (* y (/ z t)))
(if (<= t 1.7e-46) (+ x (/ y (/ a z))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e+156) {
tmp = x + (1.0 / (1.0 / y));
} else if (t <= -1.28e-33) {
tmp = x - (y * (z / t));
} else if (t <= 1.7e-46) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (t <= (-2.7d+156)) then
tmp = x + (1.0d0 / (1.0d0 / y))
else if (t <= (-1.28d-33)) then
tmp = x - (y * (z / t))
else if (t <= 1.7d-46) then
tmp = x + (y / (a / z))
else
tmp = x + y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e+156) {
tmp = x + (1.0 / (1.0 / y));
} else if (t <= -1.28e-33) {
tmp = x - (y * (z / t));
} else if (t <= 1.7e-46) {
tmp = x + (y / (a / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.7e+156: tmp = x + (1.0 / (1.0 / y)) elif t <= -1.28e-33: tmp = x - (y * (z / t)) elif t <= 1.7e-46: tmp = x + (y / (a / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.7e+156) tmp = Float64(x + Float64(1.0 / Float64(1.0 / y))); elseif (t <= -1.28e-33) tmp = Float64(x - Float64(y * Float64(z / t))); elseif (t <= 1.7e-46) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.7e+156) tmp = x + (1.0 / (1.0 / y)); elseif (t <= -1.28e-33) tmp = x - (y * (z / t)); elseif (t <= 1.7e-46) tmp = x + (y / (a / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.7e+156], N[(x + N[(1.0 / N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.28e-33], N[(x - N[(y * N[(z / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.7e-46], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{+156}:\\
\;\;\;\;x + \frac{1}{\frac{1}{y}}\\
\mathbf{elif}\;t \leq -1.28 \cdot 10^{-33}:\\
\;\;\;\;x - y \cdot \frac{z}{t}\\
\mathbf{elif}\;t \leq 1.7 \cdot 10^{-46}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.7e156Initial program 99.9%
associate-*r/71.1%
clear-num71.0%
*-commutative71.0%
associate-/r*99.8%
Applied egg-rr99.8%
Taylor expanded in t around inf 77.4%
if -2.7e156 < t < -1.28000000000000001e-33Initial program 99.7%
+-commutative99.7%
fma-define99.7%
Simplified99.7%
Taylor expanded in a around 0 72.1%
mul-1-neg72.1%
unsub-neg72.1%
associate-/l*82.2%
div-sub82.1%
sub-neg82.1%
*-inverses82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in z around inf 64.3%
associate-*r/72.3%
Simplified72.3%
if -1.28000000000000001e-33 < t < 1.69999999999999998e-46Initial program 96.2%
clear-num95.5%
un-div-inv97.7%
Applied egg-rr97.7%
Taylor expanded in t around 0 79.2%
if 1.69999999999999998e-46 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 78.1%
+-commutative78.1%
Simplified78.1%
Final simplification77.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.1e+68) (not (<= t 6.5e-84))) (+ 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 ((t <= -4.1e+68) || !(t <= 6.5e-84)) {
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 ((t <= (-4.1d+68)) .or. (.not. (t <= 6.5d-84))) 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 ((t <= -4.1e+68) || !(t <= 6.5e-84)) {
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 (t <= -4.1e+68) or not (t <= 6.5e-84): 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 ((t <= -4.1e+68) || !(t <= 6.5e-84)) 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 ((t <= -4.1e+68) || ~((t <= 6.5e-84))) 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[Or[LessEqual[t, -4.1e+68], N[Not[LessEqual[t, 6.5e-84]], $MachinePrecision]], 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}\;t \leq -4.1 \cdot 10^{+68} \lor \neg \left(t \leq 6.5 \cdot 10^{-84}\right):\\
\;\;\;\;x + y \cdot \frac{t}{t - a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\end{array}
\end{array}
if t < -4.0999999999999999e68 or 6.50000000000000022e-84 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around 0 65.8%
+-commutative65.8%
associate-*r/65.8%
mul-1-neg65.8%
distribute-lft-neg-out65.8%
*-commutative65.8%
*-lft-identity65.8%
times-frac89.1%
/-rgt-identity89.1%
distribute-neg-frac89.1%
distribute-neg-frac289.1%
neg-sub089.1%
sub-neg89.1%
+-commutative89.1%
associate--r+89.1%
neg-sub089.1%
remove-double-neg89.1%
Simplified89.1%
if -4.0999999999999999e68 < t < 6.50000000000000022e-84Initial program 96.8%
clear-num96.2%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 89.6%
Final simplification89.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.7e-50) (not (<= t 7.8e-20))) (+ 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 <= -2.7e-50) || !(t <= 7.8e-20)) {
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 <= (-2.7d-50)) .or. (.not. (t <= 7.8d-20))) 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 <= -2.7e-50) || !(t <= 7.8e-20)) {
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 <= -2.7e-50) or not (t <= 7.8e-20): 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 <= -2.7e-50) || !(t <= 7.8e-20)) 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 <= -2.7e-50) || ~((t <= 7.8e-20))) 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, -2.7e-50], N[Not[LessEqual[t, 7.8e-20]], $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 -2.7 \cdot 10^{-50} \lor \neg \left(t \leq 7.8 \cdot 10^{-20}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\end{array}
\end{array}
if t < -2.7e-50 or 7.80000000000000014e-20 < t Initial program 99.7%
Taylor expanded in a around 0 65.9%
mul-1-neg65.9%
associate-/l*84.6%
distribute-rgt-neg-in84.6%
distribute-frac-neg84.6%
neg-sub084.6%
sub-neg84.6%
+-commutative84.6%
associate--r+84.6%
neg-sub084.6%
remove-double-neg84.6%
Simplified84.6%
if -2.7e-50 < t < 7.80000000000000014e-20Initial program 96.6%
associate-*r/95.7%
clear-num95.7%
*-commutative95.7%
associate-/r*98.8%
Applied egg-rr98.8%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
associate-/l*89.5%
Simplified89.5%
Final simplification86.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.5e-102) (not (<= t 8.6e-91))) (+ x (* y (/ (- t z) t))) (+ x (/ (* y z) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.5e-102) || !(t <= 8.6e-91)) {
tmp = x + (y * ((t - z) / t));
} 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 <= (-4.5d-102)) .or. (.not. (t <= 8.6d-91))) then
tmp = x + (y * ((t - z) / t))
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 <= -4.5e-102) || !(t <= 8.6e-91)) {
tmp = x + (y * ((t - z) / t));
} else {
tmp = x + ((y * z) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.5e-102) or not (t <= 8.6e-91): tmp = x + (y * ((t - z) / t)) else: tmp = x + ((y * z) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.5e-102) || !(t <= 8.6e-91)) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); else tmp = Float64(x + Float64(Float64(y * z) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.5e-102) || ~((t <= 8.6e-91))) tmp = x + (y * ((t - z) / t)); else tmp = x + ((y * z) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.5e-102], N[Not[LessEqual[t, 8.6e-91]], $MachinePrecision]], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{-102} \lor \neg \left(t \leq 8.6 \cdot 10^{-91}\right):\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot z}{a}\\
\end{array}
\end{array}
if t < -4.49999999999999999e-102 or 8.6e-91 < t Initial program 99.7%
Taylor expanded in a around 0 67.2%
mul-1-neg67.2%
associate-/l*83.3%
distribute-rgt-neg-in83.3%
distribute-frac-neg83.3%
neg-sub083.3%
sub-neg83.3%
+-commutative83.3%
associate--r+83.3%
neg-sub083.3%
remove-double-neg83.3%
Simplified83.3%
if -4.49999999999999999e-102 < t < 8.6e-91Initial program 95.2%
Taylor expanded in t around 0 85.8%
Final simplification83.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -8e+58) (+ x (/ y (/ t (- t z)))) (if (<= t 5.6e-20) (+ x (/ y (/ (- a t) z))) (+ x (* y (/ (- t z) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8e+58) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 5.6e-20) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + (y * ((t - 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 <= (-8d+58)) then
tmp = x + (y / (t / (t - z)))
else if (t <= 5.6d-20) then
tmp = x + (y / ((a - t) / z))
else
tmp = x + (y * ((t - 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 <= -8e+58) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 5.6e-20) {
tmp = x + (y / ((a - t) / z));
} else {
tmp = x + (y * ((t - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8e+58: tmp = x + (y / (t / (t - z))) elif t <= 5.6e-20: tmp = x + (y / ((a - t) / z)) else: tmp = x + (y * ((t - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8e+58) tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); elseif (t <= 5.6e-20) tmp = Float64(x + Float64(y / Float64(Float64(a - t) / z))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8e+58) tmp = x + (y / (t / (t - z))); elseif (t <= 5.6e-20) tmp = x + (y / ((a - t) / z)); else tmp = x + (y * ((t - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8e+58], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 5.6e-20], N[(x + N[(y / N[(N[(a - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8 \cdot 10^{+58}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-20}:\\
\;\;\;\;x + \frac{y}{\frac{a - t}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\end{array}
\end{array}
if t < -7.99999999999999955e58Initial program 99.8%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in a around 0 85.4%
neg-mul-185.4%
distribute-neg-frac285.4%
sub-neg85.4%
distribute-neg-in85.4%
remove-double-neg85.4%
+-commutative85.4%
sub-neg85.4%
Simplified85.4%
if -7.99999999999999955e58 < t < 5.6000000000000005e-20Initial program 96.9%
clear-num96.3%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in z around inf 89.0%
if 5.6000000000000005e-20 < t Initial program 100.0%
Taylor expanded in a around 0 61.3%
mul-1-neg61.3%
associate-/l*87.1%
distribute-rgt-neg-in87.1%
distribute-frac-neg87.1%
neg-sub087.1%
sub-neg87.1%
+-commutative87.1%
associate--r+87.1%
neg-sub087.1%
remove-double-neg87.1%
Simplified87.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.7e-50) (+ x (/ y (/ t (- t z)))) (if (<= t 8.5e-20) (+ x (* z (/ y (- a t)))) (+ x (* y (/ (- t z) t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.7e-50) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 8.5e-20) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y * ((t - 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 <= (-2.7d-50)) then
tmp = x + (y / (t / (t - z)))
else if (t <= 8.5d-20) then
tmp = x + (z * (y / (a - t)))
else
tmp = x + (y * ((t - 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 <= -2.7e-50) {
tmp = x + (y / (t / (t - z)));
} else if (t <= 8.5e-20) {
tmp = x + (z * (y / (a - t)));
} else {
tmp = x + (y * ((t - z) / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.7e-50: tmp = x + (y / (t / (t - z))) elif t <= 8.5e-20: tmp = x + (z * (y / (a - t))) else: tmp = x + (y * ((t - z) / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.7e-50) tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); elseif (t <= 8.5e-20) tmp = Float64(x + Float64(z * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.7e-50) tmp = x + (y / (t / (t - z))); elseif (t <= 8.5e-20) tmp = x + (z * (y / (a - t))); else tmp = x + (y * ((t - z) / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.7e-50], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 8.5e-20], N[(x + N[(z * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.7 \cdot 10^{-50}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\mathbf{elif}\;t \leq 8.5 \cdot 10^{-20}:\\
\;\;\;\;x + z \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\end{array}
\end{array}
if t < -2.7e-50Initial program 99.4%
clear-num98.7%
un-div-inv98.7%
Applied egg-rr98.7%
Taylor expanded in a around 0 82.5%
neg-mul-182.5%
distribute-neg-frac282.5%
sub-neg82.5%
distribute-neg-in82.5%
remove-double-neg82.5%
+-commutative82.5%
sub-neg82.5%
Simplified82.5%
if -2.7e-50 < t < 8.5000000000000005e-20Initial program 96.6%
associate-*r/95.7%
clear-num95.7%
*-commutative95.7%
associate-/r*98.8%
Applied egg-rr98.8%
Taylor expanded in z around inf 89.5%
*-commutative89.5%
associate-/l*89.5%
Simplified89.5%
if 8.5000000000000005e-20 < t Initial program 100.0%
Taylor expanded in a around 0 61.3%
mul-1-neg61.3%
associate-/l*87.1%
distribute-rgt-neg-in87.1%
distribute-frac-neg87.1%
neg-sub087.1%
sub-neg87.1%
+-commutative87.1%
associate--r+87.1%
neg-sub087.1%
remove-double-neg87.1%
Simplified87.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.6e+58) (not (<= t 1.3e-44))) (+ x y) (+ x (/ y (/ a z)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.6e+58) || !(t <= 1.3e-44)) {
tmp = x + y;
} 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 <= (-3.6d+58)) .or. (.not. (t <= 1.3d-44))) then
tmp = x + y
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 <= -3.6e+58) || !(t <= 1.3e-44)) {
tmp = x + y;
} else {
tmp = x + (y / (a / z));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.6e+58) or not (t <= 1.3e-44): tmp = x + y else: tmp = x + (y / (a / z)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.6e+58) || !(t <= 1.3e-44)) tmp = Float64(x + y); 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 <= -3.6e+58) || ~((t <= 1.3e-44))) tmp = x + y; else tmp = x + (y / (a / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.6e+58], N[Not[LessEqual[t, 1.3e-44]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.6 \cdot 10^{+58} \lor \neg \left(t \leq 1.3 \cdot 10^{-44}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\end{array}
\end{array}
if t < -3.59999999999999996e58 or 1.2999999999999999e-44 < t Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in t around inf 76.1%
+-commutative76.1%
Simplified76.1%
if -3.59999999999999996e58 < t < 1.2999999999999999e-44Initial program 96.8%
clear-num96.1%
un-div-inv98.1%
Applied egg-rr98.1%
Taylor expanded in t around 0 74.7%
Final simplification75.5%
(FPCore (x y z t a) :precision binary64 (if (<= a -1.85e+240) x (if (<= a 6e+116) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.85e+240) {
tmp = x;
} else if (a <= 6e+116) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if (a <= (-1.85d+240)) then
tmp = x
else if (a <= 6d+116) then
tmp = x + y
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -1.85e+240) {
tmp = x;
} else if (a <= 6e+116) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -1.85e+240: tmp = x elif a <= 6e+116: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -1.85e+240) tmp = x; elseif (a <= 6e+116) tmp = Float64(x + y); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -1.85e+240) tmp = x; elseif (a <= 6e+116) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -1.85e+240], x, If[LessEqual[a, 6e+116], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.85 \cdot 10^{+240}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 6 \cdot 10^{+116}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.85e240 or 5.9999999999999997e116 < a Initial program 99.3%
+-commutative99.3%
fma-define99.3%
Simplified99.3%
Taylor expanded in y around 0 70.0%
if -1.85e240 < a < 5.9999999999999997e116Initial program 98.3%
+-commutative98.3%
fma-define98.4%
Simplified98.4%
Taylor expanded in t around inf 64.0%
+-commutative64.0%
Simplified64.0%
Final simplification65.4%
(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 98.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 98.6%
+-commutative98.6%
fma-define98.6%
Simplified98.6%
Taylor expanded in y around 0 48.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 2024172
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:alt
(! :herbie-platform default (if (< y -8508084860551241/100000000000000000000000000000000) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2894426862792089/10000000000000000000000000000000000000000000000000000000000000000) (+ x (* (* y (- z t)) (/ 1 (- a t)))) (+ x (* y (/ (- z t) (- a t)))))))
(+ x (* y (/ (- z t) (- a t)))))