
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- a t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x + (y * ((z - t) / (a - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (a - t)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (a - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(a - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (a - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a - t}
\end{array}
(FPCore (x y z t a) :precision binary64 (fma y (/ (- z t) (- a t)) x))
double code(double x, double y, double z, double t, double a) {
return fma(y, ((z - t) / (a - t)), x);
}
function code(x, y, z, t, a) return fma(y, Float64(Float64(z - t) / Float64(a - t)), x) end
code[x_, y_, z_, t_, a_] := N[(y * N[(N[(z - t), $MachinePrecision] / N[(a - t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(y, \frac{z - t}{a - t}, x\right)
\end{array}
Initial program 98.8%
+-commutative98.8%
fma-def98.8%
Simplified98.8%
Final simplification98.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -4.5e+77)
(+ y x)
(if (<= t -2.05e-43)
(* (- t z) (/ y (- t a)))
(if (<= t 4.6e+129) (+ x (* y (/ (- z t) a))) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -4.5e+77) {
tmp = y + x;
} else if (t <= -2.05e-43) {
tmp = (t - z) * (y / (t - a));
} else if (t <= 4.6e+129) {
tmp = x + (y * ((z - t) / a));
} 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 <= (-4.5d+77)) then
tmp = y + x
else if (t <= (-2.05d-43)) then
tmp = (t - z) * (y / (t - a))
else if (t <= 4.6d+129) then
tmp = x + (y * ((z - t) / a))
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 <= -4.5e+77) {
tmp = y + x;
} else if (t <= -2.05e-43) {
tmp = (t - z) * (y / (t - a));
} else if (t <= 4.6e+129) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -4.5e+77: tmp = y + x elif t <= -2.05e-43: tmp = (t - z) * (y / (t - a)) elif t <= 4.6e+129: tmp = x + (y * ((z - t) / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -4.5e+77) tmp = Float64(y + x); elseif (t <= -2.05e-43) tmp = Float64(Float64(t - z) * Float64(y / Float64(t - a))); elseif (t <= 4.6e+129) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -4.5e+77) tmp = y + x; elseif (t <= -2.05e-43) tmp = (t - z) * (y / (t - a)); elseif (t <= 4.6e+129) tmp = x + (y * ((z - t) / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -4.5e+77], N[(y + x), $MachinePrecision], If[LessEqual[t, -2.05e-43], N[(N[(t - z), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4.6e+129], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.5 \cdot 10^{+77}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -2.05 \cdot 10^{-43}:\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{t - a}\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+129}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -4.50000000000000024e77 or 4.59999999999999981e129 < t Initial program 99.9%
Taylor expanded in t around inf 85.4%
if -4.50000000000000024e77 < t < -2.0499999999999999e-43Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/91.0%
sub-neg91.0%
+-commutative91.0%
neg-sub091.0%
associate-+l-91.0%
sub0-neg91.0%
neg-mul-191.0%
times-frac93.8%
fma-def93.8%
sub-neg93.8%
+-commutative93.8%
neg-sub093.8%
associate-+l-93.8%
sub0-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
metadata-eval93.8%
/-rgt-identity93.8%
Simplified93.8%
Taylor expanded in y around -inf 69.0%
*-commutative69.0%
associate-*r/72.2%
Simplified72.2%
if -2.0499999999999999e-43 < t < 4.59999999999999981e129Initial program 98.0%
Taylor expanded in a around inf 84.9%
Final simplification83.5%
(FPCore (x y z t a)
:precision binary64
(if (<= t -2.1e+135)
(+ y x)
(if (<= t -8.8e-43)
(- x (* z (/ y t)))
(if (<= t 1e-34) (+ x (/ y (/ a z))) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.1e+135) {
tmp = y + x;
} else if (t <= -8.8e-43) {
tmp = x - (z * (y / t));
} else if (t <= 1e-34) {
tmp = x + (y / (a / z));
} 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 <= (-2.1d+135)) then
tmp = y + x
else if (t <= (-8.8d-43)) then
tmp = x - (z * (y / t))
else if (t <= 1d-34) then
tmp = x + (y / (a / z))
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 <= -2.1e+135) {
tmp = y + x;
} else if (t <= -8.8e-43) {
tmp = x - (z * (y / t));
} else if (t <= 1e-34) {
tmp = x + (y / (a / z));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.1e+135: tmp = y + x elif t <= -8.8e-43: tmp = x - (z * (y / t)) elif t <= 1e-34: tmp = x + (y / (a / z)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.1e+135) tmp = Float64(y + x); elseif (t <= -8.8e-43) tmp = Float64(x - Float64(z * Float64(y / t))); elseif (t <= 1e-34) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.1e+135) tmp = y + x; elseif (t <= -8.8e-43) tmp = x - (z * (y / t)); elseif (t <= 1e-34) tmp = x + (y / (a / z)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.1e+135], N[(y + x), $MachinePrecision], If[LessEqual[t, -8.8e-43], N[(x - N[(z * N[(y / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1e-34], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.1 \cdot 10^{+135}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -8.8 \cdot 10^{-43}:\\
\;\;\;\;x - z \cdot \frac{y}{t}\\
\mathbf{elif}\;t \leq 10^{-34}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -2.1000000000000001e135 or 9.99999999999999928e-35 < t Initial program 99.9%
Taylor expanded in t around inf 78.0%
if -2.1000000000000001e135 < t < -8.79999999999999989e-43Initial program 99.9%
Taylor expanded in a around 0 74.1%
+-commutative74.1%
mul-1-neg74.1%
unsub-neg74.1%
associate-/l*80.1%
Simplified80.1%
Taylor expanded in z around inf 61.7%
*-commutative61.7%
associate-*r/67.7%
Simplified67.7%
if -8.79999999999999989e-43 < t < 9.99999999999999928e-35Initial program 97.6%
Taylor expanded in t around 0 82.8%
associate-/l*85.6%
Simplified85.6%
Final simplification80.0%
(FPCore (x y z t a)
:precision binary64
(if (<= t -1.32e+78)
(+ y x)
(if (<= t -8.5e-43)
(* (- t z) (/ y (- t a)))
(if (<= t 1.25e-36) (+ x (/ y (/ a z))) (+ y x)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.32e+78) {
tmp = y + x;
} else if (t <= -8.5e-43) {
tmp = (t - z) * (y / (t - a));
} else if (t <= 1.25e-36) {
tmp = x + (y / (a / z));
} 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.32d+78)) then
tmp = y + x
else if (t <= (-8.5d-43)) then
tmp = (t - z) * (y / (t - a))
else if (t <= 1.25d-36) then
tmp = x + (y / (a / z))
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.32e+78) {
tmp = y + x;
} else if (t <= -8.5e-43) {
tmp = (t - z) * (y / (t - a));
} else if (t <= 1.25e-36) {
tmp = x + (y / (a / z));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.32e+78: tmp = y + x elif t <= -8.5e-43: tmp = (t - z) * (y / (t - a)) elif t <= 1.25e-36: tmp = x + (y / (a / z)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.32e+78) tmp = Float64(y + x); elseif (t <= -8.5e-43) tmp = Float64(Float64(t - z) * Float64(y / Float64(t - a))); elseif (t <= 1.25e-36) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.32e+78) tmp = y + x; elseif (t <= -8.5e-43) tmp = (t - z) * (y / (t - a)); elseif (t <= 1.25e-36) tmp = x + (y / (a / z)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.32e+78], N[(y + x), $MachinePrecision], If[LessEqual[t, -8.5e-43], N[(N[(t - z), $MachinePrecision] * N[(y / N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.25e-36], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.32 \cdot 10^{+78}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq -8.5 \cdot 10^{-43}:\\
\;\;\;\;\left(t - z\right) \cdot \frac{y}{t - a}\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{-36}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -1.3199999999999999e78 or 1.25000000000000001e-36 < t Initial program 99.9%
Taylor expanded in t around inf 77.3%
if -1.3199999999999999e78 < t < -8.50000000000000056e-43Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-*l/91.0%
sub-neg91.0%
+-commutative91.0%
neg-sub091.0%
associate-+l-91.0%
sub0-neg91.0%
neg-mul-191.0%
times-frac93.8%
fma-def93.8%
sub-neg93.8%
+-commutative93.8%
neg-sub093.8%
associate-+l-93.8%
sub0-neg93.8%
neg-mul-193.8%
*-commutative93.8%
associate-/l*93.8%
metadata-eval93.8%
/-rgt-identity93.8%
Simplified93.8%
Taylor expanded in y around -inf 69.0%
*-commutative69.0%
associate-*r/72.2%
Simplified72.2%
if -8.50000000000000056e-43 < t < 1.25000000000000001e-36Initial program 97.6%
Taylor expanded in t around 0 82.8%
associate-/l*85.6%
Simplified85.6%
Final simplification80.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= a -195.0) (not (<= a 0.001))) (+ 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 <= -195.0) || !(a <= 0.001)) {
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 <= (-195.0d0)) .or. (.not. (a <= 0.001d0))) 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 <= -195.0) || !(a <= 0.001)) {
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 <= -195.0) or not (a <= 0.001): 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 <= -195.0) || !(a <= 0.001)) 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 <= -195.0) || ~((a <= 0.001))) 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, -195.0], N[Not[LessEqual[a, 0.001]], $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 -195 \lor \neg \left(a \leq 0.001\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{t}{t - z}}\\
\end{array}
\end{array}
if a < -195 or 1e-3 < a Initial program 99.8%
Taylor expanded in a around inf 89.1%
if -195 < a < 1e-3Initial program 97.4%
+-commutative97.4%
*-commutative97.4%
associate-*l/90.8%
sub-neg90.8%
+-commutative90.8%
neg-sub090.8%
associate-+l-90.8%
sub0-neg90.8%
neg-mul-190.8%
times-frac94.9%
fma-def94.9%
sub-neg94.9%
+-commutative94.9%
neg-sub094.9%
associate-+l-94.9%
sub0-neg94.9%
neg-mul-194.9%
*-commutative94.9%
associate-/l*94.9%
metadata-eval94.9%
/-rgt-identity94.9%
Simplified94.9%
Taylor expanded in a around 0 75.6%
+-commutative75.6%
associate-/l*83.9%
Simplified83.9%
Final simplification86.8%
(FPCore (x y z t a)
:precision binary64
(if (<= t -7.6e-43)
(+ x (* y (/ (- t z) t)))
(if (<= t 1.15e-59)
(+ x (* y (/ (- z t) a)))
(- x (/ y (+ (/ a t) -1.0))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.6e-43) {
tmp = x + (y * ((t - z) / t));
} else if (t <= 1.15e-59) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
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 <= (-7.6d-43)) then
tmp = x + (y * ((t - z) / t))
else if (t <= 1.15d-59) then
tmp = x + (y * ((z - t) / a))
else
tmp = x - (y / ((a / t) + (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -7.6e-43) {
tmp = x + (y * ((t - z) / t));
} else if (t <= 1.15e-59) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x - (y / ((a / t) + -1.0));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -7.6e-43: tmp = x + (y * ((t - z) / t)) elif t <= 1.15e-59: tmp = x + (y * ((z - t) / a)) else: tmp = x - (y / ((a / t) + -1.0)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -7.6e-43) tmp = Float64(x + Float64(y * Float64(Float64(t - z) / t))); elseif (t <= 1.15e-59) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); else tmp = Float64(x - Float64(y / Float64(Float64(a / t) + -1.0))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -7.6e-43) tmp = x + (y * ((t - z) / t)); elseif (t <= 1.15e-59) tmp = x + (y * ((z - t) / a)); else tmp = x - (y / ((a / t) + -1.0)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -7.6e-43], N[(x + N[(y * N[(N[(t - z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.15e-59], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(N[(a / t), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.6 \cdot 10^{-43}:\\
\;\;\;\;x + y \cdot \frac{t - z}{t}\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{-59}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{t} + -1}\\
\end{array}
\end{array}
if t < -7.59999999999999939e-43Initial program 99.9%
Taylor expanded in a around 0 72.6%
+-commutative72.6%
mul-1-neg72.6%
unsub-neg72.6%
associate-/l*82.7%
Simplified82.7%
associate-/r/84.1%
Applied egg-rr84.1%
if -7.59999999999999939e-43 < t < 1.1499999999999999e-59Initial program 97.5%
Taylor expanded in a around inf 89.3%
if 1.1499999999999999e-59 < t Initial program 99.8%
Taylor expanded in z around 0 73.6%
+-commutative73.6%
mul-1-neg73.6%
unsub-neg73.6%
associate-/l*90.6%
div-sub90.6%
*-inverses90.6%
Simplified90.6%
Final simplification88.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -8.8e-43) (+ y x) (if (<= t 5.8e-39) (+ x (* y (/ z a))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -8.8e-43) {
tmp = y + x;
} else if (t <= 5.8e-39) {
tmp = x + (y * (z / a));
} 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 <= (-8.8d-43)) then
tmp = y + x
else if (t <= 5.8d-39) then
tmp = x + (y * (z / a))
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 <= -8.8e-43) {
tmp = y + x;
} else if (t <= 5.8e-39) {
tmp = x + (y * (z / a));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -8.8e-43: tmp = y + x elif t <= 5.8e-39: tmp = x + (y * (z / a)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -8.8e-43) tmp = Float64(y + x); elseif (t <= 5.8e-39) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -8.8e-43) tmp = y + x; elseif (t <= 5.8e-39) tmp = x + (y * (z / a)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -8.8e-43], N[(y + x), $MachinePrecision], If[LessEqual[t, 5.8e-39], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -8.8 \cdot 10^{-43}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-39}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -8.79999999999999989e-43 or 5.79999999999999975e-39 < t Initial program 99.9%
Taylor expanded in t around inf 68.5%
if -8.79999999999999989e-43 < t < 5.79999999999999975e-39Initial program 97.6%
Taylor expanded in t around 0 85.6%
Final simplification76.9%
(FPCore (x y z t a) :precision binary64 (if (<= t -6.1e-43) (+ y x) (if (<= t 1.05e-34) (+ x (/ y (/ a z))) (+ y x))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -6.1e-43) {
tmp = y + x;
} else if (t <= 1.05e-34) {
tmp = x + (y / (a / z));
} 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 <= (-6.1d-43)) then
tmp = y + x
else if (t <= 1.05d-34) then
tmp = x + (y / (a / z))
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 <= -6.1e-43) {
tmp = y + x;
} else if (t <= 1.05e-34) {
tmp = x + (y / (a / z));
} else {
tmp = y + x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -6.1e-43: tmp = y + x elif t <= 1.05e-34: tmp = x + (y / (a / z)) else: tmp = y + x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -6.1e-43) tmp = Float64(y + x); elseif (t <= 1.05e-34) tmp = Float64(x + Float64(y / Float64(a / z))); else tmp = Float64(y + x); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -6.1e-43) tmp = y + x; elseif (t <= 1.05e-34) tmp = x + (y / (a / z)); else tmp = y + x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -6.1e-43], N[(y + x), $MachinePrecision], If[LessEqual[t, 1.05e-34], N[(x + N[(y / N[(a / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y + x), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6.1 \cdot 10^{-43}:\\
\;\;\;\;y + x\\
\mathbf{elif}\;t \leq 1.05 \cdot 10^{-34}:\\
\;\;\;\;x + \frac{y}{\frac{a}{z}}\\
\mathbf{else}:\\
\;\;\;\;y + x\\
\end{array}
\end{array}
if t < -6.10000000000000037e-43 or 1.05e-34 < t Initial program 99.9%
Taylor expanded in t around inf 68.5%
if -6.10000000000000037e-43 < t < 1.05e-34Initial program 97.6%
Taylor expanded in t around 0 82.8%
associate-/l*85.6%
Simplified85.6%
Final simplification76.9%
(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 (if (<= y -1.6e+161) y (if (<= y 2.75e+216) x y)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.6e+161) {
tmp = y;
} else if (y <= 2.75e+216) {
tmp = x;
} else {
tmp = 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 (y <= (-1.6d+161)) then
tmp = y
else if (y <= 2.75d+216) then
tmp = x
else
tmp = y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -1.6e+161) {
tmp = y;
} else if (y <= 2.75e+216) {
tmp = x;
} else {
tmp = y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -1.6e+161: tmp = y elif y <= 2.75e+216: tmp = x else: tmp = y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -1.6e+161) tmp = y; elseif (y <= 2.75e+216) tmp = x; else tmp = y; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -1.6e+161) tmp = y; elseif (y <= 2.75e+216) tmp = x; else tmp = y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -1.6e+161], y, If[LessEqual[y, 2.75e+216], x, y]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{+161}:\\
\;\;\;\;y\\
\mathbf{elif}\;y \leq 2.75 \cdot 10^{+216}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y\\
\end{array}
\end{array}
if y < -1.60000000000000001e161 or 2.75e216 < y Initial program 99.8%
Taylor expanded in z around 0 43.0%
+-commutative43.0%
mul-1-neg43.0%
unsub-neg43.0%
associate-/l*65.1%
div-sub65.1%
*-inverses65.1%
Simplified65.1%
Taylor expanded in x around 0 49.7%
sub-neg49.7%
metadata-eval49.7%
associate-*r/49.7%
mul-1-neg49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in a around 0 37.7%
if -1.60000000000000001e161 < y < 2.75e216Initial program 98.5%
Taylor expanded in x around inf 57.3%
Final simplification53.4%
(FPCore (x y z t a) :precision binary64 (if (<= a 1.65e+97) (+ y x) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.65e+97) {
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 <= 1.65d+97) 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 <= 1.65e+97) {
tmp = y + x;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1.65e+97: tmp = y + x else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1.65e+97) 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 <= 1.65e+97) tmp = y + x; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1.65e+97], N[(y + x), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.65 \cdot 10^{+97}:\\
\;\;\;\;y + x\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < 1.6500000000000001e97Initial program 98.5%
Taylor expanded in t around inf 59.3%
if 1.6500000000000001e97 < a Initial program 99.8%
Taylor expanded in x around inf 70.8%
Final simplification61.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 49.4%
Final simplification49.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 2023230
(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)))))