
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (+ x (* y (/ (- z t) (- z a)))))
double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
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) / (z - a)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y * ((z - t) / (z - a)));
}
def code(x, y, z, t, a): return x + (y * ((z - t) / (z - a)))
function code(x, y, z, t, a) return Float64(x + Float64(y * Float64(Float64(z - t) / Float64(z - a)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y * ((z - t) / (z - a))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{z - a}
\end{array}
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (/ (- z t) (- z a)))) (if (<= t_1 5e-212) (+ x (/ (- z t) (/ (- z a) y))) (+ x (* t_1 y)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 5e-212) {
tmp = x + ((z - t) / ((z - a) / y));
} else {
tmp = x + (t_1 * y);
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = (z - t) / (z - a)
if (t_1 <= 5d-212) then
tmp = x + ((z - t) / ((z - a) / y))
else
tmp = x + (t_1 * y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) / (z - a);
double tmp;
if (t_1 <= 5e-212) {
tmp = x + ((z - t) / ((z - a) / y));
} else {
tmp = x + (t_1 * y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) / (z - a) tmp = 0 if t_1 <= 5e-212: tmp = x + ((z - t) / ((z - a) / y)) else: tmp = x + (t_1 * y) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) / Float64(z - a)) tmp = 0.0 if (t_1 <= 5e-212) tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(z - a) / y))); else tmp = Float64(x + Float64(t_1 * y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) / (z - a); tmp = 0.0; if (t_1 <= 5e-212) tmp = x + ((z - t) / ((z - a) / y)); else tmp = x + (t_1 * y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 5e-212], N[(x + N[(N[(z - t), $MachinePrecision] / N[(N[(z - a), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z - t}{z - a}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{-212}:\\
\;\;\;\;x + \frac{z - t}{\frac{z - a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + t_1 \cdot y\\
\end{array}
\end{array}
if (/.f64 (-.f64 z t) (-.f64 z a)) < 5.00000000000000043e-212Initial program 94.3%
*-commutative94.3%
associate-*l/90.3%
associate-/l*99.8%
Applied egg-rr99.8%
if 5.00000000000000043e-212 < (/.f64 (-.f64 z t) (-.f64 z a)) Initial program 98.8%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -4.4e+103)
(+ x y)
(if (<= z -5e-39)
(+ x (/ y (/ (- z) t)))
(if (<= z 4.8e-72) (+ x (/ y (/ a t))) (+ x y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -4.4e+103) {
tmp = x + y;
} else if (z <= -5e-39) {
tmp = x + (y / (-z / t));
} else if (z <= 4.8e-72) {
tmp = x + (y / (a / t));
} 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 (z <= (-4.4d+103)) then
tmp = x + y
else if (z <= (-5d-39)) then
tmp = x + (y / (-z / t))
else if (z <= 4.8d-72) then
tmp = x + (y / (a / t))
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 (z <= -4.4e+103) {
tmp = x + y;
} else if (z <= -5e-39) {
tmp = x + (y / (-z / t));
} else if (z <= 4.8e-72) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -4.4e+103: tmp = x + y elif z <= -5e-39: tmp = x + (y / (-z / t)) elif z <= 4.8e-72: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -4.4e+103) tmp = Float64(x + y); elseif (z <= -5e-39) tmp = Float64(x + Float64(y / Float64(Float64(-z) / t))); elseif (z <= 4.8e-72) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -4.4e+103) tmp = x + y; elseif (z <= -5e-39) tmp = x + (y / (-z / t)); elseif (z <= 4.8e-72) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -4.4e+103], N[(x + y), $MachinePrecision], If[LessEqual[z, -5e-39], N[(x + N[(y / N[((-z) / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-72], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.4 \cdot 10^{+103}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq -5 \cdot 10^{-39}:\\
\;\;\;\;x + \frac{y}{\frac{-z}{t}}\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-72}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -4.39999999999999985e103 or 4.8e-72 < z Initial program 99.9%
Taylor expanded in z around inf 83.2%
if -4.39999999999999985e103 < z < -4.9999999999999998e-39Initial program 99.8%
Taylor expanded in a around 0 65.2%
+-commutative65.2%
*-commutative65.2%
associate-/l*76.5%
Simplified76.5%
Taylor expanded in z around 0 70.7%
associate-*r/70.7%
neg-mul-170.7%
Simplified70.7%
if -4.9999999999999998e-39 < z < 4.8e-72Initial program 93.6%
Taylor expanded in z around 0 82.7%
associate-/l*84.2%
Simplified84.2%
Final simplification82.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.7e-39) (not (<= z 7.5e-73))) (+ x (* y (- 1.0 (/ t z)))) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.7e-39) || !(z <= 7.5e-73)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (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 ((z <= (-4.7d-39)) .or. (.not. (z <= 7.5d-73))) then
tmp = x + (y * (1.0d0 - (t / z)))
else
tmp = x + (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 ((z <= -4.7e-39) || !(z <= 7.5e-73)) {
tmp = x + (y * (1.0 - (t / z)));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.7e-39) or not (z <= 7.5e-73): tmp = x + (y * (1.0 - (t / z))) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.7e-39) || !(z <= 7.5e-73)) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); else tmp = Float64(x + Float64(y / Float64(a / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.7e-39) || ~((z <= 7.5e-73))) tmp = x + (y * (1.0 - (t / z))); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.7e-39], N[Not[LessEqual[z, 7.5e-73]], $MachinePrecision]], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.7 \cdot 10^{-39} \lor \neg \left(z \leq 7.5 \cdot 10^{-73}\right):\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -4.7000000000000002e-39 or 7.5e-73 < z Initial program 99.9%
Taylor expanded in a around 0 85.9%
div-sub85.9%
*-inverses85.9%
Simplified85.9%
if -4.7000000000000002e-39 < z < 7.5e-73Initial program 93.6%
Taylor expanded in z around 0 82.7%
associate-/l*84.2%
Simplified84.2%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.8e-39) (+ x (* y (- 1.0 (/ t z)))) (if (<= z 1.15e-73) (+ x (/ y (/ a t))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.8e-39) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 1.15e-73) {
tmp = x + (y / (a / t));
} else {
tmp = x + (y / (z / (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 (z <= (-2.8d-39)) then
tmp = x + (y * (1.0d0 - (t / z)))
else if (z <= 1.15d-73) then
tmp = x + (y / (a / t))
else
tmp = x + (y / (z / (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 (z <= -2.8e-39) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 1.15e-73) {
tmp = x + (y / (a / t));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.8e-39: tmp = x + (y * (1.0 - (t / z))) elif z <= 1.15e-73: tmp = x + (y / (a / t)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.8e-39) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); elseif (z <= 1.15e-73) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.8e-39) tmp = x + (y * (1.0 - (t / z))); elseif (z <= 1.15e-73) tmp = x + (y / (a / t)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.8e-39], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.15e-73], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.8 \cdot 10^{-39}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-73}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -2.8000000000000001e-39Initial program 99.9%
Taylor expanded in a around 0 86.2%
div-sub86.2%
*-inverses86.2%
Simplified86.2%
if -2.8000000000000001e-39 < z < 1.14999999999999994e-73Initial program 93.6%
Taylor expanded in z around 0 82.7%
associate-/l*84.2%
Simplified84.2%
if 1.14999999999999994e-73 < z Initial program 99.9%
Taylor expanded in a around 0 64.8%
+-commutative64.8%
*-commutative64.8%
associate-/l*85.7%
Simplified85.7%
Final simplification85.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.38e-56) (+ x (* y (- 1.0 (/ t z)))) (if (<= z 4.8e-72) (+ x (/ (- t z) (/ a y))) (+ x (/ y (/ z (- z t)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.38e-56) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 4.8e-72) {
tmp = x + ((t - z) / (a / y));
} else {
tmp = x + (y / (z / (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 (z <= (-1.38d-56)) then
tmp = x + (y * (1.0d0 - (t / z)))
else if (z <= 4.8d-72) then
tmp = x + ((t - z) / (a / y))
else
tmp = x + (y / (z / (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 (z <= -1.38e-56) {
tmp = x + (y * (1.0 - (t / z)));
} else if (z <= 4.8e-72) {
tmp = x + ((t - z) / (a / y));
} else {
tmp = x + (y / (z / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.38e-56: tmp = x + (y * (1.0 - (t / z))) elif z <= 4.8e-72: tmp = x + ((t - z) / (a / y)) else: tmp = x + (y / (z / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.38e-56) tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); elseif (z <= 4.8e-72) tmp = Float64(x + Float64(Float64(t - z) / Float64(a / y))); else tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.38e-56) tmp = x + (y * (1.0 - (t / z))); elseif (z <= 4.8e-72) tmp = x + ((t - z) / (a / y)); else tmp = x + (y / (z / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.38e-56], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.8e-72], N[(x + N[(N[(t - z), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.38 \cdot 10^{-56}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{elif}\;z \leq 4.8 \cdot 10^{-72}:\\
\;\;\;\;x + \frac{t - z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\end{array}
\end{array}
if z < -1.38e-56Initial program 99.9%
Taylor expanded in a around 0 85.7%
div-sub85.7%
*-inverses85.7%
Simplified85.7%
if -1.38e-56 < z < 4.8e-72Initial program 93.4%
clear-num93.3%
inv-pow93.3%
Applied egg-rr93.3%
unpow-193.3%
Simplified93.3%
Taylor expanded in a around inf 87.8%
+-commutative87.8%
*-commutative87.8%
mul-1-neg87.8%
unsub-neg87.8%
*-commutative87.8%
associate-/l*88.2%
Simplified88.2%
if 4.8e-72 < z Initial program 99.9%
Taylor expanded in a around 0 64.8%
+-commutative64.8%
*-commutative64.8%
associate-/l*85.7%
Simplified85.7%
Final simplification86.7%
(FPCore (x y z t a) :precision binary64 (if (<= x -2.9e-161) (+ x y) (if (<= x 5.4e-183) (* y (- 1.0 (/ t z))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -2.9e-161) {
tmp = x + y;
} else if (x <= 5.4e-183) {
tmp = y * (1.0 - (t / 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 (x <= (-2.9d-161)) then
tmp = x + y
else if (x <= 5.4d-183) then
tmp = y * (1.0d0 - (t / 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 (x <= -2.9e-161) {
tmp = x + y;
} else if (x <= 5.4e-183) {
tmp = y * (1.0 - (t / z));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -2.9e-161: tmp = x + y elif x <= 5.4e-183: tmp = y * (1.0 - (t / z)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -2.9e-161) tmp = Float64(x + y); elseif (x <= 5.4e-183) tmp = Float64(y * Float64(1.0 - Float64(t / z))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -2.9e-161) tmp = x + y; elseif (x <= 5.4e-183) tmp = y * (1.0 - (t / z)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -2.9e-161], N[(x + y), $MachinePrecision], If[LessEqual[x, 5.4e-183], N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.9 \cdot 10^{-161}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;x \leq 5.4 \cdot 10^{-183}:\\
\;\;\;\;y \cdot \left(1 - \frac{t}{z}\right)\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if x < -2.9e-161 or 5.40000000000000016e-183 < x Initial program 97.9%
Taylor expanded in z around inf 73.9%
if -2.9e-161 < x < 5.40000000000000016e-183Initial program 95.7%
Taylor expanded in a around 0 49.1%
+-commutative49.1%
*-commutative49.1%
associate-/l*52.2%
Simplified52.2%
Taylor expanded in y around inf 48.6%
Final simplification66.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -9e+69) (+ x y) (if (<= z 1.7e-71) (+ x (* y (/ t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -9e+69) {
tmp = x + y;
} else if (z <= 1.7e-71) {
tmp = x + (y * (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 (z <= (-9d+69)) then
tmp = x + y
else if (z <= 1.7d-71) then
tmp = x + (y * (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 (z <= -9e+69) {
tmp = x + y;
} else if (z <= 1.7e-71) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -9e+69: tmp = x + y elif z <= 1.7e-71: tmp = x + (y * (t / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -9e+69) tmp = Float64(x + y); elseif (z <= 1.7e-71) tmp = Float64(x + Float64(y * Float64(t / a))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -9e+69) tmp = x + y; elseif (z <= 1.7e-71) tmp = x + (y * (t / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -9e+69], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.7e-71], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9 \cdot 10^{+69}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-71}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -8.9999999999999999e69 or 1.70000000000000002e-71 < z Initial program 99.9%
Taylor expanded in z around inf 79.2%
if -8.9999999999999999e69 < z < 1.70000000000000002e-71Initial program 94.7%
Taylor expanded in z around 0 78.3%
Final simplification78.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -3e+68) (+ x y) (if (<= z 1.7e-71) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -3e+68) {
tmp = x + y;
} else if (z <= 1.7e-71) {
tmp = x + (y / (a / t));
} 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 (z <= (-3d+68)) then
tmp = x + y
else if (z <= 1.7d-71) then
tmp = x + (y / (a / t))
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 (z <= -3e+68) {
tmp = x + y;
} else if (z <= 1.7e-71) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -3e+68: tmp = x + y elif z <= 1.7e-71: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -3e+68) tmp = Float64(x + y); elseif (z <= 1.7e-71) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -3e+68) tmp = x + y; elseif (z <= 1.7e-71) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -3e+68], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.7e-71], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3 \cdot 10^{+68}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{-71}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -3.0000000000000002e68 or 1.70000000000000002e-71 < z Initial program 99.9%
Taylor expanded in z around inf 79.2%
if -3.0000000000000002e68 < z < 1.70000000000000002e-71Initial program 94.7%
Taylor expanded in z around 0 76.9%
associate-/l*79.6%
Simplified79.6%
Final simplification79.4%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ (- z t) (- z a)) y)))
double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / (z - a)) * y);
}
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 + (((z - t) / (z - a)) * y)
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (((z - t) / (z - a)) * y);
}
def code(x, y, z, t, a): return x + (((z - t) / (z - a)) * y)
function code(x, y, z, t, a) return Float64(x + Float64(Float64(Float64(z - t) / Float64(z - a)) * y)) end
function tmp = code(x, y, z, t, a) tmp = x + (((z - t) / (z - a)) * y); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(N[(z - t), $MachinePrecision] / N[(z - a), $MachinePrecision]), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{z - a} \cdot y
\end{array}
Initial program 97.3%
Final simplification97.3%
(FPCore (x y z t a) :precision binary64 (if (<= a 1.15e+41) (+ x y) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= 1.15e+41) {
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.15d+41) 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.15e+41) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= 1.15e+41: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= 1.15e+41) 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.15e+41) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, 1.15e+41], N[(x + y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq 1.15 \cdot 10^{+41}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < 1.1499999999999999e41Initial program 97.0%
Taylor expanded in z around inf 63.2%
if 1.1499999999999999e41 < a Initial program 98.2%
Taylor expanded in x around inf 71.2%
Final simplification64.9%
(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 97.3%
Taylor expanded in x around inf 50.5%
Final simplification50.5%
(FPCore (x y z t a) :precision binary64 (+ x (/ y (/ (- z a) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (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 / ((z - a) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + (y / ((z - a) / (z - t)));
}
def code(x, y, z, t, a): return x + (y / ((z - a) / (z - t)))
function code(x, y, z, t, a) return Float64(x + Float64(y / Float64(Float64(z - a) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x + (y / ((z - a) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{\frac{z - a}{z - t}}
\end{array}
herbie shell --seed 2023188
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:herbie-target
(+ x (/ y (/ (- z a) (- z t))))
(+ x (* y (/ (- z t) (- z a)))))