
(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 (if (or (<= t -1.7e+28) (not (<= t 2.7e+31))) (/ (+ (/ y t) x) (+ x 1.0)) (/ (- x (/ (- (* y z) x) (- x (* t z)))) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -1.7e+28) || !(t <= 2.7e+31)) {
tmp = ((y / t) + x) / (x + 1.0);
} else {
tmp = (x - (((y * z) - x) / (x - (t * 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 <= (-1.7d+28)) .or. (.not. (t <= 2.7d+31))) then
tmp = ((y / t) + x) / (x + 1.0d0)
else
tmp = (x - (((y * z) - x) / (x - (t * 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 <= -1.7e+28) || !(t <= 2.7e+31)) {
tmp = ((y / t) + x) / (x + 1.0);
} else {
tmp = (x - (((y * z) - x) / (x - (t * z)))) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -1.7e+28) or not (t <= 2.7e+31): tmp = ((y / t) + x) / (x + 1.0) else: tmp = (x - (((y * z) - x) / (x - (t * z)))) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -1.7e+28) || !(t <= 2.7e+31)) tmp = Float64(Float64(Float64(y / t) + x) / Float64(x + 1.0)); else tmp = Float64(Float64(x - Float64(Float64(Float64(y * z) - x) / Float64(x - Float64(t * z)))) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -1.7e+28) || ~((t <= 2.7e+31))) tmp = ((y / t) + x) / (x + 1.0); else tmp = (x - (((y * z) - x) / (x - (t * z)))) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -1.7e+28], N[Not[LessEqual[t, 2.7e+31]], $MachinePrecision]], N[(N[(N[(y / t), $MachinePrecision] + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(x - N[(N[(N[(y * z), $MachinePrecision] - x), $MachinePrecision] / N[(x - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+28} \lor \neg \left(t \leq 2.7 \cdot 10^{+31}\right):\\
\;\;\;\;\frac{\frac{y}{t} + x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \frac{y \cdot z - x}{x - t \cdot z}}{x + 1}\\
\end{array}
\end{array}
if t < -1.7e28 or 2.69999999999999986e31 < t Initial program 77.4%
*-commutative77.4%
Simplified77.4%
Taylor expanded in z around inf 98.1%
+-commutative98.1%
+-commutative98.1%
Simplified98.1%
if -1.7e28 < t < 2.69999999999999986e31Initial program 94.6%
Final simplification96.1%
(FPCore (x y z t) :precision binary64 (if (or (<= t -9.5e-99) (not (<= t 2.6e-188))) (/ (+ (/ y t) x) (+ x 1.0)) (/ (+ (- x (* y (/ z x))) 1.0) (+ x 1.0))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -9.5e-99) || !(t <= 2.6e-188)) {
tmp = ((y / t) + x) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (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 <= (-9.5d-99)) .or. (.not. (t <= 2.6d-188))) then
tmp = ((y / t) + x) / (x + 1.0d0)
else
tmp = ((x - (y * (z / x))) + 1.0d0) / (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 <= -9.5e-99) || !(t <= 2.6e-188)) {
tmp = ((y / t) + x) / (x + 1.0);
} else {
tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -9.5e-99) or not (t <= 2.6e-188): tmp = ((y / t) + x) / (x + 1.0) else: tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -9.5e-99) || !(t <= 2.6e-188)) tmp = Float64(Float64(Float64(y / t) + x) / Float64(x + 1.0)); else tmp = Float64(Float64(Float64(x - Float64(y * Float64(z / x))) + 1.0) / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -9.5e-99) || ~((t <= 2.6e-188))) tmp = ((y / t) + x) / (x + 1.0); else tmp = ((x - (y * (z / x))) + 1.0) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -9.5e-99], N[Not[LessEqual[t, 2.6e-188]], $MachinePrecision]], N[(N[(N[(y / t), $MachinePrecision] + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x - N[(y * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{-99} \lor \neg \left(t \leq 2.6 \cdot 10^{-188}\right):\\
\;\;\;\;\frac{\frac{y}{t} + x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y \cdot \frac{z}{x}\right) + 1}{x + 1}\\
\end{array}
\end{array}
if t < -9.5000000000000008e-99 or 2.6000000000000001e-188 < t Initial program 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in z around inf 86.8%
+-commutative86.8%
+-commutative86.8%
Simplified86.8%
if -9.5000000000000008e-99 < t < 2.6000000000000001e-188Initial program 93.6%
*-commutative93.6%
Simplified93.6%
Taylor expanded in t around 0 75.9%
mul-1-neg75.9%
unsub-neg75.9%
associate-/l*82.0%
+-commutative82.0%
Simplified82.0%
Final simplification85.3%
(FPCore (x y z t)
:precision binary64
(if (<= x -8e-9)
1.0
(if (<= x -1.5e-202)
(+ x (/ x (- x (* t z))))
(if (<= x 1.45e-9) (+ (/ y t) x) (/ x (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -8e-9) {
tmp = 1.0;
} else if (x <= -1.5e-202) {
tmp = x + (x / (x - (t * z)));
} else if (x <= 1.45e-9) {
tmp = (y / t) + x;
} else {
tmp = 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 (x <= (-8d-9)) then
tmp = 1.0d0
else if (x <= (-1.5d-202)) then
tmp = x + (x / (x - (t * z)))
else if (x <= 1.45d-9) then
tmp = (y / t) + x
else
tmp = 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 (x <= -8e-9) {
tmp = 1.0;
} else if (x <= -1.5e-202) {
tmp = x + (x / (x - (t * z)));
} else if (x <= 1.45e-9) {
tmp = (y / t) + x;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -8e-9: tmp = 1.0 elif x <= -1.5e-202: tmp = x + (x / (x - (t * z))) elif x <= 1.45e-9: tmp = (y / t) + x else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -8e-9) tmp = 1.0; elseif (x <= -1.5e-202) tmp = Float64(x + Float64(x / Float64(x - Float64(t * z)))); elseif (x <= 1.45e-9) tmp = Float64(Float64(y / t) + x); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -8e-9) tmp = 1.0; elseif (x <= -1.5e-202) tmp = x + (x / (x - (t * z))); elseif (x <= 1.45e-9) tmp = (y / t) + x; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -8e-9], 1.0, If[LessEqual[x, -1.5e-202], N[(x + N[(x / N[(x - N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.45e-9], N[(N[(y / t), $MachinePrecision] + x), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -8 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-202}:\\
\;\;\;\;x + \frac{x}{x - t \cdot z}\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{-9}:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -8.0000000000000005e-9Initial program 80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in x around inf 83.2%
if -8.0000000000000005e-9 < x < -1.50000000000000005e-202Initial program 94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in y around 0 65.2%
Taylor expanded in x around 0 63.9%
/-rgt-identity63.9%
sub-neg63.9%
/-rgt-identity63.9%
/-rgt-identity63.9%
*-commutative63.9%
Applied egg-rr63.9%
sub-neg63.9%
Simplified63.9%
if -1.50000000000000005e-202 < x < 1.44999999999999996e-9Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in z around inf 70.8%
+-commutative70.8%
+-commutative70.8%
Simplified70.8%
Taylor expanded in x around 0 70.8%
if 1.44999999999999996e-9 < x Initial program 86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in t around inf 90.6%
+-commutative90.6%
Simplified90.6%
Final simplification77.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -2.2e-285) (not (<= z 2e-90))) (/ (+ (/ y t) x) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -2.2e-285) || !(z <= 2e-90)) {
tmp = ((y / t) + x) / (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 ((z <= (-2.2d-285)) .or. (.not. (z <= 2d-90))) then
tmp = ((y / t) + x) / (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 ((z <= -2.2e-285) || !(z <= 2e-90)) {
tmp = ((y / t) + x) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -2.2e-285) or not (z <= 2e-90): tmp = ((y / t) + x) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -2.2e-285) || !(z <= 2e-90)) tmp = Float64(Float64(Float64(y / t) + x) / Float64(x + 1.0)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((z <= -2.2e-285) || ~((z <= 2e-90))) tmp = ((y / t) + x) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -2.2e-285], N[Not[LessEqual[z, 2e-90]], $MachinePrecision]], N[(N[(N[(y / t), $MachinePrecision] + x), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.2 \cdot 10^{-285} \lor \neg \left(z \leq 2 \cdot 10^{-90}\right):\\
\;\;\;\;\frac{\frac{y}{t} + x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -2.1999999999999999e-285 or 1.99999999999999999e-90 < z Initial program 84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in z around inf 78.7%
+-commutative78.7%
+-commutative78.7%
Simplified78.7%
if -2.1999999999999999e-285 < z < 1.99999999999999999e-90Initial program 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in x around inf 82.7%
Final simplification79.4%
(FPCore (x y z t) :precision binary64 (if (or (<= x -4.3e-141) (not (<= x 2.4e-52))) (/ x (+ x 1.0)) (/ y t)))
double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e-141) || !(x <= 2.4e-52)) {
tmp = x / (x + 1.0);
} else {
tmp = y / 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 ((x <= (-4.3d-141)) .or. (.not. (x <= 2.4d-52))) then
tmp = x / (x + 1.0d0)
else
tmp = y / t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((x <= -4.3e-141) || !(x <= 2.4e-52)) {
tmp = x / (x + 1.0);
} else {
tmp = y / t;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (x <= -4.3e-141) or not (x <= 2.4e-52): tmp = x / (x + 1.0) else: tmp = y / t return tmp
function code(x, y, z, t) tmp = 0.0 if ((x <= -4.3e-141) || !(x <= 2.4e-52)) tmp = Float64(x / Float64(x + 1.0)); else tmp = Float64(y / t); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((x <= -4.3e-141) || ~((x <= 2.4e-52))) tmp = x / (x + 1.0); else tmp = y / t; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[x, -4.3e-141], N[Not[LessEqual[x, 2.4e-52]], $MachinePrecision]], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(y / t), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.3 \cdot 10^{-141} \lor \neg \left(x \leq 2.4 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{t}\\
\end{array}
\end{array}
if x < -4.29999999999999974e-141 or 2.4000000000000002e-52 < x Initial program 86.5%
*-commutative86.5%
Simplified86.5%
Taylor expanded in t around inf 75.6%
+-commutative75.6%
Simplified75.6%
if -4.29999999999999974e-141 < x < 2.4000000000000002e-52Initial program 88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in x around 0 52.7%
Final simplification66.4%
(FPCore (x y z t) :precision binary64 (if (<= x -4.5e-9) 1.0 (if (<= x 3.3e-19) (+ (/ y t) x) (/ x (+ x 1.0)))))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.5e-9) {
tmp = 1.0;
} else if (x <= 3.3e-19) {
tmp = (y / t) + x;
} else {
tmp = 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 (x <= (-4.5d-9)) then
tmp = 1.0d0
else if (x <= 3.3d-19) then
tmp = (y / t) + x
else
tmp = 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 (x <= -4.5e-9) {
tmp = 1.0;
} else if (x <= 3.3e-19) {
tmp = (y / t) + x;
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.5e-9: tmp = 1.0 elif x <= 3.3e-19: tmp = (y / t) + x else: tmp = x / (x + 1.0) return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.5e-9) tmp = 1.0; elseif (x <= 3.3e-19) tmp = Float64(Float64(y / t) + x); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -4.5e-9) tmp = 1.0; elseif (x <= 3.3e-19) tmp = (y / t) + x; else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.5e-9], 1.0, If[LessEqual[x, 3.3e-19], N[(N[(y / t), $MachinePrecision] + x), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-9}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{-19}:\\
\;\;\;\;\frac{y}{t} + x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -4.49999999999999976e-9Initial program 80.1%
*-commutative80.1%
Simplified80.1%
Taylor expanded in x around inf 83.2%
if -4.49999999999999976e-9 < x < 3.2999999999999998e-19Initial program 90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in z around inf 64.8%
+-commutative64.8%
+-commutative64.8%
Simplified64.8%
Taylor expanded in x around 0 64.4%
if 3.2999999999999998e-19 < x Initial program 87.2%
*-commutative87.2%
Simplified87.2%
Taylor expanded in t around inf 89.2%
+-commutative89.2%
Simplified89.2%
Final simplification74.8%
(FPCore (x y z t) :precision binary64 (if (<= x -4.9e-139) 1.0 (if (<= x 2e-36) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -4.9e-139) {
tmp = 1.0;
} else if (x <= 2e-36) {
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 <= (-4.9d-139)) then
tmp = 1.0d0
else if (x <= 2d-36) 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 <= -4.9e-139) {
tmp = 1.0;
} else if (x <= 2e-36) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -4.9e-139: tmp = 1.0 elif x <= 2e-36: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -4.9e-139) tmp = 1.0; elseif (x <= 2e-36) 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 <= -4.9e-139) tmp = 1.0; elseif (x <= 2e-36) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -4.9e-139], 1.0, If[LessEqual[x, 2e-36], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{-139}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 2 \cdot 10^{-36}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -4.90000000000000031e-139 or 1.9999999999999999e-36 < x Initial program 86.0%
*-commutative86.0%
Simplified86.0%
Taylor expanded in x around inf 75.1%
if -4.90000000000000031e-139 < x < 1.9999999999999999e-36Initial program 89.2%
*-commutative89.2%
Simplified89.2%
Taylor expanded in x around 0 51.7%
(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.3%
*-commutative87.3%
Simplified87.3%
Taylor expanded in x around inf 49.6%
(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 2024148
(FPCore (x y z t)
:name "Diagrams.Trail:splitAtParam from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (/ (+ x (- (/ y (- t (/ x z))) (/ x (- (* t z) x)))) (+ x 1)))
(/ (+ x (/ (- (* y z) x) (- (* t z) x))) (+ x 1.0)))