
(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 13 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 a) (- t z)))))
double code(double x, double y, double z, double t, double a) {
return x - (y / ((z - a) / (t - z)));
}
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) / (t - z)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (y / ((z - a) / (t - z)));
}
def code(x, y, z, t, a): return x - (y / ((z - a) / (t - z)))
function code(x, y, z, t, a) return Float64(x - Float64(y / Float64(Float64(z - a) / Float64(t - z)))) end
function tmp = code(x, y, z, t, a) tmp = x - (y / ((z - a) / (t - z))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(y / N[(N[(z - a), $MachinePrecision] / N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{\frac{z - a}{t - z}}
\end{array}
Initial program 96.9%
clear-num96.8%
un-div-inv97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5000000000000.0) (not (<= z 1.25e-15))) (+ x (/ y (/ (- z a) z))) (- x (* t (/ y (- z a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5000000000000.0) || !(z <= 1.25e-15)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - (t * (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 <= (-5000000000000.0d0)) .or. (.not. (z <= 1.25d-15))) then
tmp = x + (y / ((z - a) / z))
else
tmp = x - (t * (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 <= -5000000000000.0) || !(z <= 1.25e-15)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x - (t * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5000000000000.0) or not (z <= 1.25e-15): tmp = x + (y / ((z - a) / z)) else: tmp = x - (t * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5000000000000.0) || !(z <= 1.25e-15)) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); else tmp = Float64(x - Float64(t * Float64(y / Float64(z - a)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5000000000000.0) || ~((z <= 1.25e-15))) tmp = x + (y / ((z - a) / z)); else tmp = x - (t * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5000000000000.0], N[Not[LessEqual[z, 1.25e-15]], $MachinePrecision]], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x - N[(t * N[(y / N[(z - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5000000000000 \lor \neg \left(z \leq 1.25 \cdot 10^{-15}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x - t \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -5e12 or 1.25e-15 < z Initial program 99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 87.1%
if -5e12 < z < 1.25e-15Initial program 94.1%
Taylor expanded in t around inf 91.1%
mul-1-neg91.1%
associate-/l*90.5%
Simplified90.5%
Final simplification88.8%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1080000000000.0) (not (<= z 7e-16))) (+ x (/ y (/ (- z a) z))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1080000000000.0) || !(z <= 7e-16)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1080000000000.0d0)) .or. (.not. (z <= 7d-16))) then
tmp = x + (y / ((z - a) / z))
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1080000000000.0) || !(z <= 7e-16)) {
tmp = x + (y / ((z - a) / z));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1080000000000.0) or not (z <= 7e-16): tmp = x + (y / ((z - a) / z)) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1080000000000.0) || !(z <= 7e-16)) tmp = Float64(x + Float64(y / Float64(Float64(z - a) / z))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1080000000000.0) || ~((z <= 7e-16))) tmp = x + (y / ((z - a) / z)); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1080000000000.0], N[Not[LessEqual[z, 7e-16]], $MachinePrecision]], N[(x + N[(y / N[(N[(z - a), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1080000000000 \lor \neg \left(z \leq 7 \cdot 10^{-16}\right):\\
\;\;\;\;x + \frac{y}{\frac{z - a}{z}}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -1.08e12 or 7.00000000000000035e-16 < z Initial program 99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 87.1%
if -1.08e12 < z < 7.00000000000000035e-16Initial program 94.1%
Taylor expanded in t around inf 91.1%
associate-*r/91.1%
mul-1-neg91.1%
distribute-lft-neg-out91.1%
*-commutative91.1%
*-lft-identity91.1%
times-frac88.2%
/-rgt-identity88.2%
distribute-neg-frac88.2%
distribute-neg-frac288.2%
neg-sub088.2%
sub-neg88.2%
+-commutative88.2%
associate--r+88.2%
neg-sub088.2%
remove-double-neg88.2%
Simplified88.2%
Final simplification87.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.86e+58) (not (<= z 1.05e-34))) (+ x (* y (/ (- z t) z))) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.86e+58) || !(z <= 1.05e-34)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-1.86d+58)) .or. (.not. (z <= 1.05d-34))) then
tmp = x + (y * ((z - t) / z))
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.86e+58) || !(z <= 1.05e-34)) {
tmp = x + (y * ((z - t) / z));
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.86e+58) or not (z <= 1.05e-34): tmp = x + (y * ((z - t) / z)) else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.86e+58) || !(z <= 1.05e-34)) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.86e+58) || ~((z <= 1.05e-34))) tmp = x + (y * ((z - t) / z)); else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.86e+58], N[Not[LessEqual[z, 1.05e-34]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.86 \cdot 10^{+58} \lor \neg \left(z \leq 1.05 \cdot 10^{-34}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -1.86000000000000001e58 or 1.05e-34 < z Initial program 99.9%
Taylor expanded in a around 0 85.8%
if -1.86000000000000001e58 < z < 1.05e-34Initial program 94.4%
Taylor expanded in t around inf 88.3%
associate-*r/88.3%
mul-1-neg88.3%
distribute-lft-neg-out88.3%
*-commutative88.3%
*-lft-identity88.3%
times-frac86.3%
/-rgt-identity86.3%
distribute-neg-frac86.3%
distribute-neg-frac286.3%
neg-sub086.3%
sub-neg86.3%
+-commutative86.3%
associate--r+86.3%
neg-sub086.3%
remove-double-neg86.3%
Simplified86.3%
Final simplification86.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -3.55e+72) (not (<= z 3.6e+118))) (+ x y) (+ x (* y (/ t (- a z))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.55e+72) || !(z <= 3.6e+118)) {
tmp = x + y;
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: tmp
if ((z <= (-3.55d+72)) .or. (.not. (z <= 3.6d+118))) then
tmp = x + y
else
tmp = x + (y * (t / (a - z)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -3.55e+72) || !(z <= 3.6e+118)) {
tmp = x + y;
} else {
tmp = x + (y * (t / (a - z)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -3.55e+72) or not (z <= 3.6e+118): tmp = x + y else: tmp = x + (y * (t / (a - z))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -3.55e+72) || !(z <= 3.6e+118)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -3.55e+72) || ~((z <= 3.6e+118))) tmp = x + y; else tmp = x + (y * (t / (a - z))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -3.55e+72], N[Not[LessEqual[z, 3.6e+118]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.55 \cdot 10^{+72} \lor \neg \left(z \leq 3.6 \cdot 10^{+118}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\end{array}
\end{array}
if z < -3.5499999999999996e72 or 3.6e118 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 76.8%
+-commutative76.8%
Simplified76.8%
if -3.5499999999999996e72 < z < 3.6e118Initial program 95.4%
Taylor expanded in t around inf 85.8%
associate-*r/85.8%
mul-1-neg85.8%
distribute-lft-neg-out85.8%
*-commutative85.8%
*-lft-identity85.8%
times-frac84.7%
/-rgt-identity84.7%
distribute-neg-frac84.7%
distribute-neg-frac284.7%
neg-sub084.7%
sub-neg84.7%
+-commutative84.7%
associate--r+84.7%
neg-sub084.7%
remove-double-neg84.7%
Simplified84.7%
Final simplification82.1%
(FPCore (x y z t a) :precision binary64 (if (<= z -2.4e+54) (+ x (* y (/ (- z t) z))) (if (<= z 9.8e-14) (+ x (* y (/ t (- a z)))) (+ x (* z (/ y (- z a)))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.4e+54) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 9.8e-14) {
tmp = x + (y * (t / (a - z)));
} 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.4d+54)) then
tmp = x + (y * ((z - t) / z))
else if (z <= 9.8d-14) then
tmp = x + (y * (t / (a - z)))
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.4e+54) {
tmp = x + (y * ((z - t) / z));
} else if (z <= 9.8e-14) {
tmp = x + (y * (t / (a - z)));
} else {
tmp = x + (z * (y / (z - a)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.4e+54: tmp = x + (y * ((z - t) / z)) elif z <= 9.8e-14: tmp = x + (y * (t / (a - z))) else: tmp = x + (z * (y / (z - a))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.4e+54) tmp = Float64(x + Float64(y * Float64(Float64(z - t) / z))); elseif (z <= 9.8e-14) tmp = Float64(x + Float64(y * Float64(t / Float64(a - z)))); 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.4e+54) tmp = x + (y * ((z - t) / z)); elseif (z <= 9.8e-14) tmp = x + (y * (t / (a - z))); else tmp = x + (z * (y / (z - a))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.4e+54], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.8e-14], N[(x + N[(y * N[(t / N[(a - z), $MachinePrecision]), $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.4 \cdot 10^{+54}:\\
\;\;\;\;x + y \cdot \frac{z - t}{z}\\
\mathbf{elif}\;z \leq 9.8 \cdot 10^{-14}:\\
\;\;\;\;x + y \cdot \frac{t}{a - z}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{z - a}\\
\end{array}
\end{array}
if z < -2.39999999999999998e54Initial program 99.9%
Taylor expanded in a around 0 89.2%
if -2.39999999999999998e54 < z < 9.79999999999999989e-14Initial program 94.6%
Taylor expanded in t around inf 88.7%
associate-*r/88.7%
mul-1-neg88.7%
distribute-lft-neg-out88.7%
*-commutative88.7%
*-lft-identity88.7%
times-frac86.8%
/-rgt-identity86.8%
distribute-neg-frac86.8%
distribute-neg-frac286.8%
neg-sub086.8%
sub-neg86.8%
+-commutative86.8%
associate--r+86.8%
neg-sub086.8%
remove-double-neg86.8%
Simplified86.8%
if 9.79999999999999989e-14 < z Initial program 99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Taylor expanded in t around 0 71.2%
associate-*l/84.1%
*-commutative84.1%
Simplified84.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -4.8e-9) (not (<= z 1.9e-18))) (+ x y) (+ x (/ (* y t) a))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -4.8e-9) || !(z <= 1.9e-18)) {
tmp = x + y;
} else {
tmp = x + ((y * 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 ((z <= (-4.8d-9)) .or. (.not. (z <= 1.9d-18))) then
tmp = x + y
else
tmp = x + ((y * 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 ((z <= -4.8e-9) || !(z <= 1.9e-18)) {
tmp = x + y;
} else {
tmp = x + ((y * t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -4.8e-9) or not (z <= 1.9e-18): tmp = x + y else: tmp = x + ((y * t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -4.8e-9) || !(z <= 1.9e-18)) tmp = Float64(x + y); else tmp = Float64(x + Float64(Float64(y * t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -4.8e-9) || ~((z <= 1.9e-18))) tmp = x + y; else tmp = x + ((y * t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -4.8e-9], N[Not[LessEqual[z, 1.9e-18]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.8 \cdot 10^{-9} \lor \neg \left(z \leq 1.9 \cdot 10^{-18}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y \cdot t}{a}\\
\end{array}
\end{array}
if z < -4.8e-9 or 1.8999999999999999e-18 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 71.5%
+-commutative71.5%
Simplified71.5%
if -4.8e-9 < z < 1.8999999999999999e-18Initial program 93.9%
+-commutative93.9%
fma-define93.9%
Simplified93.9%
Taylor expanded in z around 0 80.5%
+-commutative80.5%
associate-/l*79.7%
Simplified79.7%
*-commutative79.7%
associate-*l/80.5%
Applied egg-rr80.5%
Final simplification76.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.7e+52) (not (<= z 6e-22))) (+ x y) (+ x (/ y (/ a t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.7e+52) || !(z <= 6e-22)) {
tmp = x + y;
} 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 <= (-2.7d+52)) .or. (.not. (z <= 6d-22))) then
tmp = x + y
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 <= -2.7e+52) || !(z <= 6e-22)) {
tmp = x + y;
} else {
tmp = x + (y / (a / t));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.7e+52) or not (z <= 6e-22): tmp = x + y else: tmp = x + (y / (a / t)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.7e+52) || !(z <= 6e-22)) tmp = Float64(x + y); 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 <= -2.7e+52) || ~((z <= 6e-22))) tmp = x + y; else tmp = x + (y / (a / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.7e+52], N[Not[LessEqual[z, 6e-22]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.7 \cdot 10^{+52} \lor \neg \left(z \leq 6 \cdot 10^{-22}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + \frac{y}{\frac{a}{t}}\\
\end{array}
\end{array}
if z < -2.7e52 or 5.9999999999999998e-22 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 75.2%
+-commutative75.2%
Simplified75.2%
if -2.7e52 < z < 5.9999999999999998e-22Initial program 94.5%
clear-num94.4%
un-div-inv95.8%
Applied egg-rr95.8%
Taylor expanded in z around 0 76.5%
Final simplification75.9%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -8.6e+51) (not (<= z 2.35e-18))) (+ x y) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -8.6e+51) || !(z <= 2.35e-18)) {
tmp = x + y;
} else {
tmp = x + (y * (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 ((z <= (-8.6d+51)) .or. (.not. (z <= 2.35d-18))) then
tmp = x + y
else
tmp = x + (y * (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 ((z <= -8.6e+51) || !(z <= 2.35e-18)) {
tmp = x + y;
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -8.6e+51) or not (z <= 2.35e-18): tmp = x + y else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -8.6e+51) || !(z <= 2.35e-18)) tmp = Float64(x + y); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -8.6e+51) || ~((z <= 2.35e-18))) tmp = x + y; else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -8.6e+51], N[Not[LessEqual[z, 2.35e-18]], $MachinePrecision]], N[(x + y), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -8.6 \cdot 10^{+51} \lor \neg \left(z \leq 2.35 \cdot 10^{-18}\right):\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -8.5999999999999994e51 or 2.3499999999999998e-18 < z Initial program 99.9%
+-commutative99.9%
fma-define99.9%
Simplified99.9%
Taylor expanded in z around inf 75.2%
+-commutative75.2%
Simplified75.2%
if -8.5999999999999994e51 < z < 2.3499999999999998e-18Initial program 94.5%
Taylor expanded in z around 0 75.3%
Final simplification75.2%
(FPCore (x y z t a) :precision binary64 (if (<= a -2.4e+55) x (if (<= a 3.7e+130) (+ x y) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -2.4e+55) {
tmp = x;
} else if (a <= 3.7e+130) {
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 <= (-2.4d+55)) then
tmp = x
else if (a <= 3.7d+130) 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 <= -2.4e+55) {
tmp = x;
} else if (a <= 3.7e+130) {
tmp = x + y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -2.4e+55: tmp = x elif a <= 3.7e+130: tmp = x + y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -2.4e+55) tmp = x; elseif (a <= 3.7e+130) 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 <= -2.4e+55) tmp = x; elseif (a <= 3.7e+130) tmp = x + y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -2.4e+55], x, If[LessEqual[a, 3.7e+130], N[(x + y), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+55}:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{+130}:\\
\;\;\;\;x + y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -2.3999999999999999e55 or 3.7000000000000001e130 < a Initial program 98.7%
+-commutative98.7%
fma-define98.7%
Simplified98.7%
Taylor expanded in y around 0 62.8%
if -2.3999999999999999e55 < a < 3.7000000000000001e130Initial program 96.0%
+-commutative96.0%
fma-define96.0%
Simplified96.0%
Taylor expanded in z around inf 62.7%
+-commutative62.7%
Simplified62.7%
Final simplification62.7%
(FPCore (x y z t a) :precision binary64 (if (<= x -1e-142) x (if (<= x 1.85e-178) y x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -1e-142) {
tmp = x;
} else if (x <= 1.85e-178) {
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 (x <= (-1d-142)) then
tmp = x
else if (x <= 1.85d-178) 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 (x <= -1e-142) {
tmp = x;
} else if (x <= 1.85e-178) {
tmp = y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -1e-142: tmp = x elif x <= 1.85e-178: tmp = y else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -1e-142) tmp = x; elseif (x <= 1.85e-178) tmp = y; else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -1e-142) tmp = x; elseif (x <= 1.85e-178) tmp = y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -1e-142], x, If[LessEqual[x, 1.85e-178], y, x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-142}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.85 \cdot 10^{-178}:\\
\;\;\;\;y\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1e-142 or 1.85000000000000002e-178 < x Initial program 97.4%
+-commutative97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in y around 0 63.0%
if -1e-142 < x < 1.85000000000000002e-178Initial program 95.7%
+-commutative95.7%
fma-define95.7%
Simplified95.7%
Taylor expanded in z around inf 43.5%
+-commutative43.5%
Simplified43.5%
Taylor expanded in y around inf 39.9%
(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 96.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 96.9%
+-commutative96.9%
fma-define96.9%
Simplified96.9%
Taylor expanded in y around 0 49.9%
(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 2024165
(FPCore (x y z t a)
:name "Graphics.Rendering.Plot.Render.Plot.Axis:renderAxisLine from plot-0.2.3.4, A"
:precision binary64
:alt
(! :herbie-platform default (+ x (/ y (/ (- z a) (- z t)))))
(+ x (* y (/ (- z t) (- z a)))))