
(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 7 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 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -2e+286)
(* y (/ (/ z (+ x 1.0)) t_1))
(if (<= t_2 5e+245)
t_2
(+ (/ x (+ x 1.0)) (/ (+ (/ y (+ x 1.0)) (/ (/ x z) (- -1.0 x))) t))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+286) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+245) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-2d+286)) then
tmp = y * ((z / (x + 1.0d0)) / t_1)
else if (t_2 <= 5d+245) then
tmp = t_2
else
tmp = (x / (x + 1.0d0)) + (((y / (x + 1.0d0)) + ((x / z) / ((-1.0d0) - x))) / t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+286) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+245) {
tmp = t_2;
} else {
tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -2e+286: tmp = y * ((z / (x + 1.0)) / t_1) elif t_2 <= 5e+245: tmp = t_2 else: tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -2e+286) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_1)); elseif (t_2 <= 5e+245) tmp = t_2; else tmp = Float64(Float64(x / Float64(x + 1.0)) + Float64(Float64(Float64(y / Float64(x + 1.0)) + Float64(Float64(x / z) / Float64(-1.0 - x))) / t)); end return tmp end
function tmp_2 = code(x, y, z, t) t_1 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -2e+286) tmp = y * ((z / (x + 1.0)) / t_1); elseif (t_2 <= 5e+245) tmp = t_2; else tmp = (x / (x + 1.0)) + (((y / (x + 1.0)) + ((x / z) / (-1.0 - x))) / t); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+286], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+245], t$95$2, N[(N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x / z), $MachinePrecision] / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+286}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+245}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1} + \frac{\frac{y}{x + 1} + \frac{\frac{x}{z}}{-1 - x}}{t}\\
\end{array}
\end{array}
if (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < -2.00000000000000007e286Initial program 40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in y around inf 39.3%
associate-/l*69.5%
associate-/r*78.6%
+-commutative78.6%
Simplified78.6%
if -2.00000000000000007e286 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000034e245Initial program 98.5%
if 5.00000000000000034e245 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 39.9%
*-commutative39.9%
Simplified39.9%
Taylor expanded in t around -inf 84.9%
+-commutative84.9%
mul-1-neg84.9%
unsub-neg84.9%
+-commutative84.9%
Simplified84.9%
Final simplification95.8%
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (- (* z t) x)) (t_2 (/ (- x (/ (- x (* y z)) t_1)) (+ x 1.0))))
(if (<= t_2 -2e+286)
(* y (/ (/ z (+ x 1.0)) t_1))
(if (<= t_2 5e+245) t_2 (/ (+ x (/ y t)) (+ x 1.0))))))
double code(double x, double y, double z, double t) {
double t_1 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+286) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+245) {
tmp = t_2;
} 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) :: t_2
real(8) :: tmp
t_1 = (z * t) - x
t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0d0)
if (t_2 <= (-2d+286)) then
tmp = y * ((z / (x + 1.0d0)) / t_1)
else if (t_2 <= 5d+245) then
tmp = t_2
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 = (z * t) - x;
double t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0);
double tmp;
if (t_2 <= -2e+286) {
tmp = y * ((z / (x + 1.0)) / t_1);
} else if (t_2 <= 5e+245) {
tmp = t_2;
} else {
tmp = (x + (y / t)) / (x + 1.0);
}
return tmp;
}
def code(x, y, z, t): t_1 = (z * t) - x t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0) tmp = 0 if t_2 <= -2e+286: tmp = y * ((z / (x + 1.0)) / t_1) elif t_2 <= 5e+245: tmp = t_2 else: tmp = (x + (y / t)) / (x + 1.0) return tmp
function code(x, y, z, t) t_1 = Float64(Float64(z * t) - x) t_2 = Float64(Float64(x - Float64(Float64(x - Float64(y * z)) / t_1)) / Float64(x + 1.0)) tmp = 0.0 if (t_2 <= -2e+286) tmp = Float64(y * Float64(Float64(z / Float64(x + 1.0)) / t_1)); elseif (t_2 <= 5e+245) tmp = t_2; 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 = (z * t) - x; t_2 = (x - ((x - (y * z)) / t_1)) / (x + 1.0); tmp = 0.0; if (t_2 <= -2e+286) tmp = y * ((z / (x + 1.0)) / t_1); elseif (t_2 <= 5e+245) tmp = t_2; else tmp = (x + (y / t)) / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] - x), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x - N[(N[(x - N[(y * z), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e+286], N[(y * N[(N[(z / N[(x + 1.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+245], t$95$2, N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot t - x\\
t_2 := \frac{x - \frac{x - y \cdot z}{t\_1}}{x + 1}\\
\mathbf{if}\;t\_2 \leq -2 \cdot 10^{+286}:\\
\;\;\;\;y \cdot \frac{\frac{z}{x + 1}}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+245}:\\
\;\;\;\;t\_2\\
\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 #s(literal 1 binary64))) < -2.00000000000000007e286Initial program 40.0%
*-commutative40.0%
Simplified40.0%
Taylor expanded in y around inf 39.3%
associate-/l*69.5%
associate-/r*78.6%
+-commutative78.6%
Simplified78.6%
if -2.00000000000000007e286 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) < 5.00000000000000034e245Initial program 98.5%
if 5.00000000000000034e245 < (/.f64 (+.f64 x (/.f64 (-.f64 (*.f64 y z) x) (-.f64 (*.f64 t z) x))) (+.f64 x #s(literal 1 binary64))) Initial program 39.9%
*-commutative39.9%
Simplified39.9%
Taylor expanded in z around inf 84.8%
+-commutative84.8%
+-commutative84.8%
Simplified84.8%
Final simplification95.8%
(FPCore (x y z t) :precision binary64 (if (or (<= t -2.4e+19) (not (<= t 2e-109))) (/ (+ x (/ y t)) (+ x 1.0)) (+ 1.0 (* (/ y x) (/ z (- -1.0 x))))))
double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4e+19) || !(t <= 2e-109)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / x) * (z / (-1.0 - x)));
}
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.4d+19)) .or. (.not. (t <= 2d-109))) then
tmp = (x + (y / t)) / (x + 1.0d0)
else
tmp = 1.0d0 + ((y / x) * (z / ((-1.0d0) - x)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t) {
double tmp;
if ((t <= -2.4e+19) || !(t <= 2e-109)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0 + ((y / x) * (z / (-1.0 - x)));
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (t <= -2.4e+19) or not (t <= 2e-109): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 + ((y / x) * (z / (-1.0 - x))) return tmp
function code(x, y, z, t) tmp = 0.0 if ((t <= -2.4e+19) || !(t <= 2e-109)) tmp = Float64(Float64(x + Float64(y / t)) / Float64(x + 1.0)); else tmp = Float64(1.0 + Float64(Float64(y / x) * Float64(z / Float64(-1.0 - x)))); end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if ((t <= -2.4e+19) || ~((t <= 2e-109))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0 + ((y / x) * (z / (-1.0 - x))); end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[t, -2.4e+19], N[Not[LessEqual[t, 2e-109]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], N[(1.0 + N[(N[(y / x), $MachinePrecision] * N[(z / N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+19} \lor \neg \left(t \leq 2 \cdot 10^{-109}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{y}{x} \cdot \frac{z}{-1 - x}\\
\end{array}
\end{array}
if t < -2.4e19 or 2e-109 < t Initial program 87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in z around inf 89.3%
+-commutative89.3%
+-commutative89.3%
Simplified89.3%
if -2.4e19 < t < 2e-109Initial program 91.2%
*-commutative91.2%
Simplified91.2%
Taylor expanded in t around 0 72.2%
mul-1-neg72.2%
unsub-neg72.2%
associate-/l*77.5%
+-commutative77.5%
Simplified77.5%
Taylor expanded in y around 0 72.1%
*-inverses72.1%
mul-1-neg72.1%
associate-/r*72.2%
associate-*r/77.5%
+-commutative77.5%
sub-neg77.5%
*-inverses77.5%
associate-*r/72.2%
+-commutative72.2%
associate-/r*72.1%
times-frac77.8%
Simplified77.8%
Final simplification84.4%
(FPCore (x y z t) :precision binary64 (if (or (<= z -5.5e-138) (not (<= z 4.7e-88))) (/ (+ x (/ y t)) (+ x 1.0)) 1.0))
double code(double x, double y, double z, double t) {
double tmp;
if ((z <= -5.5e-138) || !(z <= 4.7e-88)) {
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 ((z <= (-5.5d-138)) .or. (.not. (z <= 4.7d-88))) 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 ((z <= -5.5e-138) || !(z <= 4.7e-88)) {
tmp = (x + (y / t)) / (x + 1.0);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if (z <= -5.5e-138) or not (z <= 4.7e-88): tmp = (x + (y / t)) / (x + 1.0) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if ((z <= -5.5e-138) || !(z <= 4.7e-88)) 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 ((z <= -5.5e-138) || ~((z <= 4.7e-88))) tmp = (x + (y / t)) / (x + 1.0); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[Or[LessEqual[z, -5.5e-138], N[Not[LessEqual[z, 4.7e-88]], $MachinePrecision]], N[(N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], 1.0]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5.5 \cdot 10^{-138} \lor \neg \left(z \leq 4.7 \cdot 10^{-88}\right):\\
\;\;\;\;\frac{x + \frac{y}{t}}{x + 1}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if z < -5.5000000000000003e-138 or 4.7e-88 < z Initial program 84.8%
*-commutative84.8%
Simplified84.8%
Taylor expanded in z around inf 81.6%
+-commutative81.6%
+-commutative81.6%
Simplified81.6%
if -5.5000000000000003e-138 < z < 4.7e-88Initial program 100.0%
*-commutative100.0%
Simplified100.0%
Taylor expanded in x around inf 75.2%
Final simplification79.9%
(FPCore (x y z t) :precision binary64 (if (<= x -6e-31) 1.0 (if (<= x 8e-26) (+ x (/ y t)) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -6e-31) {
tmp = 1.0;
} else if (x <= 8e-26) {
tmp = x + (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 <= (-6d-31)) then
tmp = 1.0d0
else if (x <= 8d-26) then
tmp = x + (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 <= -6e-31) {
tmp = 1.0;
} else if (x <= 8e-26) {
tmp = x + (y / t);
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -6e-31: tmp = 1.0 elif x <= 8e-26: tmp = x + (y / t) else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -6e-31) tmp = 1.0; elseif (x <= 8e-26) tmp = Float64(x + Float64(y / t)); else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y, z, t) tmp = 0.0; if (x <= -6e-31) tmp = 1.0; elseif (x <= 8e-26) tmp = x + (y / t); else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -6e-31], 1.0, If[LessEqual[x, 8e-26], N[(x + N[(y / t), $MachinePrecision]), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{-31}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8 \cdot 10^{-26}:\\
\;\;\;\;x + \frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -5.99999999999999962e-31 or 8.0000000000000003e-26 < x Initial program 86.7%
*-commutative86.7%
Simplified86.7%
Taylor expanded in x around inf 83.4%
if -5.99999999999999962e-31 < x < 8.0000000000000003e-26Initial program 91.8%
*-commutative91.8%
Simplified91.8%
Taylor expanded in z around inf 71.7%
+-commutative71.7%
+-commutative71.7%
Simplified71.7%
Taylor expanded in x around 0 71.7%
Taylor expanded in y around 0 71.7%
+-commutative71.7%
Simplified71.7%
Final simplification78.4%
(FPCore (x y z t) :precision binary64 (if (<= x -2.4e-34) 1.0 (if (<= x 8.8e-129) (/ y t) 1.0)))
double code(double x, double y, double z, double t) {
double tmp;
if (x <= -2.4e-34) {
tmp = 1.0;
} else if (x <= 8.8e-129) {
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 <= (-2.4d-34)) then
tmp = 1.0d0
else if (x <= 8.8d-129) 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 <= -2.4e-34) {
tmp = 1.0;
} else if (x <= 8.8e-129) {
tmp = y / t;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y, z, t): tmp = 0 if x <= -2.4e-34: tmp = 1.0 elif x <= 8.8e-129: tmp = y / t else: tmp = 1.0 return tmp
function code(x, y, z, t) tmp = 0.0 if (x <= -2.4e-34) tmp = 1.0; elseif (x <= 8.8e-129) 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 <= -2.4e-34) tmp = 1.0; elseif (x <= 8.8e-129) tmp = y / t; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_] := If[LessEqual[x, -2.4e-34], 1.0, If[LessEqual[x, 8.8e-129], N[(y / t), $MachinePrecision], 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{y}{t}\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -2.39999999999999991e-34 or 8.80000000000000012e-129 < x Initial program 87.4%
*-commutative87.4%
Simplified87.4%
Taylor expanded in x around inf 79.1%
if -2.39999999999999991e-34 < x < 8.80000000000000012e-129Initial program 91.4%
*-commutative91.4%
Simplified91.4%
Taylor expanded in x around 0 60.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 88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in x around inf 55.2%
(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 2024149
(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)))