
(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 9 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 (<= t_1 2e+281) t_1 (/ (+ x (/ y t)) (+ x 1.0)))))
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 <= 2e+281) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (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 * z) - x) / ((z * t) - x))) / (x + 1.0d0)
if (t_1 <= 2d+281) then
tmp = t_1
else
tmp = (x + (y / t)) / (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 * z) - x) / ((z * t) - x))) / (x + 1.0);
double tmp;
if (t_1 <= 2e+281) {
tmp = t_1;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
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 <= 2e+281: tmp = t_1 else: tmp = (x + (y / t)) / (x + 1.0) 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 <= 2e+281) tmp = t_1; else tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); 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 <= 2e+281) tmp = t_1; else tmp = (x + (y / t)) / (x + 1.0); 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[LessEqual[t$95$1, 2e+281], t$95$1, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\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 2 \cdot 10^{+281}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) < 2.0000000000000001e281Initial program 98.6%
if 2.0000000000000001e281 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x 1)) Initial program 12.3%
*-commutative12.3%
Simplified12.3%
Taylor expanded in z around inf 80.0%
Final simplification97.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.2e-151)
1.0
(if (<= x 6.2e-202)
(/ y t)
(if (<= x 1.18e-57)
1.0
(if (<= x 1.05e-20)
(* z (/ y (- (* z t) x)))
(if (<= x 4.2e+94) (- 1.0 (/ (* y z) (* x x))) 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.2e-151) {
tmp = 1.0;
} else if (x <= 6.2e-202) {
tmp = y / t;
} else if (x <= 1.18e-57) {
tmp = 1.0;
} else if (x <= 1.05e-20) {
tmp = z * (y / ((z * t) - x));
} else if (x <= 4.2e+94) {
tmp = 1.0 - ((y * z) / (x * 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 <= (-3.2d-151)) then
tmp = 1.0d0
else if (x <= 6.2d-202) then
tmp = y / t
else if (x <= 1.18d-57) then
tmp = 1.0d0
else if (x <= 1.05d-20) then
tmp = z * (y / ((z * t) - x))
else if (x <= 4.2d+94) then
tmp = 1.0d0 - ((y * z) / (x * 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 <= -3.2e-151) {
tmp = 1.0;
} else if (x <= 6.2e-202) {
tmp = y / t;
} else if (x <= 1.18e-57) {
tmp = 1.0;
} else if (x <= 1.05e-20) {
tmp = z * (y / ((z * t) - x));
} else if (x <= 4.2e+94) {
tmp = 1.0 - ((y * z) / (x * x));
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.2e-151: tmp = 1.0 elif x <= 6.2e-202: tmp = y / t elif x <= 1.18e-57: tmp = 1.0 elif x <= 1.05e-20: tmp = z * (y / ((z * t) - x)) elif x <= 4.2e+94: tmp = 1.0 - ((y * z) / (x * x)) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.2e-151) tmp = 1.0; elseif (x <= 6.2e-202) tmp = Float64(y / t); elseif (x <= 1.18e-57) tmp = 1.0; elseif (x <= 1.05e-20) tmp = Float64(z * Float64(y / Float64(Float64(z * t) - x))); elseif (x <= 4.2e+94) tmp = Float64(1.0 - Float64(Float64(y * z) / Float64(x * x))); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.2e-151) tmp = 1.0; elseif (x <= 6.2e-202) tmp = y / t; elseif (x <= 1.18e-57) tmp = 1.0; elseif (x <= 1.05e-20) tmp = z * (y / ((z * t) - x)); elseif (x <= 4.2e+94) tmp = 1.0 - ((y * z) / (x * x)); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.2e-151], 1.0, If[LessEqual[x, 6.2e-202], N[(y / t), $MachinePrecision], If[LessEqual[x, 1.18e-57], 1.0, If[LessEqual[x, 1.05e-20], N[(z * N[(y / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.2e+94], N[(1.0 - N[(N[(y * z), $MachinePrecision] / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.2 \cdot 10^{-151}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 6.2 \cdot 10^{-202}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{-57}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{-20}:\\
\;\;\;\;z \cdot \frac{y}{z \cdot t - x}\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{+94}:\\
\;\;\;\;1 - \frac{y \cdot z}{x \cdot x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -3.20000000000000021e-151 or 6.2e-202 < x < 1.18e-57 or 4.19999999999999979e94 < x Initial program 91.9%
*-commutative91.9%
Simplified91.9%
Taylor expanded in y around 0 84.6%
+-commutative84.6%
Simplified84.6%
Taylor expanded in x around inf 75.9%
if -3.20000000000000021e-151 < x < 6.2e-202Initial program 93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in z around inf 75.5%
Taylor expanded in y around inf 64.1%
Taylor expanded in x around 0 64.1%
if 1.18e-57 < x < 1.0499999999999999e-20Initial program 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in y around inf 56.5%
times-frac57.0%
+-commutative57.0%
Simplified57.0%
Taylor expanded in x around 0 57.0%
if 1.0499999999999999e-20 < x < 4.19999999999999979e94Initial program 90.1%
*-commutative90.1%
Simplified90.1%
Taylor expanded in x around -inf 60.8%
mul-1-neg60.8%
distribute-rgt-out--60.8%
unpow260.8%
Simplified60.8%
Taylor expanded in t around 0 74.5%
unpow274.5%
Simplified74.5%
Final simplification72.7%
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.08e+21) (not (<= z 1.3e-5))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (+ x (- 1.0 (/ z (/ x y)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.08e+21) || !(z <= 1.3e-5)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (z / (x / y)))) / (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 ((z <= (-1.08d+21)) .or. (.not. (z <= 1.3d-5))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x + (1.0d0 - (z / (x / y)))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -1.08e+21) || !(z <= 1.3e-5)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x + (1.0 - (z / (x / y)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -1.08e+21) or not (z <= 1.3e-5): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x + (1.0 - (z / (x / y)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -1.08e+21) || !(z <= 1.3e-5)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x + Float64(1.0 - Float64(z / Float64(x / y)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -1.08e+21) || ~((z <= 1.3e-5))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x + (1.0 - (z / (x / y)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -1.08e+21], N[Not[LessEqual[z, 1.3e-5]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x + N[(1.0 - N[(z / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.08 \cdot 10^{+21} \lor \neg \left(z \leq 1.3 \cdot 10^{-5}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x + \left(1 - \frac{z}{\frac{x}{y}}\right)}{x + 1}\\
\end{array}
\end{array}
if z < -1.08e21 or 1.29999999999999992e-5 < z Initial program 81.8%
*-commutative81.8%
Simplified81.8%
Taylor expanded in z around inf 85.3%
if -1.08e21 < z < 1.29999999999999992e-5Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in t around 0 79.2%
+-commutative79.2%
+-commutative79.2%
associate-+l+79.2%
+-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
*-commutative79.2%
associate-/l*76.7%
+-commutative76.7%
Simplified76.7%
Final simplification80.3%
(FPCore (x y z t) :precision binary64 (if (or (<= z -7.2e+90) (not (<= z 0.021))) (/ (+ x (/ y t)) (+ x 1.0)) (/ (- x (/ x (- (* z t) x))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e+90) || !(z <= 0.021)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (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 ((z <= (-7.2d+90)) .or. (.not. (z <= 0.021d0))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = (x - (x / ((z * t) - x))) / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -7.2e+90) || !(z <= 0.021)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = (x - (x / ((z * t) - x))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -7.2e+90) or not (z <= 0.021): tmp = (x + (y / t)) / (x + 1.0) else: tmp = (x - (x / ((z * t) - x))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -7.2e+90) || !(z <= 0.021)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(x / Float64(Float64(z * t) - x))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -7.2e+90) || ~((z <= 0.021))) tmp = (x + (y / t)) / (x + 1.0); else tmp = (x - (x / ((z * t) - x))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -7.2e+90], N[Not[LessEqual[z, 0.021]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(x / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.2 \cdot 10^{+90} \lor \neg \left(z \leq 0.021\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{x}{z \cdot t - x}}{x + 1}\\
\end{array}
\end{array}
if z < -7.2e90 or 0.0210000000000000013 < z Initial program 80.3%
*-commutative80.3%
Simplified80.3%
Taylor expanded in z around inf 88.4%
if -7.2e90 < z < 0.0210000000000000013Initial program 99.3%
*-commutative99.3%
Simplified99.3%
Taylor expanded in y around 0 80.5%
+-commutative80.5%
Simplified80.5%
Final simplification83.5%
(FPCore (x y z t)
:precision binary64
(if (<= x -3.8e-122)
1.0
(if (<= x 2.05e+34)
(/ (+ x (/ y t)) (+ x 1.0))
(+ 1.0 (/ (- t y) (/ (* x x) z))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-122) {
tmp = 1.0;
} else if (x <= 2.05e+34) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((t - y) / ((x * x) / 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 (x <= (-3.8d-122)) then
tmp = 1.0d0
else if (x <= 2.05d+34) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((t - y) / ((x * x) / z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if (x <= -3.8e-122) {
tmp = 1.0;
} else if (x <= 2.05e+34) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((t - y) / ((x * x) / z));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -3.8e-122: tmp = 1.0 elif x <= 2.05e+34: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((t - y) / ((x * x) / z)) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -3.8e-122) tmp = 1.0; elseif (x <= 2.05e+34) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(t - y) / Float64(Float64(x * x) / z))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -3.8e-122) tmp = 1.0; elseif (x <= 2.05e+34) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((t - y) / ((x * x) / z)); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -3.8e-122], 1.0, If[LessEqual[x, 2.05e+34], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(t - y), $MachinePrecision] / N[(N[(x * x), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.8 \cdot 10^{-122}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+34}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{t - y}{\frac{x \cdot x}{z}}\\
\end{array}
\end{array}
if x < -3.8000000000000001e-122Initial program 90.2%
*-commutative90.2%
Simplified90.2%
Taylor expanded in y around 0 84.5%
+-commutative84.5%
Simplified84.5%
Taylor expanded in x around inf 80.2%
if -3.8000000000000001e-122 < x < 2.0499999999999999e34Initial program 95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in z around inf 64.0%
if 2.0499999999999999e34 < x Initial program 89.0%
*-commutative89.0%
Simplified89.0%
Taylor expanded in x around -inf 81.7%
mul-1-neg81.7%
distribute-rgt-out--81.8%
unpow281.8%
Simplified81.8%
Taylor expanded in z around 0 81.8%
associate-/l*94.7%
unpow294.7%
Simplified94.7%
Final simplification76.2%
(FPCore (x y z t) :precision binary64 (if (<= x -4.3e-122) 1.0 (if (<= x 4.6e-21) (/ (* y z) (- (* z t) x)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.3e-122) {
tmp = 1.0;
} else if (x <= 4.6e-21) {
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 <= (-4.3d-122)) then
tmp = 1.0d0
else if (x <= 4.6d-21) 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 <= -4.3e-122) {
tmp = 1.0;
} else if (x <= 4.6e-21) {
tmp = (y * z) / ((z * t) - x);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.3e-122: tmp = 1.0 elif x <= 4.6e-21: tmp = (y * z) / ((z * t) - x) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.3e-122) tmp = 1.0; elseif (x <= 4.6e-21) tmp = Float64(Float64(y * 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 <= -4.3e-122) tmp = 1.0; elseif (x <= 4.6e-21) tmp = (y * z) / ((z * t) - x); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.3e-122], 1.0, If[LessEqual[x, 4.6e-21], N[(N[(y * z), $MachinePrecision] / N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-122}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-21}:\\
\;\;\;\;\frac{y \cdot z}{z \cdot t - x}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.30000000000000019e-122 or 4.59999999999999999e-21 < x Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 83.4%
if -4.30000000000000019e-122 < x < 4.59999999999999999e-21Initial program 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in y around inf 54.7%
times-frac47.5%
+-commutative47.5%
Simplified47.5%
Taylor expanded in x around 0 47.5%
Taylor expanded in y around 0 54.7%
*-commutative54.7%
Simplified54.7%
Final simplification72.0%
(FPCore (x y z t) :precision binary64 (if (<= x -1.05e-121) 1.0 (if (<= x 9e-20) (/ (+ x (/ y t)) (+ x 1.0)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.05e-121) {
tmp = 1.0;
} else if (x <= 9e-20) {
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 <= (-1.05d-121)) then
tmp = 1.0d0
else if (x <= 9d-20) 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 <= -1.05e-121) {
tmp = 1.0;
} else if (x <= 9e-20) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.05e-121: tmp = 1.0 elif x <= 9e-20: tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.05e-121) tmp = 1.0; elseif (x <= 9e-20) 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 <= -1.05e-121) tmp = 1.0; elseif (x <= 9e-20) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.05e-121], 1.0, If[LessEqual[x, 9e-20], 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 -1.05 \cdot 10^{-121}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 9 \cdot 10^{-20}:\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.0499999999999999e-121 or 9.0000000000000003e-20 < x Initial program 90.4%
*-commutative90.4%
Simplified90.4%
Taylor expanded in y around 0 86.5%
+-commutative86.5%
Simplified86.5%
Taylor expanded in x around inf 83.4%
if -1.0499999999999999e-121 < x < 9.0000000000000003e-20Initial program 95.0%
*-commutative95.0%
Simplified95.0%
Taylor expanded in z around inf 64.2%
Final simplification75.8%
(FPCore (x y z t) :precision binary64 (if (<= x -1.08e-150) 1.0 (if (<= x 7.3e-202) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -1.08e-150) {
tmp = 1.0;
} else if (x <= 7.3e-202) {
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 <= (-1.08d-150)) then
tmp = 1.0d0
else if (x <= 7.3d-202) 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 <= -1.08e-150) {
tmp = 1.0;
} else if (x <= 7.3e-202) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -1.08e-150: tmp = 1.0 elif x <= 7.3e-202: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -1.08e-150) tmp = 1.0; elseif (x <= 7.3e-202) 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 <= -1.08e-150) tmp = 1.0; elseif (x <= 7.3e-202) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -1.08e-150], 1.0, If[LessEqual[x, 7.3e-202], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.08 \cdot 10^{-150}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 7.3 \cdot 10^{-202}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.08000000000000003e-150 or 7.29999999999999959e-202 < x Initial program 92.0%
*-commutative92.0%
Simplified92.0%
Taylor expanded in y around 0 81.3%
+-commutative81.3%
Simplified81.3%
Taylor expanded in x around inf 72.3%
if -1.08000000000000003e-150 < x < 7.29999999999999959e-202Initial program 93.1%
*-commutative93.1%
Simplified93.1%
Taylor expanded in z around inf 75.5%
Taylor expanded in y around inf 64.1%
Taylor expanded in x around 0 64.1%
Final simplification70.5%
(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 92.2%
*-commutative92.2%
Simplified92.2%
Taylor expanded in y around 0 69.7%
+-commutative69.7%
Simplified69.7%
Taylor expanded in x around inf 57.7%
Final simplification57.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 2023171
(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)))