
(FPCore (x y z t a) :precision binary64 (/ (- x (* y z)) (- t (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * 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)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\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 (* a z))))
double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * 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)) / (t - (a * z))
end function
public static double code(double x, double y, double z, double t, double a) {
return (x - (y * z)) / (t - (a * z));
}
def code(x, y, z, t, a): return (x - (y * z)) / (t - (a * z))
function code(x, y, z, t, a) return Float64(Float64(x - Float64(y * z)) / Float64(t - Float64(a * z))) end
function tmp = code(x, y, z, t, a) tmp = (x - (y * z)) / (t - (a * z)); end
code[x_, y_, z_, t_, a_] := N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - y \cdot z}{t - a \cdot z}
\end{array}
(FPCore (x y z t a) :precision binary64 (if (or (<= z -7.8e+82) (not (<= z 1.55e+174))) (/ (- y (/ x z)) a) (/ (- x (* z y)) (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -7.8e+82) || !(z <= 1.55e+174)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (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 <= (-7.8d+82)) .or. (.not. (z <= 1.55d+174))) then
tmp = (y - (x / z)) / a
else
tmp = (x - (z * y)) / (t - (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 <= -7.8e+82) || !(z <= 1.55e+174)) {
tmp = (y - (x / z)) / a;
} else {
tmp = (x - (z * y)) / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -7.8e+82) or not (z <= 1.55e+174): tmp = (y - (x / z)) / a else: tmp = (x - (z * y)) / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -7.8e+82) || !(z <= 1.55e+174)) tmp = Float64(Float64(y - Float64(x / z)) / a); else tmp = Float64(Float64(x - Float64(z * y)) / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -7.8e+82) || ~((z <= 1.55e+174))) tmp = (y - (x / z)) / a; else tmp = (x - (z * y)) / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -7.8e+82], N[Not[LessEqual[z, 1.55e+174]], $MachinePrecision]], N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.8 \cdot 10^{+82} \lor \neg \left(z \leq 1.55 \cdot 10^{+174}\right):\\
\;\;\;\;\frac{y - \frac{x}{z}}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - z \cdot y}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -7.79999999999999951e82 or 1.55e174 < z Initial program 50.2%
*-commutative50.2%
Simplified50.2%
Taylor expanded in t around 0 44.2%
associate-*r/44.2%
neg-mul-144.2%
sub-neg44.2%
distribute-rgt-neg-out44.2%
+-commutative44.2%
distribute-neg-in44.2%
distribute-rgt-neg-out44.2%
remove-double-neg44.2%
sub-neg44.2%
*-commutative44.2%
Simplified44.2%
associate-/r*61.1%
div-inv61.1%
*-commutative61.1%
Applied egg-rr61.1%
Taylor expanded in z around 0 83.0%
*-commutative83.0%
associate-/r*87.9%
associate-*r/87.9%
*-rgt-identity87.9%
*-commutative87.9%
metadata-eval87.9%
cancel-sign-sub-inv87.9%
associate-*r/87.9%
div-sub87.9%
cancel-sign-sub-inv87.9%
metadata-eval87.9%
*-lft-identity87.9%
+-commutative87.9%
neg-mul-187.9%
unsub-neg87.9%
Simplified87.9%
if -7.79999999999999951e82 < z < 1.55e174Initial program 96.1%
Final simplification93.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- y (/ x z)) a)) (t_2 (- t (* z a))))
(if (<= z -3.1e-32)
t_1
(if (<= z 2.3e-283)
(/ (- x (* z y)) t)
(if (<= z 3.4e+16)
(/ x t_2)
(if (<= z 1.05e+62) (* z (/ (- y) t_2)) t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = t - (z * a);
double tmp;
if (z <= -3.1e-32) {
tmp = t_1;
} else if (z <= 2.3e-283) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.4e+16) {
tmp = x / t_2;
} else if (z <= 1.05e+62) {
tmp = z * (-y / t_2);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (y - (x / z)) / a
t_2 = t - (z * a)
if (z <= (-3.1d-32)) then
tmp = t_1
else if (z <= 2.3d-283) then
tmp = (x - (z * y)) / t
else if (z <= 3.4d+16) then
tmp = x / t_2
else if (z <= 1.05d+62) then
tmp = z * (-y / t_2)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (y - (x / z)) / a;
double t_2 = t - (z * a);
double tmp;
if (z <= -3.1e-32) {
tmp = t_1;
} else if (z <= 2.3e-283) {
tmp = (x - (z * y)) / t;
} else if (z <= 3.4e+16) {
tmp = x / t_2;
} else if (z <= 1.05e+62) {
tmp = z * (-y / t_2);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y - (x / z)) / a t_2 = t - (z * a) tmp = 0 if z <= -3.1e-32: tmp = t_1 elif z <= 2.3e-283: tmp = (x - (z * y)) / t elif z <= 3.4e+16: tmp = x / t_2 elif z <= 1.05e+62: tmp = z * (-y / t_2) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y - Float64(x / z)) / a) t_2 = Float64(t - Float64(z * a)) tmp = 0.0 if (z <= -3.1e-32) tmp = t_1; elseif (z <= 2.3e-283) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 3.4e+16) tmp = Float64(x / t_2); elseif (z <= 1.05e+62) tmp = Float64(z * Float64(Float64(-y) / t_2)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y - (x / z)) / a; t_2 = t - (z * a); tmp = 0.0; if (z <= -3.1e-32) tmp = t_1; elseif (z <= 2.3e-283) tmp = (x - (z * y)) / t; elseif (z <= 3.4e+16) tmp = x / t_2; elseif (z <= 1.05e+62) tmp = z * (-y / t_2); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, Block[{t$95$2 = N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.1e-32], t$95$1, If[LessEqual[z, 2.3e-283], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 3.4e+16], N[(x / t$95$2), $MachinePrecision], If[LessEqual[z, 1.05e+62], N[(z * N[((-y) / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y - \frac{x}{z}}{a}\\
t_2 := t - z \cdot a\\
\mathbf{if}\;z \leq -3.1 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{-283}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{t_2}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+62}:\\
\;\;\;\;z \cdot \frac{-y}{t_2}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -3.10000000000000011e-32 or 1.05e62 < z Initial program 62.7%
*-commutative62.7%
Simplified62.7%
Taylor expanded in t around 0 50.4%
associate-*r/50.4%
neg-mul-150.4%
sub-neg50.4%
distribute-rgt-neg-out50.4%
+-commutative50.4%
distribute-neg-in50.4%
distribute-rgt-neg-out50.4%
remove-double-neg50.4%
sub-neg50.4%
*-commutative50.4%
Simplified50.4%
associate-/r*64.9%
div-inv64.8%
*-commutative64.8%
Applied egg-rr64.8%
Taylor expanded in z around 0 80.3%
*-commutative80.3%
associate-/r*83.6%
associate-*r/83.6%
*-rgt-identity83.6%
*-commutative83.6%
metadata-eval83.6%
cancel-sign-sub-inv83.6%
associate-*r/83.6%
div-sub83.6%
cancel-sign-sub-inv83.6%
metadata-eval83.6%
*-lft-identity83.6%
+-commutative83.6%
neg-mul-183.6%
unsub-neg83.6%
Simplified83.6%
if -3.10000000000000011e-32 < z < 2.2999999999999999e-283Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 87.1%
if 2.2999999999999999e-283 < z < 3.4e16Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.2%
*-commutative76.2%
Simplified76.2%
if 3.4e16 < z < 1.05e62Initial program 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in x around 0 66.4%
mul-1-neg66.4%
associate-/l*74.2%
associate-/r/74.0%
sub-neg74.0%
+-commutative74.0%
distribute-rgt-neg-in74.0%
fma-udef74.0%
distribute-rgt-neg-in74.0%
fma-udef74.0%
distribute-rgt-neg-in74.0%
+-commutative74.0%
sub-neg74.0%
*-commutative74.0%
Simplified74.0%
Final simplification82.1%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (- x (* z y)) t)) (t_2 (/ (- y (/ x z)) a)))
(if (<= z -1.12e-32)
t_2
(if (<= z 1e-286)
t_1
(if (<= z 4.5e-127)
(/ x (- t (* z a)))
(if (<= z 1.55e-17) t_1 t_2))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -1.12e-32) {
tmp = t_2;
} else if (z <= 1e-286) {
tmp = t_1;
} else if (z <= 4.5e-127) {
tmp = x / (t - (z * a));
} else if (z <= 1.55e-17) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = (x - (z * y)) / t
t_2 = (y - (x / z)) / a
if (z <= (-1.12d-32)) then
tmp = t_2
else if (z <= 1d-286) then
tmp = t_1
else if (z <= 4.5d-127) then
tmp = x / (t - (z * a))
else if (z <= 1.55d-17) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (x - (z * y)) / t;
double t_2 = (y - (x / z)) / a;
double tmp;
if (z <= -1.12e-32) {
tmp = t_2;
} else if (z <= 1e-286) {
tmp = t_1;
} else if (z <= 4.5e-127) {
tmp = x / (t - (z * a));
} else if (z <= 1.55e-17) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (x - (z * y)) / t t_2 = (y - (x / z)) / a tmp = 0 if z <= -1.12e-32: tmp = t_2 elif z <= 1e-286: tmp = t_1 elif z <= 4.5e-127: tmp = x / (t - (z * a)) elif z <= 1.55e-17: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(x - Float64(z * y)) / t) t_2 = Float64(Float64(y - Float64(x / z)) / a) tmp = 0.0 if (z <= -1.12e-32) tmp = t_2; elseif (z <= 1e-286) tmp = t_1; elseif (z <= 4.5e-127) tmp = Float64(x / Float64(t - Float64(z * a))); elseif (z <= 1.55e-17) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (x - (z * y)) / t; t_2 = (y - (x / z)) / a; tmp = 0.0; if (z <= -1.12e-32) tmp = t_2; elseif (z <= 1e-286) tmp = t_1; elseif (z <= 4.5e-127) tmp = x / (t - (z * a)); elseif (z <= 1.55e-17) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y - N[(x / z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[z, -1.12e-32], t$95$2, If[LessEqual[z, 1e-286], t$95$1, If[LessEqual[z, 4.5e-127], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.55e-17], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x - z \cdot y}{t}\\
t_2 := \frac{y - \frac{x}{z}}{a}\\
\mathbf{if}\;z \leq -1.12 \cdot 10^{-32}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 10^{-286}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{-127}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-17}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.12e-32 or 1.5499999999999999e-17 < z Initial program 66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in t around 0 50.3%
associate-*r/50.3%
neg-mul-150.3%
sub-neg50.3%
distribute-rgt-neg-out50.3%
+-commutative50.3%
distribute-neg-in50.3%
distribute-rgt-neg-out50.3%
remove-double-neg50.3%
sub-neg50.3%
*-commutative50.3%
Simplified50.3%
associate-/r*63.5%
div-inv63.4%
*-commutative63.4%
Applied egg-rr63.4%
Taylor expanded in z around 0 76.7%
*-commutative76.7%
associate-/r*79.6%
associate-*r/79.6%
*-rgt-identity79.6%
*-commutative79.6%
metadata-eval79.6%
cancel-sign-sub-inv79.6%
associate-*r/79.6%
div-sub79.6%
cancel-sign-sub-inv79.6%
metadata-eval79.6%
*-lft-identity79.6%
+-commutative79.6%
neg-mul-179.6%
unsub-neg79.6%
Simplified79.6%
if -1.12e-32 < z < 1.00000000000000005e-286 or 4.4999999999999999e-127 < z < 1.5499999999999999e-17Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in t around inf 80.7%
if 1.00000000000000005e-286 < z < 4.4999999999999999e-127Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 91.4%
*-commutative91.4%
Simplified91.4%
Final simplification81.5%
(FPCore (x y z t a)
:precision binary64
(if (<= z -1.15e-51)
(/ y a)
(if (<= z 4.3e-122)
(/ x t)
(if (<= z 3.3e-80)
(* y (/ z (- t)))
(if (<= z 62000000000000.0) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.15e-51) {
tmp = y / a;
} else if (z <= 4.3e-122) {
tmp = x / t;
} else if (z <= 3.3e-80) {
tmp = y * (z / -t);
} else if (z <= 62000000000000.0) {
tmp = x / t;
} else {
tmp = y / 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 <= (-1.15d-51)) then
tmp = y / a
else if (z <= 4.3d-122) then
tmp = x / t
else if (z <= 3.3d-80) then
tmp = y * (z / -t)
else if (z <= 62000000000000.0d0) then
tmp = x / t
else
tmp = y / 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 <= -1.15e-51) {
tmp = y / a;
} else if (z <= 4.3e-122) {
tmp = x / t;
} else if (z <= 3.3e-80) {
tmp = y * (z / -t);
} else if (z <= 62000000000000.0) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.15e-51: tmp = y / a elif z <= 4.3e-122: tmp = x / t elif z <= 3.3e-80: tmp = y * (z / -t) elif z <= 62000000000000.0: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.15e-51) tmp = Float64(y / a); elseif (z <= 4.3e-122) tmp = Float64(x / t); elseif (z <= 3.3e-80) tmp = Float64(y * Float64(z / Float64(-t))); elseif (z <= 62000000000000.0) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.15e-51) tmp = y / a; elseif (z <= 4.3e-122) tmp = x / t; elseif (z <= 3.3e-80) tmp = y * (z / -t); elseif (z <= 62000000000000.0) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.15e-51], N[(y / a), $MachinePrecision], If[LessEqual[z, 4.3e-122], N[(x / t), $MachinePrecision], If[LessEqual[z, 3.3e-80], N[(y * N[(z / (-t)), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 62000000000000.0], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-51}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 4.3 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\
\;\;\;\;y \cdot \frac{z}{-t}\\
\mathbf{elif}\;z \leq 62000000000000:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -1.15000000000000001e-51 or 6.2e13 < z Initial program 65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in z around inf 59.6%
if -1.15000000000000001e-51 < z < 4.30000000000000019e-122 or 3.3e-80 < z < 6.2e13Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 64.8%
if 4.30000000000000019e-122 < z < 3.3e-80Initial program 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in t around inf 61.9%
Taylor expanded in x around 0 55.1%
associate-*r/55.1%
mul-1-neg55.1%
*-commutative55.1%
distribute-rgt-neg-in55.1%
Simplified55.1%
frac-2neg55.1%
div-inv55.2%
distribute-rgt-neg-out55.2%
remove-double-neg55.2%
*-commutative55.2%
Applied egg-rr55.2%
associate-*l*49.8%
associate-*r/49.9%
*-rgt-identity49.9%
Simplified49.9%
Final simplification61.3%
(FPCore (x y z t a)
:precision binary64
(if (<= z -2.55e-51)
(/ y a)
(if (<= z 9e-122)
(/ x t)
(if (<= z 3.3e-80)
(/ (* z (- y)) t)
(if (<= z 1.9e+16) (/ x t) (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -2.55e-51) {
tmp = y / a;
} else if (z <= 9e-122) {
tmp = x / t;
} else if (z <= 3.3e-80) {
tmp = (z * -y) / t;
} else if (z <= 1.9e+16) {
tmp = x / t;
} else {
tmp = y / 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.55d-51)) then
tmp = y / a
else if (z <= 9d-122) then
tmp = x / t
else if (z <= 3.3d-80) then
tmp = (z * -y) / t
else if (z <= 1.9d+16) then
tmp = x / t
else
tmp = y / 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.55e-51) {
tmp = y / a;
} else if (z <= 9e-122) {
tmp = x / t;
} else if (z <= 3.3e-80) {
tmp = (z * -y) / t;
} else if (z <= 1.9e+16) {
tmp = x / t;
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -2.55e-51: tmp = y / a elif z <= 9e-122: tmp = x / t elif z <= 3.3e-80: tmp = (z * -y) / t elif z <= 1.9e+16: tmp = x / t else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -2.55e-51) tmp = Float64(y / a); elseif (z <= 9e-122) tmp = Float64(x / t); elseif (z <= 3.3e-80) tmp = Float64(Float64(z * Float64(-y)) / t); elseif (z <= 1.9e+16) tmp = Float64(x / t); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -2.55e-51) tmp = y / a; elseif (z <= 9e-122) tmp = x / t; elseif (z <= 3.3e-80) tmp = (z * -y) / t; elseif (z <= 1.9e+16) tmp = x / t; else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -2.55e-51], N[(y / a), $MachinePrecision], If[LessEqual[z, 9e-122], N[(x / t), $MachinePrecision], If[LessEqual[z, 3.3e-80], N[(N[(z * (-y)), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 1.9e+16], N[(x / t), $MachinePrecision], N[(y / a), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{-51}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-122}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-80}:\\
\;\;\;\;\frac{z \cdot \left(-y\right)}{t}\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{+16}:\\
\;\;\;\;\frac{x}{t}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -2.5499999999999999e-51 or 1.9e16 < z Initial program 65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in z around inf 59.6%
if -2.5499999999999999e-51 < z < 8.99999999999999959e-122 or 3.3e-80 < z < 1.9e16Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in z around 0 64.8%
if 8.99999999999999959e-122 < z < 3.3e-80Initial program 99.5%
*-commutative99.5%
Simplified99.5%
Taylor expanded in t around inf 61.9%
Taylor expanded in x around 0 55.1%
associate-*r/55.1%
mul-1-neg55.1%
*-commutative55.1%
distribute-rgt-neg-in55.1%
Simplified55.1%
Final simplification61.6%
(FPCore (x y z t a)
:precision binary64
(if (<= z -5e-7)
(/ y a)
(if (<= z 2.8e-282)
(/ (- x (* z y)) t)
(if (<= z 9200000000.0) (/ x (- t (* z a))) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -5e-7) {
tmp = y / a;
} else if (z <= 2.8e-282) {
tmp = (x - (z * y)) / t;
} else if (z <= 9200000000.0) {
tmp = x / (t - (z * a));
} else {
tmp = y / 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 <= (-5d-7)) then
tmp = y / a
else if (z <= 2.8d-282) then
tmp = (x - (z * y)) / t
else if (z <= 9200000000.0d0) then
tmp = x / (t - (z * a))
else
tmp = y / 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 <= -5e-7) {
tmp = y / a;
} else if (z <= 2.8e-282) {
tmp = (x - (z * y)) / t;
} else if (z <= 9200000000.0) {
tmp = x / (t - (z * a));
} else {
tmp = y / a;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -5e-7: tmp = y / a elif z <= 2.8e-282: tmp = (x - (z * y)) / t elif z <= 9200000000.0: tmp = x / (t - (z * a)) else: tmp = y / a return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -5e-7) tmp = Float64(y / a); elseif (z <= 2.8e-282) tmp = Float64(Float64(x - Float64(z * y)) / t); elseif (z <= 9200000000.0) tmp = Float64(x / Float64(t - Float64(z * a))); else tmp = Float64(y / a); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -5e-7) tmp = y / a; elseif (z <= 2.8e-282) tmp = (x - (z * y)) / t; elseif (z <= 9200000000.0) tmp = x / (t - (z * a)); else tmp = y / a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -5e-7], N[(y / a), $MachinePrecision], If[LessEqual[z, 2.8e-282], N[(N[(x - N[(z * y), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision], If[LessEqual[z, 9200000000.0], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y / a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-7}:\\
\;\;\;\;\frac{y}{a}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-282}:\\
\;\;\;\;\frac{x - z \cdot y}{t}\\
\mathbf{elif}\;z \leq 9200000000:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a}\\
\end{array}
\end{array}
if z < -4.99999999999999977e-7 or 9.2e9 < z Initial program 62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in z around inf 62.1%
if -4.99999999999999977e-7 < z < 2.7999999999999999e-282Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around inf 82.7%
if 2.7999999999999999e-282 < z < 9.2e9Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 76.2%
*-commutative76.2%
Simplified76.2%
Final simplification71.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -5.1e-5) (not (<= z 5.8e+17))) (/ y a) (/ x (- t (* z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -5.1e-5) || !(z <= 5.8e+17)) {
tmp = y / a;
} else {
tmp = x / (t - (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 <= (-5.1d-5)) .or. (.not. (z <= 5.8d+17))) then
tmp = y / a
else
tmp = x / (t - (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 <= -5.1e-5) || !(z <= 5.8e+17)) {
tmp = y / a;
} else {
tmp = x / (t - (z * a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -5.1e-5) or not (z <= 5.8e+17): tmp = y / a else: tmp = x / (t - (z * a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -5.1e-5) || !(z <= 5.8e+17)) tmp = Float64(y / a); else tmp = Float64(x / Float64(t - Float64(z * a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -5.1e-5) || ~((z <= 5.8e+17))) tmp = y / a; else tmp = x / (t - (z * a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -5.1e-5], N[Not[LessEqual[z, 5.8e+17]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / N[(t - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.1 \cdot 10^{-5} \lor \neg \left(z \leq 5.8 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t - z \cdot a}\\
\end{array}
\end{array}
if z < -5.09999999999999996e-5 or 5.8e17 < z Initial program 62.6%
*-commutative62.6%
Simplified62.6%
Taylor expanded in z around inf 62.6%
if -5.09999999999999996e-5 < z < 5.8e17Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in x around inf 73.5%
*-commutative73.5%
Simplified73.5%
Final simplification68.3%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.5e-51) (not (<= z 7800000000000.0))) (/ y a) (/ x t)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.5e-51) || !(z <= 7800000000000.0)) {
tmp = y / a;
} else {
tmp = x / 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.5d-51)) .or. (.not. (z <= 7800000000000.0d0))) then
tmp = y / a
else
tmp = x / 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.5e-51) || !(z <= 7800000000000.0)) {
tmp = y / a;
} else {
tmp = x / t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.5e-51) or not (z <= 7800000000000.0): tmp = y / a else: tmp = x / t return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.5e-51) || !(z <= 7800000000000.0)) tmp = Float64(y / a); else tmp = Float64(x / t); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.5e-51) || ~((z <= 7800000000000.0))) tmp = y / a; else tmp = x / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.5e-51], N[Not[LessEqual[z, 7800000000000.0]], $MachinePrecision]], N[(y / a), $MachinePrecision], N[(x / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.5 \cdot 10^{-51} \lor \neg \left(z \leq 7800000000000\right):\\
\;\;\;\;\frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{t}\\
\end{array}
\end{array}
if z < -2.50000000000000002e-51 or 7.8e12 < z Initial program 65.4%
*-commutative65.4%
Simplified65.4%
Taylor expanded in z around inf 59.6%
if -2.50000000000000002e-51 < z < 7.8e12Initial program 99.8%
*-commutative99.8%
Simplified99.8%
Taylor expanded in z around 0 59.0%
Final simplification59.3%
(FPCore (x y z t a) :precision binary64 (/ x t))
double code(double x, double y, double z, double t, double a) {
return x / 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 / t
end function
public static double code(double x, double y, double z, double t, double a) {
return x / t;
}
def code(x, y, z, t, a): return x / t
function code(x, y, z, t, a) return Float64(x / t) end
function tmp = code(x, y, z, t, a) tmp = x / t; end
code[x_, y_, z_, t_, a_] := N[(x / t), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{t}
\end{array}
Initial program 82.1%
*-commutative82.1%
Simplified82.1%
Taylor expanded in z around 0 33.4%
Final simplification33.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (- t (* a z))) (t_2 (- (/ x t_1) (/ y (- (/ t z) a)))))
(if (< z -32113435955957344.0)
t_2
(if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 t_1)) t_2))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t - (a * z)
t_2 = (x / t_1) - (y / ((t / z) - a))
if (z < (-32113435955957344.0d0)) then
tmp = t_2
else if (z < 3.5139522372978296d-86) then
tmp = (x - (y * z)) * (1.0d0 / t_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t - (a * z);
double t_2 = (x / t_1) - (y / ((t / z) - a));
double tmp;
if (z < -32113435955957344.0) {
tmp = t_2;
} else if (z < 3.5139522372978296e-86) {
tmp = (x - (y * z)) * (1.0 / t_1);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t - (a * z) t_2 = (x / t_1) - (y / ((t / z) - a)) tmp = 0 if z < -32113435955957344.0: tmp = t_2 elif z < 3.5139522372978296e-86: tmp = (x - (y * z)) * (1.0 / t_1) else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t - Float64(a * z)) t_2 = Float64(Float64(x / t_1) - Float64(y / Float64(Float64(t / z) - a))) tmp = 0.0 if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = Float64(Float64(x - Float64(y * z)) * Float64(1.0 / t_1)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t - (a * z); t_2 = (x / t_1) - (y / ((t / z) - a)); tmp = 0.0; if (z < -32113435955957344.0) tmp = t_2; elseif (z < 3.5139522372978296e-86) tmp = (x - (y * z)) * (1.0 / t_1); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t - N[(a * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x / t$95$1), $MachinePrecision] - N[(y / N[(N[(t / z), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Less[z, -32113435955957344.0], t$95$2, If[Less[z, 3.5139522372978296e-86], N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] * N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t - a \cdot z\\
t_2 := \frac{x}{t_1} - \frac{y}{\frac{t}{z} - a}\\
\mathbf{if}\;z < -32113435955957344:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z < 3.5139522372978296 \cdot 10^{-86}:\\
\;\;\;\;\left(x - y \cdot z\right) \cdot \frac{1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
herbie shell --seed 2024011
(FPCore (x y z t a)
:name "Diagrams.Solve.Tridiagonal:solveTriDiagonal from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< z -32113435955957344.0) (- (/ x (- t (* a z))) (/ y (- (/ t z) a))) (if (< z 3.5139522372978296e-86) (* (- x (* y z)) (/ 1.0 (- t (* a z)))) (- (/ x (- t (* a z))) (/ y (- (/ t z) a)))))
(/ (- x (* y z)) (- t (* a z))))