
(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 9 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 (+ 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}
Initial program 99.2%
Final simplification99.2%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.65e-18)
(+ x (/ y (/ z (- z t))))
(if (<= z 3.4e-23)
(+ x (/ (- z t) (/ (- a) y)))
(+ x (* y (- 1.0 (/ t z)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.65e-18) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 3.4e-23) {
tmp = x + ((z - t) / (-a / y));
} else {
tmp = x + (y * (1.0 - (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 (z <= (-2.65d-18)) then
tmp = x + (y / (z / (z - t)))
else if (z <= 3.4d-23) then
tmp = x + ((z - t) / (-a / y))
else
tmp = x + (y * (1.0d0 - (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 (z <= -2.65e-18) {
tmp = x + (y / (z / (z - t)));
} else if (z <= 3.4e-23) {
tmp = x + ((z - t) / (-a / y));
} else {
tmp = x + (y * (1.0 - (t / z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.65e-18: tmp = x + (y / (z / (z - t))) elif z <= 3.4e-23: tmp = x + ((z - t) / (-a / y)) else: tmp = x + (y * (1.0 - (t / z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.65e-18) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); elseif (z <= 3.4e-23) tmp = Float64(x + Float64(Float64(z - t) / Float64(Float64(-a) / y))); else tmp = Float64(x + Float64(y * Float64(1.0 - Float64(t / z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.65e-18) tmp = x + (y / (z / (z - t))); elseif (z <= 3.4e-23) tmp = x + ((z - t) / (-a / y)); else tmp = x + (y * (1.0 - (t / z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.65e-18], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.4e-23], N[(x + N[(N[(z - t), $MachinePrecision] / N[((-a) / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(1.0 - N[(t / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.65 \cdot 10^{-18}:\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{-23}:\\
\;\;\;\;x + \frac{z - t}{\frac{-a}{y}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \left(1 - \frac{t}{z}\right)\\
\end{array}
\end{array}
if z < -2.65000000000000015e-18Initial program 99.9%
+-commutative99.9%
associate-*r/77.2%
associate-*l/95.4%
fma-def95.4%
Simplified95.4%
Taylor expanded in a around 0 74.1%
+-commutative74.1%
*-commutative74.1%
associate-/l*92.4%
Simplified92.4%
if -2.65000000000000015e-18 < z < 3.4000000000000001e-23Initial program 98.5%
associate-*r/92.1%
associate-*l/97.1%
clear-num97.0%
associate-*l/97.1%
*-un-lft-identity97.1%
Applied egg-rr97.1%
Taylor expanded in z around 0 87.8%
neg-mul-187.8%
distribute-neg-frac87.8%
Simplified87.8%
if 3.4000000000000001e-23 < z Initial program 100.0%
+-commutative100.0%
associate-*r/75.3%
associate-*l/94.4%
fma-def94.4%
Simplified94.4%
Taylor expanded in a around 0 70.3%
+-commutative70.3%
associate-/l*87.1%
associate-/r/93.3%
div-sub93.3%
*-inverses93.3%
Simplified93.3%
Final simplification90.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.3e-26) (not (<= z 3.2e-140))) (+ 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.3e-26) || !(z <= 3.2e-140)) {
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.3d-26)) .or. (.not. (z <= 3.2d-140))) 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.3e-26) || !(z <= 3.2e-140)) {
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.3e-26) or not (z <= 3.2e-140): 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.3e-26) || !(z <= 3.2e-140)) 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.3e-26) || ~((z <= 3.2e-140))) 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.3e-26], N[Not[LessEqual[z, 3.2e-140]], $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.3 \cdot 10^{-26} \lor \neg \left(z \leq 3.2 \cdot 10^{-140}\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.29999999999999988e-26 or 3.2000000000000001e-140 < z Initial program 99.9%
+-commutative99.9%
associate-*r/80.3%
associate-*l/95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in a around 0 70.4%
+-commutative70.4%
associate-/l*82.4%
associate-/r/87.4%
div-sub87.4%
*-inverses87.4%
Simplified87.4%
if -4.29999999999999988e-26 < z < 3.2000000000000001e-140Initial program 98.2%
+-commutative98.2%
associate-*r/90.4%
associate-*l/97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in z around 0 81.9%
associate-/l*89.6%
Simplified89.6%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.4e-19) (not (<= z 3.2e-140))) (+ x (/ y (/ z (- z t)))) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.4e-19) || !(z <= 3.2e-140)) {
tmp = x + (y / (z / (z - t)));
} 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 <= (-7.4d-19)) .or. (.not. (z <= 3.2d-140))) then
tmp = x + (y / (z / (z - t)))
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 <= -7.4e-19) || !(z <= 3.2e-140)) {
tmp = x + (y / (z / (z - t)));
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.4e-19) or not (z <= 3.2e-140): tmp = x + (y / (z / (z - t))) else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.4e-19) || !(z <= 3.2e-140)) tmp = Float64(x + Float64(y / Float64(z / Float64(z - t)))); 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 <= -7.4e-19) || ~((z <= 3.2e-140))) tmp = x + (y / (z / (z - t))); else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.4e-19], N[Not[LessEqual[z, 3.2e-140]], $MachinePrecision]], N[(x + N[(y / N[(z / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.4 \cdot 10^{-19} \lor \neg \left(z \leq 3.2 \cdot 10^{-140}\right):\\
\;\;\;\;x + \frac{y}{\frac{z}{z - t}}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -7.40000000000000011e-19 or 3.2000000000000001e-140 < z Initial program 99.9%
+-commutative99.9%
associate-*r/80.3%
associate-*l/95.1%
fma-def95.1%
Simplified95.1%
Taylor expanded in a around 0 70.4%
+-commutative70.4%
*-commutative70.4%
associate-/l*87.4%
Simplified87.4%
if -7.40000000000000011e-19 < z < 3.2000000000000001e-140Initial program 98.2%
+-commutative98.2%
associate-*r/90.4%
associate-*l/97.4%
fma-def97.4%
Simplified97.4%
Taylor expanded in z around 0 81.9%
associate-/l*89.6%
Simplified89.6%
Final simplification88.4%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.45e+20) (+ x y) (if (<= z 8.4e-134) (+ x (/ y (/ a t))) (+ x (* z (/ y (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.45e+20) {
tmp = x + y;
} else if (z <= 8.4e-134) {
tmp = x + (y / (a / t));
} else {
tmp = x + (z * (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 (z <= (-2.45d+20)) then
tmp = x + y
else if (z <= 8.4d-134) then
tmp = x + (y / (a / t))
else
tmp = x + (z * (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 (z <= -2.45e+20) {
tmp = x + y;
} else if (z <= 8.4e-134) {
tmp = x + (y / (a / t));
} else {
tmp = x + (z * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.45e+20: tmp = x + y elif z <= 8.4e-134: tmp = x + (y / (a / t)) else: tmp = x + (z * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.45e+20) tmp = Float64(x + y); elseif (z <= 8.4e-134) tmp = Float64(x + Float64(y / Float64(a / t))); else tmp = Float64(x + Float64(z * Float64(y / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.45e+20) tmp = x + y; elseif (z <= 8.4e-134) tmp = x + (y / (a / t)); else tmp = x + (z * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.45e+20], N[(x + y), $MachinePrecision], If[LessEqual[z, 8.4e-134], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{-134}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -2.45e20Initial program 100.0%
+-commutative100.0%
associate-*r/72.8%
associate-*l/94.6%
fma-def94.6%
Simplified94.6%
Taylor expanded in z around inf 86.1%
if -2.45e20 < z < 8.3999999999999996e-134Initial program 98.4%
+-commutative98.4%
associate-*r/91.3%
associate-*l/97.6%
fma-def97.6%
Simplified97.6%
Taylor expanded in z around 0 79.4%
associate-/l*86.3%
Simplified86.3%
if 8.3999999999999996e-134 < z Initial program 100.0%
Taylor expanded in t around 0 69.9%
associate-*l/78.8%
*-commutative78.8%
Simplified78.8%
Final simplification83.9%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.45e+20) (+ x y) (if (<= z 1.35e-17) (+ x (* y (/ t a))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.45e+20) {
tmp = x + y;
} else if (z <= 1.35e-17) {
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 <= (-2.45d+20)) then
tmp = x + y
else if (z <= 1.35d-17) 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 <= -2.45e+20) {
tmp = x + y;
} else if (z <= 1.35e-17) {
tmp = x + (y * (t / a));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.45e+20: tmp = x + y elif z <= 1.35e-17: tmp = x + (y * (t / a)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.45e+20) tmp = Float64(x + y); elseif (z <= 1.35e-17) 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 <= -2.45e+20) tmp = x + y; elseif (z <= 1.35e-17) tmp = x + (y * (t / a)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.45e+20], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.35e-17], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.45 \cdot 10^{+20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-17}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.45e20 or 1.3500000000000001e-17 < z Initial program 100.0%
+-commutative100.0%
associate-*r/73.4%
associate-*l/94.3%
fma-def94.3%
Simplified94.3%
Taylor expanded in z around inf 85.3%
if -2.45e20 < z < 1.3500000000000001e-17Initial program 98.6%
Taylor expanded in z around 0 81.0%
Final simplification82.8%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.5e+20) (+ x y) (if (<= z 1.15e-16) (+ x (/ y (/ a t))) (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.5e+20) {
tmp = x + y;
} else if (z <= 1.15e-16) {
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 <= (-2.5d+20)) then
tmp = x + y
else if (z <= 1.15d-16) 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 <= -2.5e+20) {
tmp = x + y;
} else if (z <= 1.15e-16) {
tmp = x + (y / (a / t));
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.5e+20: tmp = x + y elif z <= 1.15e-16: tmp = x + (y / (a / t)) else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.5e+20) tmp = Float64(x + y); elseif (z <= 1.15e-16) 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 <= -2.5e+20) tmp = x + y; elseif (z <= 1.15e-16) tmp = x + (y / (a / t)); else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.5e+20], N[(x + y), $MachinePrecision], If[LessEqual[z, 1.15e-16], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{+20}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{-16}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.5e20 or 1.15e-16 < z Initial program 100.0%
+-commutative100.0%
associate-*r/73.4%
associate-*l/94.3%
fma-def94.3%
Simplified94.3%
Taylor expanded in z around inf 85.3%
if -2.5e20 < z < 1.15e-16Initial program 98.6%
+-commutative98.6%
associate-*r/92.8%
associate-*l/97.3%
fma-def97.4%
Simplified97.4%
Taylor expanded in z around 0 76.5%
associate-/l*81.6%
Simplified81.6%
Final simplification83.2%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e-40) (+ x y) (if (<= z 2.75e-55) x (+ x y))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e-40) {
tmp = x + y;
} else if (z <= 2.75e-55) {
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 (z <= (-2.4d-40)) then
tmp = x + y
else if (z <= 2.75d-55) 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 (z <= -2.4e-40) {
tmp = x + y;
} else if (z <= 2.75e-55) {
tmp = x;
} else {
tmp = x + y;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e-40: tmp = x + y elif z <= 2.75e-55: tmp = x else: tmp = x + y return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e-40) tmp = Float64(x + y); elseif (z <= 2.75e-55) tmp = x; else tmp = Float64(x + y); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.4e-40) tmp = x + y; elseif (z <= 2.75e-55) tmp = x; else tmp = x + y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e-40], N[(x + y), $MachinePrecision], If[LessEqual[z, 2.75e-55], x, N[(x + y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.4 \cdot 10^{-40}:\\
\;\;\;\;x + y\\
\mathbf{elif}\;z \leq 2.75 \cdot 10^{-55}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x + y\\
\end{array}
\end{array}
if z < -2.39999999999999991e-40 or 2.7499999999999999e-55 < z Initial program 100.0%
+-commutative100.0%
associate-*r/77.5%
associate-*l/95.3%
fma-def95.3%
Simplified95.3%
Taylor expanded in z around inf 79.1%
if -2.39999999999999991e-40 < z < 2.7499999999999999e-55Initial program 98.4%
+-commutative98.4%
associate-*r/92.2%
associate-*l/96.9%
fma-def96.9%
Simplified96.9%
Taylor expanded in y around 0 51.6%
Final simplification65.7%
(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 99.2%
+-commutative99.2%
associate-*r/84.7%
associate-*l/96.1%
fma-def96.1%
Simplified96.1%
Taylor expanded in y around 0 53.1%
Final simplification53.1%
(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 2023279
(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)))))