
(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 (/ (- 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.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z (- a t)))))
(if (<= t -6.8e+57)
(+ x y)
(if (<= t -5.2e-298)
x
(if (<= t 1.28e-182)
t_1
(if (<= t 6.5e-131) x (if (<= t 5.5e-120) t_1 (+ x y))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / (a - t));
double tmp;
if (t <= -6.8e+57) {
tmp = x + y;
} else if (t <= -5.2e-298) {
tmp = x;
} else if (t <= 1.28e-182) {
tmp = t_1;
} else if (t <= 6.5e-131) {
tmp = x;
} else if (t <= 5.5e-120) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = y * (z / (a - t))
if (t <= (-6.8d+57)) then
tmp = x + y
else if (t <= (-5.2d-298)) then
tmp = x
else if (t <= 1.28d-182) then
tmp = t_1
else if (t <= 6.5d-131) then
tmp = x
else if (t <= 5.5d-120) then
tmp = t_1
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 t_1 = y * (z / (a - t));
double tmp;
if (t <= -6.8e+57) {
tmp = x + y;
} else if (t <= -5.2e-298) {
tmp = x;
} else if (t <= 1.28e-182) {
tmp = t_1;
} else if (t <= 6.5e-131) {
tmp = x;
} else if (t <= 5.5e-120) {
tmp = t_1;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / (a - t)) tmp = 0 if t <= -6.8e+57: tmp = x + y elif t <= -5.2e-298: tmp = x elif t <= 1.28e-182: tmp = t_1 elif t <= 6.5e-131: tmp = x elif t <= 5.5e-120: tmp = t_1 else: tmp = x + y return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / Float64(a - t))) tmp = 0.0 if (t <= -6.8e+57) tmp = Float64(x + y); elseif (t <= -5.2e-298) tmp = x; elseif (t <= 1.28e-182) tmp = t_1; elseif (t <= 6.5e-131) tmp = x; elseif (t <= 5.5e-120) tmp = t_1; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / (a - t)); tmp = 0.0; if (t <= -6.8e+57) tmp = x + y; elseif (t <= -5.2e-298) tmp = x; elseif (t <= 1.28e-182) tmp = t_1; elseif (t <= 6.5e-131) tmp = x; elseif (t <= 5.5e-120) tmp = t_1; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -6.8e+57], N[(x + y), $MachinePrecision], If[LessEqual[t, -5.2e-298], x, If[LessEqual[t, 1.28e-182], t$95$1, If[LessEqual[t, 6.5e-131], x, If[LessEqual[t, 5.5e-120], t$95$1, N[(x + y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a - t}\\
\mathbf{if}\;t \leq -6.8 \cdot 10^{+57}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{-298}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.28 \cdot 10^{-182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 6.5 \cdot 10^{-131}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{-120}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -6.79999999999999984e57 or 5.5000000000000001e-120 < t Initial program 99.9%
Taylor expanded in t around inf 70.1%
if -6.79999999999999984e57 < t < -5.1999999999999998e-298 or 1.2800000000000001e-182 < t < 6.5000000000000002e-131Initial program 97.9%
Taylor expanded in x around inf 64.2%
if -5.1999999999999998e-298 < t < 1.2800000000000001e-182 or 6.5000000000000002e-131 < t < 5.5000000000000001e-120Initial program 97.3%
+-commutative97.3%
*-commutative97.3%
associate-*l/89.0%
sub-neg89.0%
+-commutative89.0%
neg-sub089.0%
associate-+l-89.0%
sub0-neg89.0%
neg-mul-189.0%
times-frac97.4%
fma-def97.4%
sub-neg97.4%
+-commutative97.4%
neg-sub097.4%
associate-+l-97.4%
sub0-neg97.4%
neg-mul-197.4%
*-commutative97.4%
associate-/l*97.4%
metadata-eval97.4%
/-rgt-identity97.4%
Simplified97.4%
Taylor expanded in z around inf 63.0%
associate-*r/63.0%
associate-*r*63.0%
neg-mul-163.0%
Simplified63.0%
frac-2neg63.0%
div-inv62.9%
distribute-lft-neg-out62.9%
remove-double-neg62.9%
Applied egg-rr62.9%
associate-*l*71.1%
associate-*r/71.2%
*-rgt-identity71.2%
neg-sub071.2%
associate--r-71.2%
neg-sub071.2%
+-commutative71.2%
sub-neg71.2%
Simplified71.2%
Final simplification68.2%
(FPCore (x y z t a)
:precision binary64
(if (<= t -3.7e+94)
(+ x y)
(if (<= t -7e-59)
(+ x (* z (/ y (- t))))
(if (<= t 1.55e+105) (+ x (* y (/ (- z t) a))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -3.7e+94) {
tmp = x + y;
} else if (t <= -7e-59) {
tmp = x + (z * (y / -t));
} else if (t <= 1.55e+105) {
tmp = x + (y * ((z - t) / a));
} 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.7d+94)) then
tmp = x + y
else if (t <= (-7d-59)) then
tmp = x + (z * (y / -t))
else if (t <= 1.55d+105) then
tmp = x + (y * ((z - t) / a))
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.7e+94) {
tmp = x + y;
} else if (t <= -7e-59) {
tmp = x + (z * (y / -t));
} else if (t <= 1.55e+105) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -3.7e+94: tmp = x + y elif t <= -7e-59: tmp = x + (z * (y / -t)) elif t <= 1.55e+105: tmp = x + (y * ((z - t) / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -3.7e+94) tmp = Float64(x + y); elseif (t <= -7e-59) tmp = Float64(x + Float64(z * Float64(y / Float64(-t)))); elseif (t <= 1.55e+105) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -3.7e+94) tmp = x + y; elseif (t <= -7e-59) tmp = x + (z * (y / -t)); elseif (t <= 1.55e+105) tmp = x + (y * ((z - t) / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -3.7e+94], N[(x + y), $MachinePrecision], If[LessEqual[t, -7e-59], N[(x + N[(z * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.55e+105], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{+94}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -7 \cdot 10^{-59}:\\
\;\;\;\;x + z \cdot \frac{y}{-t}\\
\mathbf{elif}\;t \leq 1.55 \cdot 10^{+105}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -3.7000000000000001e94 or 1.55000000000000002e105 < t Initial program 99.9%
Taylor expanded in t around inf 77.2%
if -3.7000000000000001e94 < t < -7.0000000000000002e-59Initial program 97.2%
+-commutative97.2%
*-commutative97.2%
associate-*l/94.5%
sub-neg94.5%
+-commutative94.5%
neg-sub094.5%
associate-+l-94.5%
sub0-neg94.5%
neg-mul-194.5%
times-frac99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
metadata-eval99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in a around 0 77.8%
+-commutative77.8%
associate-/l*75.0%
Simplified75.0%
Taylor expanded in t around 0 77.8%
associate-*r/77.8%
mul-1-neg77.8%
distribute-rgt-neg-in77.8%
associate-*l/77.9%
*-commutative77.9%
distribute-lft-neg-out77.9%
distribute-rgt-neg-in77.9%
mul-1-neg77.9%
metadata-eval77.9%
times-frac77.9%
*-lft-identity77.9%
neg-mul-177.9%
Simplified77.9%
if -7.0000000000000002e-59 < t < 1.55000000000000002e105Initial program 98.6%
Taylor expanded in a around inf 85.9%
Final simplification82.3%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.8e+100)
(+ x y)
(if (<= t -7e-59)
(+ x (* z (/ y (- t))))
(if (<= t 2.2e+105) (+ x (* z (/ y a))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.8e+100) {
tmp = x + y;
} else if (t <= -7e-59) {
tmp = x + (z * (y / -t));
} else if (t <= 2.2e+105) {
tmp = x + (z * (y / a));
} 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.8d+100)) then
tmp = x + y
else if (t <= (-7d-59)) then
tmp = x + (z * (y / -t))
else if (t <= 2.2d+105) then
tmp = x + (z * (y / a))
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.8e+100) {
tmp = x + y;
} else if (t <= -7e-59) {
tmp = x + (z * (y / -t));
} else if (t <= 2.2e+105) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.8e+100: tmp = x + y elif t <= -7e-59: tmp = x + (z * (y / -t)) elif t <= 2.2e+105: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.8e+100) tmp = Float64(x + y); elseif (t <= -7e-59) tmp = Float64(x + Float64(z * Float64(y / Float64(-t)))); elseif (t <= 2.2e+105) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.8e+100) tmp = x + y; elseif (t <= -7e-59) tmp = x + (z * (y / -t)); elseif (t <= 2.2e+105) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.8e+100], N[(x + y), $MachinePrecision], If[LessEqual[t, -7e-59], N[(x + N[(z * N[(y / (-t)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.2e+105], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.8 \cdot 10^{+100}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq -7 \cdot 10^{-59}:\\
\;\;\;\;x + z \cdot \frac{y}{-t}\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+105}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.7999999999999998e100 or 2.20000000000000007e105 < t Initial program 99.9%
Taylor expanded in t around inf 77.2%
if -2.7999999999999998e100 < t < -7.0000000000000002e-59Initial program 97.2%
+-commutative97.2%
*-commutative97.2%
associate-*l/94.5%
sub-neg94.5%
+-commutative94.5%
neg-sub094.5%
associate-+l-94.5%
sub0-neg94.5%
neg-mul-194.5%
times-frac99.9%
fma-def99.9%
sub-neg99.9%
+-commutative99.9%
neg-sub099.9%
associate-+l-99.9%
sub0-neg99.9%
neg-mul-199.9%
*-commutative99.9%
associate-/l*99.9%
metadata-eval99.9%
/-rgt-identity99.9%
Simplified99.9%
Taylor expanded in a around 0 77.8%
+-commutative77.8%
associate-/l*75.0%
Simplified75.0%
Taylor expanded in t around 0 77.8%
associate-*r/77.8%
mul-1-neg77.8%
distribute-rgt-neg-in77.8%
associate-*l/77.9%
*-commutative77.9%
distribute-lft-neg-out77.9%
distribute-rgt-neg-in77.9%
mul-1-neg77.9%
metadata-eval77.9%
times-frac77.9%
*-lft-identity77.9%
neg-mul-177.9%
Simplified77.9%
if -7.0000000000000002e-59 < t < 2.20000000000000007e105Initial program 98.6%
Taylor expanded in t around 0 83.2%
associate-/l*85.1%
Simplified85.1%
associate-/r/85.4%
Applied egg-rr85.4%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -2.6e+35) (not (<= a 170000000000.0))) (+ x (* y (/ (- z t) a))) (+ x (/ y (/ t (- t z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.6e+35) || !(a <= 170000000000.0)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (y / (t / (t - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((a <= (-2.6d+35)) .or. (.not. (a <= 170000000000.0d0))) then
tmp = x + (y * ((z - t) / a))
else
tmp = x + (y / (t / (t - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((a <= -2.6e+35) || !(a <= 170000000000.0)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (y / (t / (t - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (a <= -2.6e+35) or not (a <= 170000000000.0): tmp = x + (y * ((z - t) / a)) else: tmp = x + (y / (t / (t - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((a <= -2.6e+35) || !(a <= 170000000000.0)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x + Float64(y / Float64(t / Float64(t - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((a <= -2.6e+35) || ~((a <= 170000000000.0))) tmp = x + (y * ((z - t) / a)); else tmp = x + (y / (t / (t - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[a, -2.6e+35], N[Not[LessEqual[a, 170000000000.0]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(t / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.6 \cdot 10^{+35} \lor \neg \left(a \leq 170000000000\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\end{array}
\end{array}
if a < -2.60000000000000007e35 or 1.7e11 < a Initial program 99.9%
Taylor expanded in a around inf 90.5%
if -2.60000000000000007e35 < a < 1.7e11Initial program 97.5%
+-commutative97.5%
*-commutative97.5%
associate-*l/91.1%
sub-neg91.1%
+-commutative91.1%
neg-sub091.1%
associate-+l-91.1%
sub0-neg91.1%
neg-mul-191.1%
times-frac96.0%
fma-def96.0%
sub-neg96.0%
+-commutative96.0%
neg-sub096.0%
associate-+l-96.0%
sub0-neg96.0%
neg-mul-196.0%
*-commutative96.0%
associate-/l*96.0%
metadata-eval96.0%
/-rgt-identity96.0%
Simplified96.0%
Taylor expanded in a around 0 74.1%
+-commutative74.1%
associate-/l*81.4%
Simplified81.4%
Final simplification86.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.1e-65) (not (<= t 7.8e+28))) (- x (* t (/ y (- a t)))) (+ x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.1e-65) || !(t <= 7.8e+28)) {
tmp = x - (t * (y / (a - 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 <= (-3.1d-65)) .or. (.not. (t <= 7.8d+28))) then
tmp = x - (t * (y / (a - 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 <= -3.1e-65) || !(t <= 7.8e+28)) {
tmp = x - (t * (y / (a - t)));
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.1e-65) or not (t <= 7.8e+28): tmp = x - (t * (y / (a - t))) else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.1e-65) || !(t <= 7.8e+28)) tmp = Float64(x - Float64(t * Float64(y / Float64(a - t)))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.1e-65) || ~((t <= 7.8e+28))) tmp = x - (t * (y / (a - t))); else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.1e-65], N[Not[LessEqual[t, 7.8e+28]], $MachinePrecision]], N[(x - N[(t * N[(y / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.1 \cdot 10^{-65} \lor \neg \left(t \leq 7.8 \cdot 10^{+28}\right):\\
\;\;\;\;x - t \cdot \frac{y}{a - t}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if t < -3.10000000000000016e-65 or 7.7999999999999997e28 < t Initial program 99.2%
associate-*r/81.7%
Simplified81.7%
associate-/l*99.2%
associate-/r/98.4%
Applied egg-rr98.4%
Taylor expanded in z around 0 72.4%
+-commutative72.4%
mul-1-neg72.4%
unsub-neg72.4%
associate-/l*86.8%
remove-double-neg86.8%
distribute-frac-neg86.8%
distribute-neg-frac86.8%
associate-/l*72.4%
distribute-neg-frac72.4%
*-commutative72.4%
distribute-lft-neg-out72.4%
associate-*r/85.2%
distribute-lft-neg-out85.2%
distribute-rgt-neg-in85.2%
distribute-frac-neg85.2%
distribute-rgt-neg-out85.2%
distribute-frac-neg85.2%
remove-double-neg85.2%
Simplified85.2%
if -3.10000000000000016e-65 < t < 7.7999999999999997e28Initial program 98.4%
Taylor expanded in a around inf 88.1%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -3.7e-59) (not (<= t 1e+29))) (- x (/ y (+ (/ a t) -1.0))) (+ x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -3.7e-59) || !(t <= 1e+29)) {
tmp = x - (y / ((a / t) + -1.0));
} 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.7d-59)) .or. (.not. (t <= 1d+29))) then
tmp = x - (y / ((a / t) + (-1.0d0)))
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.7e-59) || !(t <= 1e+29)) {
tmp = x - (y / ((a / t) + -1.0));
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -3.7e-59) or not (t <= 1e+29): tmp = x - (y / ((a / t) + -1.0)) else: tmp = x + (y * ((z - t) / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -3.7e-59) || !(t <= 1e+29)) tmp = Float64(x - Float64(y / Float64(Float64(a / t) + -1.0))); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -3.7e-59) || ~((t <= 1e+29))) tmp = x - (y / ((a / t) + -1.0)); else tmp = x + (y * ((z - t) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -3.7e-59], N[Not[LessEqual[t, 1e+29]], $MachinePrecision]], N[(x - N[(y / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -3.7 \cdot 10^{-59} \lor \neg \left(t \leq 10^{+29}\right):\\
\;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if t < -3.6999999999999999e-59 or 9.99999999999999914e28 < t Initial program 99.2%
Taylor expanded in z around 0 72.4%
+-commutative72.4%
mul-1-neg72.4%
unsub-neg72.4%
associate-/l*86.8%
div-sub86.8%
*-inverses86.8%
Simplified86.8%
if -3.6999999999999999e-59 < t < 9.99999999999999914e28Initial program 98.4%
Taylor expanded in a around inf 88.1%
Final simplification87.5%
(FPCore (x y z t a) :precision binary64 (if (<= t -7e+57) (+ x y) (if (<= t 8e+104) (+ x (* y (/ z a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7e+57) {
tmp = x + y;
} else if (t <= 8e+104) {
tmp = x + (y * (z / a));
} 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 <= (-7d+57)) then
tmp = x + y
else if (t <= 8d+104) then
tmp = x + (y * (z / a))
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 <= -7e+57) {
tmp = x + y;
} else if (t <= 8e+104) {
tmp = x + (y * (z / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7e+57: tmp = x + y elif t <= 8e+104: tmp = x + (y * (z / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7e+57) tmp = Float64(x + y); elseif (t <= 8e+104) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7e+57) tmp = x + y; elseif (t <= 8e+104) tmp = x + (y * (z / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7e+57], N[(x + y), $MachinePrecision], If[LessEqual[t, 8e+104], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7 \cdot 10^{+57}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 8 \cdot 10^{+104}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -6.9999999999999995e57 or 8e104 < t Initial program 99.9%
Taylor expanded in t around inf 75.5%
if -6.9999999999999995e57 < t < 8e104Initial program 98.3%
Taylor expanded in t around 0 81.5%
Final simplification79.6%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.3e+59) (+ x y) (if (<= t 1.1e+106) (+ x (* z (/ y a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.3e+59) {
tmp = x + y;
} else if (t <= 1.1e+106) {
tmp = x + (z * (y / a));
} 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 <= (-6.3d+59)) then
tmp = x + y
else if (t <= 1.1d+106) then
tmp = x + (z * (y / a))
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 <= -6.3e+59) {
tmp = x + y;
} else if (t <= 1.1e+106) {
tmp = x + (z * (y / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.3e+59: tmp = x + y elif t <= 1.1e+106: tmp = x + (z * (y / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.3e+59) tmp = Float64(x + y); elseif (t <= 1.1e+106) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.3e+59) tmp = x + y; elseif (t <= 1.1e+106) tmp = x + (z * (y / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.3e+59], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.1e+106], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.3 \cdot 10^{+59}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.1 \cdot 10^{+106}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -6.3e59 or 1.09999999999999996e106 < t Initial program 99.9%
Taylor expanded in t around inf 75.5%
if -6.3e59 < t < 1.09999999999999996e106Initial program 98.3%
Taylor expanded in t around 0 79.9%
associate-/l*81.5%
Simplified81.5%
associate-/r/82.2%
Applied egg-rr82.2%
Final simplification80.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.6e+58) (+ x y) (if (<= t 1.2e-72) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.6e+58) {
tmp = x + y;
} else if (t <= 1.2e-72) {
tmp = x;
} 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.6d+58)) then
tmp = x + y
else if (t <= 1.2d-72) then
tmp = x
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.6e+58) {
tmp = x + y;
} else if (t <= 1.2e-72) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.6e+58: tmp = x + y elif t <= 1.2e-72: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.6e+58) tmp = Float64(x + y); elseif (t <= 1.2e-72) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.6e+58) tmp = x + y; elseif (t <= 1.2e-72) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.6e+58], N[(x + y), $MachinePrecision], If[LessEqual[t, 1.2e-72], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+58}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-72}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if t < -2.59999999999999988e58 or 1.2e-72 < t Initial program 99.9%
Taylor expanded in t around inf 71.9%
if -2.59999999999999988e58 < t < 1.2e-72Initial program 97.8%
Taylor expanded in x around inf 53.2%
Final simplification61.8%
(FPCore (x y z t a) :precision binary64 (if (<= y -9.5e+126) y x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -9.5e+126) {
tmp = 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 (y <= (-9.5d+126)) then
tmp = 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 (y <= -9.5e+126) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -9.5e+126: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -9.5e+126) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -9.5e+126) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -9.5e+126], y, x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.5 \cdot 10^{+126}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -9.49999999999999951e126Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/66.3%
sub-neg66.3%
+-commutative66.3%
neg-sub066.3%
associate-+l-66.3%
sub0-neg66.3%
neg-mul-166.3%
times-frac99.8%
fma-def99.8%
sub-neg99.8%
+-commutative99.8%
neg-sub099.8%
associate-+l-99.8%
sub0-neg99.8%
neg-mul-199.8%
*-commutative99.8%
associate-/l*99.8%
metadata-eval99.8%
/-rgt-identity99.8%
Simplified99.8%
Taylor expanded in a around 0 46.3%
+-commutative46.3%
associate-/l*58.6%
Simplified58.6%
Taylor expanded in y around inf 55.6%
Taylor expanded in z around 0 22.7%
if -9.49999999999999951e126 < y Initial program 98.7%
Taylor expanded in x around inf 58.9%
Final simplification54.5%
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 98.8%
Taylor expanded in x around inf 52.4%
Final simplification52.4%
(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 2023240
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, B"
:precision binary64
:herbie-target
(if (< y -8.508084860551241e-17) (+ x (* y (/ (- z t) (- a t)))) (if (< y 2.894426862792089e-49) (+ x (* (* y (- z t)) (/ 1.0 (- a t)))) (+ x (* y (/ (- z t) (- a t))))))
(+ x (* y (/ (- z t) (- a t)))))