
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 (/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
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) - x) / ((t * z) - x))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0);
}
def code(x, y, z, t): return (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(t * z) - x))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + (((y * z) - x) / ((t * z) - x))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \frac{y \cdot z - x}{t \cdot z - x}}{x + 1}
\end{array}
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ (- (* y z) x) (- (* z t) x))) (+ x 1.0))))
(if (or (<= t_1 -5e+223) (not (<= t_1 5e+304)))
(/ (+ x (/ y t)) (+ x 1.0))
t_1)))
double code(double x, double y, double z, double t) {
double t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -5e+223) || !(t_1 <= 5e+304)) {
tmp = (x + (y / t)) / (x + 1.0);
} 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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if ((t_1 <= (-5d+223)) .or. (.not. (t_1 <= 5d+304))) then
tmp = (x + (y / t)) / (x + 1.0d0)
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 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if ((t_1 <= -5e+223) || !(t_1 <= 5e+304)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0) tmp = 0 if (t_1 <= -5e+223) or not (t_1 <= 5e+304): tmp = (x + (y / t)) / (x + 1.0) else: tmp = t_1 return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(Float64(Float64(y * z) - x) / Float64(Float64(z * t) - x))) / Float64(x + 1.0)) tmp = 0.0 if ((t_1 <= -5e+223) || !(t_1 <= 5e+304)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (((y * z) - x) / ((z * t) - x))) / (x + 1.0); tmp = 0.0; if ((t_1 <= -5e+223) || ~((t_1 <= 5e+304))) tmp = (x + (y / t)) / (x + 1.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+223], N[Not[LessEqual[t$95$1, 5e+304]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y \cdot z - x}{z \cdot t - x}}{x + 1}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+223} \lor \neg \left(t_1 \leq 5 \cdot 10^{+304}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < -4.99999999999999985e223 or 4.9999999999999997e304 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 26.4%
*-commutative26.4%
Simplified26.4%
Taylor expanded in z around inf 81.1%
if -4.99999999999999985e223 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 4.9999999999999997e304Initial program 98.6%
Final simplification95.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (/ (+ x (/ y t)) (+ x 1.0))))
(if (<= t -1.1e+139)
t_1
(if (<= t -5.2e+74)
(/ (- x (/ x (- (* z t) x))) (+ x 1.0))
(if (or (<= t -1.8e-91) (not (<= t 4e-30)))
t_1
(/ (+ 1.0 (- x (/ y (/ x z)))) (+ x 1.0)))))))
double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.1e+139) {
tmp = t_1;
} else if (t <= -5.2e+74) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if ((t <= -1.8e-91) || !(t <= 4e-30)) {
tmp = t_1;
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
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 = (x + (y / t)) / (x + 1.0d0)
if (t <= (-1.1d+139)) then
tmp = t_1
else if (t <= (-5.2d+74)) then
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
else if ((t <= (-1.8d-91)) .or. (.not. (t <= 4d-30))) then
tmp = t_1
else
tmp = (1.0d0 + (x - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (x + (y / t)) / (x + 1.0);
double tmp;
if (t <= -1.1e+139) {
tmp = t_1;
} else if (t <= -5.2e+74) {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
} else if ((t <= -1.8e-91) || !(t <= 4e-30)) {
tmp = t_1;
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (x + (y / t)) / (x + 1.0) tmp = 0 if t <= -1.1e+139: tmp = t_1 elif t <= -5.2e+74: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) elif (t <= -1.8e-91) or not (t <= 4e-30): tmp = t_1 else: tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)) tmp = 0.0 if (t <= -1.1e+139) tmp = t_1; elseif (t <= -5.2e+74) tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); elseif ((t <= -1.8e-91) || !(t <= 4e-30)) tmp = t_1; else tmp = Float64(Float64(1.0 + Float64(x - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (x + (y / t)) / (x + 1.0); tmp = 0.0; if (t <= -1.1e+139) tmp = t_1; elseif (t <= -5.2e+74) tmp = (x - (x / ((z * t) - x))) / (x + 1.0); elseif ((t <= -1.8e-91) || ~((t <= 4e-30))) tmp = t_1; else tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.1e+139], t$95$1, If[LessEqual[t, -5.2e+74], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t, -1.8e-91], N[Not[LessEqual[t, 4e-30]], $MachinePrecision]], t$95$1, N[(N[(1.0 + N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{if}\;t \leq -1.1 \cdot 10^{+139}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -5.2 \cdot 10^{+74}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-91} \lor \neg \left(t \leq 4 \cdot 10^{-30}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -1.1e139 or -5.2000000000000001e74 < t < -1.8e-91 or 4e-30 < t Initial program 83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in z around inf 91.7%
if -1.1e139 < t < -5.2000000000000001e74Initial program 89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in y around 0 98.7%
+-commutative98.7%
Simplified98.7%
if -1.8e-91 < t < 4e-30Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in t around 0 76.5%
+-commutative76.5%
mul-1-neg76.5%
unsub-neg76.5%
associate-/l*81.8%
+-commutative81.8%
Simplified81.8%
Final simplification87.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.85e-93) (not (<= t 2.2e-30))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ 1.0 (- x (/ y (/ x z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.85e-93) || !(t <= 2.2e-30)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
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 <= (-2.85d-93)) .or. (.not. (t <= 2.2d-30))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (1.0d0 + (x - (y / (x / z)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.85e-93) || !(t <= 2.2e-30)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.85e-93) or not (t <= 2.2e-30): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.85e-93) || !(t <= 2.2e-30)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(1.0 + Float64(x - Float64(y / Float64(x / z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.85e-93) || ~((t <= 2.2e-30))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (1.0 + (x - (y / (x / z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.85e-93], N[Not[LessEqual[t, 2.2e-30]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + N[(x - N[(y / N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.85 \cdot 10^{-93} \lor \neg \left(t \leq 2.2 \cdot 10^{-30}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{1 + \left(x - \frac{y}{\frac{x}{z}}\right)}{x + 1}\\
\end{array}
\end{array}
if t < -2.85000000000000013e-93 or 2.19999999999999983e-30 < t Initial program 84.1%
*-commutative84.1%
Simplified84.1%
Taylor expanded in z around inf 89.1%
if -2.85000000000000013e-93 < t < 2.19999999999999983e-30Initial program 91.1%
*-commutative91.1%
Simplified91.1%
Taylor expanded in t around 0 76.5%
+-commutative76.5%
mul-1-neg76.5%
unsub-neg76.5%
associate-/l*81.8%
+-commutative81.8%
Simplified81.8%
Final simplification86.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.25e-13) (/ x (+ x 1.0)) (if (<= x 8.5e-103) (* y (/ z (- (* z t) x))) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e-13) {
tmp = x / (x + 1.0);
} else if (x <= 8.5e-103) {
tmp = y * (z / ((z * t) - x));
} else {
tmp = 1.0;
}
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 (x <= (-1.25d-13)) then
tmp = x / (x + 1.0d0)
else if (x <= 8.5d-103) then
tmp = y * (z / ((z * t) - x))
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.25e-13) {
tmp = x / (x + 1.0);
} else if (x <= 8.5e-103) {
tmp = y * (z / ((z * t) - x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.25e-13: tmp = x / (x + 1.0) elif x <= 8.5e-103: tmp = y * (z / ((z * t) - x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.25e-13) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 8.5e-103) tmp = Float64(y * Float64(z / Float64(Float64(z * t) - x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -1.25e-13) tmp = x / (x + 1.0); elseif (x <= 8.5e-103) tmp = y * (z / ((z * t) - x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.25e-13], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 8.5e-103], N[(y * N[(z / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{-13}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 8.5 \cdot 10^{-103}:\\
\;\;\;\;y \cdot \frac{z}{z \cdot t - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.24999999999999997e-13Initial program 80.9%
*-commutative80.9%
Simplified80.9%
Taylor expanded in t around inf 89.9%
+-commutative89.9%
Simplified89.9%
if -1.24999999999999997e-13 < x < 8.50000000000000032e-103Initial program 88.1%
*-commutative88.1%
Simplified88.1%
Taylor expanded in y around inf 55.9%
*-commutative55.9%
*-commutative55.9%
times-frac63.0%
+-commutative63.0%
*-commutative63.0%
Simplified63.0%
Taylor expanded in x around 0 62.8%
if 8.50000000000000032e-103 < x Initial program 89.5%
*-commutative89.5%
Simplified89.5%
Taylor expanded in z around inf 68.1%
Taylor expanded in x around inf 83.7%
Final simplification76.4%
(FPCore (x y z t) :precision binary64 (if (<= x -3.8e+45) 1.0 (if (<= x 3.7e-57) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e+45) {
tmp = 1.0;
} else if (x <= 3.7e-57) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
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 (x <= (-3.8d+45)) then
tmp = 1.0d0
else if (x <= 3.7d-57) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e+45) {
tmp = 1.0;
} else if (x <= 3.7e-57) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e+45: tmp = 1.0 elif x <= 3.7e-57: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e+45) tmp = 1.0; elseif (x <= 3.7e-57) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e+45) tmp = 1.0; elseif (x <= 3.7e-57) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e+45], 1.0, If[LessEqual[x, 3.7e-57], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{+45}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{-57}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.8000000000000002e45 or 3.7e-57 < x Initial program 85.5%
*-commutative85.5%
Simplified85.5%
Taylor expanded in z around inf 70.3%
Taylor expanded in x around inf 90.4%
if -3.8000000000000002e45 < x < 3.7e-57Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in z around inf 71.6%
Final simplification81.1%
(FPCore (x y z t) :precision binary64 (if (<= x -3.25e-136) 1.0 (if (<= x 1.25e-105) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.25e-136) {
tmp = 1.0;
} else if (x <= 1.25e-105) {
tmp = y / t;
} else {
tmp = 1.0;
}
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 (x <= (-3.25d-136)) then
tmp = 1.0d0
else if (x <= 1.25d-105) then
tmp = y / t
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.25e-136) {
tmp = 1.0;
} else if (x <= 1.25e-105) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.25e-136: tmp = 1.0 elif x <= 1.25e-105: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.25e-136) tmp = 1.0; elseif (x <= 1.25e-105) tmp = Float64(y / t); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.25e-136) tmp = 1.0; elseif (x <= 1.25e-105) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.25e-136], 1.0, If[LessEqual[x, 1.25e-105], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.25 \cdot 10^{-136}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-105}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.25000000000000005e-136 or 1.24999999999999991e-105 < x Initial program 85.6%
*-commutative85.6%
Simplified85.6%
Taylor expanded in z around inf 68.3%
Taylor expanded in x around inf 78.1%
if -3.25000000000000005e-136 < x < 1.24999999999999991e-105Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in z around inf 76.7%
Taylor expanded in x around 0 62.5%
Final simplification73.2%
(FPCore (x y z t) :precision binary64 (if (<= t -6e+178) x 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e+178) {
tmp = x;
} else {
tmp = 1.0;
}
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 <= (-6d+178)) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (t <= -6e+178) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if t <= -6e+178: tmp = x else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (t <= -6e+178) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (t <= -6e+178) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[t, -6e+178], x, 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -6 \cdot 10^{+178}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if t < -6.00000000000000031e178Initial program 91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in t around inf 90.9%
+-commutative90.9%
Simplified90.9%
Taylor expanded in x around 0 63.9%
if -6.00000000000000031e178 < t Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in z around inf 68.2%
Taylor expanded in x around inf 59.2%
Final simplification59.6%
(FPCore (x y z t) :precision binary64 1.0)
double code(double x, double y, double z, double t) {
return 1.0;
}
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
end function
public static double code(double x, double y, double z, double t) {
return 1.0;
}
def code(x, y, z, t): return 1.0
function code(x, y, z, t) return 1.0 end
function tmp = code(x, y, z, t) tmp = 1.0; end
code[x_, y_, z_, t_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.0%
*-commutative87.0%
Simplified87.0%
Taylor expanded in z around inf 70.9%
Taylor expanded in x around inf 56.7%
Final simplification56.7%
(FPCore (x y z t) :precision binary64 (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0)))
double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
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 / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0d0)
end function
public static double code(double x, double y, double z, double t) {
return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0);
}
def code(x, y, z, t): return (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0)
function code(x, y, z, t) return Float64(Float64(x + Float64(Float64(y / Float64(t - Float64(x / z))) - Float64(x / Float64(Float64(t * z) - x)))) / Float64(x + 1.0)) end
function tmp = code(x, y, z, t) tmp = (x + ((y / (t - (x / z))) - (x / ((t * z) - x)))) / (x + 1.0); end
code[x_, y_, z_, t_] := N[(N[(x + N[(N[(y / N[(t - N[(x / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x / N[(N[(t * z), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x + \left(\frac{y}{t - \frac{x}{z}} - \frac{x}{t \cdot z - x}\right)}{x + 1}
\end{array}
herbie shell --seed 2023196
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1.0))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))