
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ x (- y (* z t))))
double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / (y - (z * t))
end function
public static double code(double x, double y, double z, double t) {
return x / (y - (z * t));
}
def code(x, y, z, t): return x / (y - (z * t))
function code(x, y, z, t) return Float64(x / Float64(y - Float64(z * t))) end
function tmp = code(x, y, z, t) tmp = x / (y - (z * t)); end
code[x_, y_, z_, t_] := N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y - z \cdot t}
\end{array}
(FPCore (x y z t) :precision binary64 (if (<= (* z t) (- INFINITY)) (* (/ -1.0 t) (/ x z)) (/ x (fma (- z) t y))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = (-1.0 / t) * (x / z);
} else {
tmp = x / fma(-z, t, y);
}
return tmp;
}
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(-1.0 / t) * Float64(x / z)); else tmp = Float64(x / fma(Float64(-z), t, y)); end return tmp end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(N[(-1.0 / t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[((-z) * t + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(-z, t, y\right)}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 75.9%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
associate-/r*99.9%
distribute-neg-frac299.9%
Simplified99.9%
div-inv99.9%
associate-/l*78.8%
add-sqr-sqrt47.3%
sqrt-unprod75.8%
sqr-neg75.8%
sqrt-unprod28.5%
add-sqr-sqrt75.8%
Applied egg-rr75.8%
associate-/l/75.9%
associate-*r/75.9%
*-commutative75.9%
*-commutative75.9%
*-lft-identity75.9%
Simplified75.9%
add-sqr-sqrt75.9%
sqrt-unprod75.9%
sqr-neg75.9%
distribute-frac-neg75.9%
distribute-frac-neg75.9%
sqrt-unprod75.9%
add-sqr-sqrt75.9%
neg-mul-175.9%
times-frac99.9%
Applied egg-rr99.9%
if -inf.0 < (*.f64 z t) Initial program 98.3%
sub-neg98.3%
+-commutative98.3%
distribute-lft-neg-in98.3%
fma-define98.4%
Applied egg-rr98.4%
Final simplification98.5%
(FPCore (x y z t)
:precision binary64
(if (<= y -9.2e+59)
(/ 1.0 (/ y x))
(if (or (<= y 1.35e-73) (and (not (<= y 1.12e-29)) (<= y 1.2e+26)))
(/ x (* t (- z)))
(/ x y))))
double code(double x, double y, double z, double t) {
double tmp;
if (y <= -9.2e+59) {
tmp = 1.0 / (y / x);
} else if ((y <= 1.35e-73) || (!(y <= 1.12e-29) && (y <= 1.2e+26))) {
tmp = x / (t * -z);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (y <= (-9.2d+59)) then
tmp = 1.0d0 / (y / x)
else if ((y <= 1.35d-73) .or. (.not. (y <= 1.12d-29)) .and. (y <= 1.2d+26)) then
tmp = x / (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 tmp;
if (y <= -9.2e+59) {
tmp = 1.0 / (y / x);
} else if ((y <= 1.35e-73) || (!(y <= 1.12e-29) && (y <= 1.2e+26))) {
tmp = x / (t * -z);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if y <= -9.2e+59: tmp = 1.0 / (y / x) elif (y <= 1.35e-73) or (not (y <= 1.12e-29) and (y <= 1.2e+26)): tmp = x / (t * -z) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if (y <= -9.2e+59) tmp = Float64(1.0 / Float64(y / x)); elseif ((y <= 1.35e-73) || (!(y <= 1.12e-29) && (y <= 1.2e+26))) tmp = Float64(x / Float64(t * Float64(-z))); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (y <= -9.2e+59) tmp = 1.0 / (y / x); elseif ((y <= 1.35e-73) || (~((y <= 1.12e-29)) && (y <= 1.2e+26))) tmp = x / (t * -z); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[y, -9.2e+59], N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, 1.35e-73], And[N[Not[LessEqual[y, 1.12e-29]], $MachinePrecision], LessEqual[y, 1.2e+26]]], N[(x / N[(t * (-z)), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.2 \cdot 10^{+59}:\\
\;\;\;\;\frac{1}{\frac{y}{x}}\\
\mathbf{elif}\;y \leq 1.35 \cdot 10^{-73} \lor \neg \left(y \leq 1.12 \cdot 10^{-29}\right) \land y \leq 1.2 \cdot 10^{+26}:\\
\;\;\;\;\frac{x}{t \cdot \left(-z\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if y < -9.20000000000000032e59Initial program 93.2%
clear-num91.9%
inv-pow91.9%
Applied egg-rr91.9%
Taylor expanded in y around 0 89.2%
unpow-189.2%
+-commutative89.2%
mul-1-neg89.2%
unsub-neg89.2%
div-sub91.9%
*-commutative91.9%
Applied egg-rr91.9%
Taylor expanded in y around inf 83.5%
if -9.20000000000000032e59 < y < 1.34999999999999997e-73 or 1.11999999999999995e-29 < y < 1.20000000000000002e26Initial program 97.8%
Taylor expanded in y around 0 76.6%
associate-*r/76.6%
neg-mul-176.6%
Simplified76.6%
if 1.34999999999999997e-73 < y < 1.11999999999999995e-29 or 1.20000000000000002e26 < y Initial program 95.1%
Taylor expanded in y around inf 83.5%
Final simplification79.7%
(FPCore (x y z t) :precision binary64 (if (or (<= t -5.5e-137) (not (<= t 1.08e+71))) (/ (/ x t) (- z)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -5.5e-137) || !(t <= 1.08e+71)) {
tmp = (x / t) / -z;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((t <= (-5.5d-137)) .or. (.not. (t <= 1.08d+71))) then
tmp = (x / 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 tmp;
if ((t <= -5.5e-137) || !(t <= 1.08e+71)) {
tmp = (x / t) / -z;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -5.5e-137) or not (t <= 1.08e+71): tmp = (x / t) / -z else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -5.5e-137) || !(t <= 1.08e+71)) tmp = Float64(Float64(x / t) / Float64(-z)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -5.5e-137) || ~((t <= 1.08e+71))) tmp = (x / t) / -z; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -5.5e-137], N[Not[LessEqual[t, 1.08e+71]], $MachinePrecision]], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -5.5 \cdot 10^{-137} \lor \neg \left(t \leq 1.08 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if t < -5.5000000000000003e-137 or 1.08e71 < t Initial program 93.4%
Taylor expanded in y around 0 67.8%
mul-1-neg67.8%
associate-/r*75.3%
distribute-neg-frac275.3%
Simplified75.3%
if -5.5000000000000003e-137 < t < 1.08e71Initial program 99.9%
Taylor expanded in y around inf 72.2%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (<= t -9e-130) (* (/ x t) (/ -1.0 z)) (if (<= t 3.4e+69) (/ x y) (/ (/ x t) (- z)))))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-130) {
tmp = (x / t) * (-1.0 / z);
} else if (t <= 3.4e+69) {
tmp = x / y;
} else {
tmp = (x / t) / -z;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (t <= (-9d-130)) then
tmp = (x / t) * ((-1.0d0) / z)
else if (t <= 3.4d+69) then
tmp = x / y
else
tmp = (x / t) / -z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -9e-130) {
tmp = (x / t) * (-1.0 / z);
} else if (t <= 3.4e+69) {
tmp = x / y;
} else {
tmp = (x / t) / -z;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -9e-130: tmp = (x / t) * (-1.0 / z) elif t <= 3.4e+69: tmp = x / y else: tmp = (x / t) / -z return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -9e-130) tmp = Float64(Float64(x / t) * Float64(-1.0 / z)); elseif (t <= 3.4e+69) tmp = Float64(x / y); else tmp = Float64(Float64(x / t) / Float64(-z)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -9e-130) tmp = (x / t) * (-1.0 / z); elseif (t <= 3.4e+69) tmp = x / y; else tmp = (x / t) / -z; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -9e-130], N[(N[(x / t), $MachinePrecision] * N[(-1.0 / z), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.4e+69], N[(x / y), $MachinePrecision], N[(N[(x / t), $MachinePrecision] / (-z)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9 \cdot 10^{-130}:\\
\;\;\;\;\frac{x}{t} \cdot \frac{-1}{z}\\
\mathbf{elif}\;t \leq 3.4 \cdot 10^{+69}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{t}}{-z}\\
\end{array}
\end{array}
if t < -9e-130Initial program 91.1%
Taylor expanded in y around 0 61.8%
mul-1-neg61.8%
associate-/r*67.8%
distribute-neg-frac267.8%
Simplified67.8%
div-inv67.8%
frac-2neg67.8%
metadata-eval67.8%
remove-double-neg67.8%
Applied egg-rr67.8%
if -9e-130 < t < 3.39999999999999986e69Initial program 99.9%
Taylor expanded in y around inf 72.2%
if 3.39999999999999986e69 < t Initial program 96.9%
Taylor expanded in y around 0 76.6%
mul-1-neg76.6%
associate-/r*86.4%
distribute-neg-frac286.4%
Simplified86.4%
Final simplification73.9%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.6e+171) (not (<= z 1.9e+55))) (/ x (* z t)) (/ x y)))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+171) || !(z <= 1.9e+55)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if ((z <= (-7.6d+171)) .or. (.not. (z <= 1.9d+55))) then
tmp = x / (z * t)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.6e+171) || !(z <= 1.9e+55)) {
tmp = x / (z * t);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.6e+171) or not (z <= 1.9e+55): tmp = x / (z * t) else: tmp = x / y return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.6e+171) || !(z <= 1.9e+55)) tmp = Float64(x / Float64(z * t)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.6e+171) || ~((z <= 1.9e+55))) tmp = x / (z * t); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.6e+171], N[Not[LessEqual[z, 1.9e+55]], $MachinePrecision]], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.6 \cdot 10^{+171} \lor \neg \left(z \leq 1.9 \cdot 10^{+55}\right):\\
\;\;\;\;\frac{x}{z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if z < -7.6000000000000004e171 or 1.9e55 < z Initial program 92.2%
Taylor expanded in y around 0 68.5%
mul-1-neg68.5%
associate-/r*73.1%
distribute-neg-frac273.1%
Simplified73.1%
div-inv73.1%
associate-/l*69.2%
add-sqr-sqrt25.0%
sqrt-unprod45.2%
sqr-neg45.2%
sqrt-unprod23.3%
add-sqr-sqrt43.1%
Applied egg-rr43.1%
associate-/l/43.1%
associate-*r/43.1%
*-commutative43.1%
*-commutative43.1%
*-lft-identity43.1%
Simplified43.1%
if -7.6000000000000004e171 < z < 1.9e55Initial program 98.7%
Taylor expanded in y around inf 62.3%
Final simplification55.3%
(FPCore (x y z t) :precision binary64 (if (<= z -7e+169) (/ (/ x z) t) (if (<= z 1.15e+55) (/ x y) (/ x (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+169) {
tmp = (x / z) / t;
} else if (z <= 1.15e+55) {
tmp = x / y;
} else {
tmp = x / (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: tmp
if (z <= (-7d+169)) then
tmp = (x / z) / t
else if (z <= 1.15d+55) then
tmp = x / y
else
tmp = x / (z * t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (z <= -7e+169) {
tmp = (x / z) / t;
} else if (z <= 1.15e+55) {
tmp = x / y;
} else {
tmp = x / (z * t);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if z <= -7e+169: tmp = (x / z) / t elif z <= 1.15e+55: tmp = x / y else: tmp = x / (z * t) return tmp
function code(x, y, z, t) tmp = 0.0 if (z <= -7e+169) tmp = Float64(Float64(x / z) / t); elseif (z <= 1.15e+55) tmp = Float64(x / y); else tmp = Float64(x / Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (z <= -7e+169) tmp = (x / z) / t; elseif (z <= 1.15e+55) tmp = x / y; else tmp = x / (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[z, -7e+169], N[(N[(x / z), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.15e+55], N[(x / y), $MachinePrecision], N[(x / N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7 \cdot 10^{+169}:\\
\;\;\;\;\frac{\frac{x}{z}}{t}\\
\mathbf{elif}\;z \leq 1.15 \cdot 10^{+55}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z \cdot t}\\
\end{array}
\end{array}
if z < -7.00000000000000038e169Initial program 93.2%
Taylor expanded in y around 0 75.0%
mul-1-neg75.0%
associate-/r*78.6%
distribute-neg-frac278.6%
Simplified78.6%
div-inv78.6%
associate-/l*75.0%
add-sqr-sqrt74.9%
sqrt-unprod62.2%
sqr-neg62.2%
sqrt-unprod0.0%
add-sqr-sqrt59.3%
Applied egg-rr59.3%
associate-/l/59.3%
associate-*r/59.3%
*-commutative59.3%
*-commutative59.3%
*-lft-identity59.3%
Simplified59.3%
associate-/r*59.1%
div-inv59.1%
div-inv59.1%
associate-*r*59.3%
associate-*l/59.3%
*-un-lft-identity59.3%
Applied egg-rr59.3%
associate-*r/62.2%
*-commutative62.2%
associate-*l/62.2%
associate-*r/62.2%
*-lft-identity62.2%
Simplified62.2%
if -7.00000000000000038e169 < z < 1.14999999999999994e55Initial program 98.7%
Taylor expanded in y around inf 62.3%
if 1.14999999999999994e55 < z Initial program 91.7%
Taylor expanded in y around 0 65.2%
mul-1-neg65.2%
associate-/r*70.3%
distribute-neg-frac270.3%
Simplified70.3%
div-inv70.3%
associate-/l*66.3%
add-sqr-sqrt0.0%
sqrt-unprod36.7%
sqr-neg36.7%
sqrt-unprod35.0%
add-sqr-sqrt35.0%
Applied egg-rr35.0%
associate-/l/35.0%
associate-*r/35.0%
*-commutative35.0%
*-commutative35.0%
*-lft-identity35.0%
Simplified35.0%
Final simplification55.7%
(FPCore (x y z t) :precision binary64 (if (<= (* z t) (- INFINITY)) (* (/ -1.0 t) (/ x z)) (/ x (- y (* z t)))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -((double) INFINITY)) {
tmp = (-1.0 / t) * (x / z);
} else {
tmp = x / (y - (z * t));
}
return tmp;
}
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z * t) <= -Double.POSITIVE_INFINITY) {
tmp = (-1.0 / t) * (x / z);
} else {
tmp = x / (y - (z * t));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z * t) <= -math.inf: tmp = (-1.0 / t) * (x / z) else: tmp = x / (y - (z * t)) return tmp
function code(x, y, z, t) tmp = 0.0 if (Float64(z * t) <= Float64(-Inf)) tmp = Float64(Float64(-1.0 / t) * Float64(x / z)); else tmp = Float64(x / Float64(y - Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z * t) <= -Inf) tmp = (-1.0 / t) * (x / z); else tmp = x / (y - (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[N[(z * t), $MachinePrecision], (-Infinity)], N[(N[(-1.0 / t), $MachinePrecision] * N[(x / z), $MachinePrecision]), $MachinePrecision], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -\infty:\\
\;\;\;\;\frac{-1}{t} \cdot \frac{x}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\end{array}
\end{array}
if (*.f64 z t) < -inf.0Initial program 75.9%
Taylor expanded in y around 0 75.9%
mul-1-neg75.9%
associate-/r*99.9%
distribute-neg-frac299.9%
Simplified99.9%
div-inv99.9%
associate-/l*78.8%
add-sqr-sqrt47.3%
sqrt-unprod75.8%
sqr-neg75.8%
sqrt-unprod28.5%
add-sqr-sqrt75.8%
Applied egg-rr75.8%
associate-/l/75.9%
associate-*r/75.9%
*-commutative75.9%
*-commutative75.9%
*-lft-identity75.9%
Simplified75.9%
add-sqr-sqrt75.9%
sqrt-unprod75.9%
sqr-neg75.9%
distribute-frac-neg75.9%
distribute-frac-neg75.9%
sqrt-unprod75.9%
add-sqr-sqrt75.9%
neg-mul-175.9%
times-frac99.9%
Applied egg-rr99.9%
if -inf.0 < (*.f64 z t) Initial program 98.3%
Final simplification98.5%
(FPCore (x y z t) :precision binary64 (/ 1.0 (/ y x)))
double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = 1.0d0 / (y / x)
end function
public static double code(double x, double y, double z, double t) {
return 1.0 / (y / x);
}
def code(x, y, z, t): return 1.0 / (y / x)
function code(x, y, z, t) return Float64(1.0 / Float64(y / x)) end
function tmp = code(x, y, z, t) tmp = 1.0 / (y / x); end
code[x_, y_, z_, t_] := N[(1.0 / N[(y / x), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{1}{\frac{y}{x}}
\end{array}
Initial program 96.3%
clear-num95.8%
inv-pow95.8%
Applied egg-rr95.8%
Taylor expanded in y around 0 92.3%
unpow-192.3%
+-commutative92.3%
mul-1-neg92.3%
unsub-neg92.3%
div-sub95.8%
*-commutative95.8%
Applied egg-rr95.8%
Taylor expanded in y around inf 51.9%
Final simplification51.9%
(FPCore (x y z t) :precision binary64 (/ x y))
double code(double x, double y, double z, double t) {
return x / y;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
code = x / y
end function
public static double code(double x, double y, double z, double t) {
return x / y;
}
def code(x, y, z, t): return x / y
function code(x, y, z, t) return Float64(x / y) end
function tmp = code(x, y, z, t) tmp = x / y; end
code[x_, y_, z_, t_] := N[(x / y), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{y}
\end{array}
Initial program 96.3%
Taylor expanded in y around inf 51.8%
Final simplification51.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(if (< x -1.618195973607049e+50)
t_1
(if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) t_1))))
double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8) :: t_1
real(8) :: tmp
t_1 = 1.0d0 / ((y / x) - ((z / x) * t))
if (x < (-1.618195973607049d+50)) then
tmp = t_1
else if (x < 2.1378306434876444d+131) then
tmp = x / (y - (z * t))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = 1.0 / ((y / x) - ((z / x) * t));
double tmp;
if (x < -1.618195973607049e+50) {
tmp = t_1;
} else if (x < 2.1378306434876444e+131) {
tmp = x / (y - (z * t));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = 1.0 / ((y / x) - ((z / x) * t)) tmp = 0 if x < -1.618195973607049e+50: tmp = t_1 elif x < 2.1378306434876444e+131: tmp = x / (y - (z * t)) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(1.0 / Float64(Float64(y / x) - Float64(Float64(z / x) * t))) tmp = 0.0 if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = Float64(x / Float64(y - Float64(z * t))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = 1.0 / ((y / x) - ((z / x) * t)); tmp = 0.0; if (x < -1.618195973607049e+50) tmp = t_1; elseif (x < 2.1378306434876444e+131) tmp = x / (y - (z * t)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(1.0 / N[(N[(y / x), $MachinePrecision] - N[(N[(z / x), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[x, -1.618195973607049e+50], t$95$1, If[Less[x, 2.1378306434876444e+131], N[(x / N[(y - N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{1}{\frac{y}{x} - \frac{z}{x} \cdot t}\\
\mathbf{if}\;x < -1.618195973607049 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x < 2.1378306434876444 \cdot 10^{+131}:\\
\;\;\;\;\frac{x}{y - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
herbie shell --seed 2024044
(FPCore (x y z t)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, B"
:precision binary64
:herbie-target
(if (< x -1.618195973607049e+50) (/ 1.0 (- (/ y x) (* (/ z x) t))) (if (< x 2.1378306434876444e+131) (/ x (- y (* z t))) (/ 1.0 (- (/ y x) (* (/ z x) t)))))
(/ x (- y (* z t))))