
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))
double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x * ((x / y) + 1.0d0)) / (x + 1.0d0)
end function
public static double code(double x, double y) {
return (x * ((x / y) + 1.0)) / (x + 1.0);
}
def code(x, y): return (x * ((x / y) + 1.0)) / (x + 1.0)
function code(x, y) return Float64(Float64(x * Float64(Float64(x / y) + 1.0)) / Float64(x + 1.0)) end
function tmp = code(x, y) tmp = (x * ((x / y) + 1.0)) / (x + 1.0); end
code[x_, y_] := N[(N[(x * N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot \left(\frac{x}{y} + 1\right)}{x + 1}
\end{array}
(FPCore (x y) :precision binary64 (/ x (/ (+ x 1.0) (+ 1.0 (/ x y)))))
double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x / ((x + 1.0d0) / (1.0d0 + (x / y)))
end function
public static double code(double x, double y) {
return x / ((x + 1.0) / (1.0 + (x / y)));
}
def code(x, y): return x / ((x + 1.0) / (1.0 + (x / y)))
function code(x, y) return Float64(x / Float64(Float64(x + 1.0) / Float64(1.0 + Float64(x / y)))) end
function tmp = code(x, y) tmp = x / ((x + 1.0) / (1.0 + (x / y))); end
code[x_, y_] := N[(x / N[(N[(x + 1.0), $MachinePrecision] / N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{\frac{x + 1}{1 + \frac{x}{y}}}
\end{array}
Initial program 87.7%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (/ y x))) (t_1 (/ (+ x -1.0) y)))
(if (<= x -1e+56)
(/ x y)
(if (<= x -1.52e+32)
1.0
(if (<= x -1.0)
t_1
(if (<= x -2.5e-47)
t_0
(if (<= x 5.2e-127) x (if (<= x 1.45) t_0 t_1))))))))
double code(double x, double y) {
double t_0 = x / (y / x);
double t_1 = (x + -1.0) / y;
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= -1.52e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = t_1;
} else if (x <= -2.5e-47) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x;
} else if (x <= 1.45) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = x / (y / x)
t_1 = (x + (-1.0d0)) / y
if (x <= (-1d+56)) then
tmp = x / y
else if (x <= (-1.52d+32)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = t_1
else if (x <= (-2.5d-47)) then
tmp = t_0
else if (x <= 5.2d-127) then
tmp = x
else if (x <= 1.45d0) then
tmp = t_0
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (y / x);
double t_1 = (x + -1.0) / y;
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= -1.52e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = t_1;
} else if (x <= -2.5e-47) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x;
} else if (x <= 1.45) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y): t_0 = x / (y / x) t_1 = (x + -1.0) / y tmp = 0 if x <= -1e+56: tmp = x / y elif x <= -1.52e+32: tmp = 1.0 elif x <= -1.0: tmp = t_1 elif x <= -2.5e-47: tmp = t_0 elif x <= 5.2e-127: tmp = x elif x <= 1.45: tmp = t_0 else: tmp = t_1 return tmp
function code(x, y) t_0 = Float64(x / Float64(y / x)) t_1 = Float64(Float64(x + -1.0) / y) tmp = 0.0 if (x <= -1e+56) tmp = Float64(x / y); elseif (x <= -1.52e+32) tmp = 1.0; elseif (x <= -1.0) tmp = t_1; elseif (x <= -2.5e-47) tmp = t_0; elseif (x <= 5.2e-127) tmp = x; elseif (x <= 1.45) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y) t_0 = x / (y / x); t_1 = (x + -1.0) / y; tmp = 0.0; if (x <= -1e+56) tmp = x / y; elseif (x <= -1.52e+32) tmp = 1.0; elseif (x <= -1.0) tmp = t_1; elseif (x <= -2.5e-47) tmp = t_0; elseif (x <= 5.2e-127) tmp = x; elseif (x <= 1.45) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -1e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.52e+32], 1.0, If[LessEqual[x, -1.0], t$95$1, If[LessEqual[x, -2.5e-47], t$95$0, If[LessEqual[x, 5.2e-127], x, If[LessEqual[x, 1.45], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{\frac{y}{x}}\\
t_1 := \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -1 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.5 \cdot 10^{-47}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-127}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.45:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if x < -1.00000000000000009e56Initial program 74.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.9%
if -1.00000000000000009e56 < x < -1.5200000000000001e32Initial program 100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around inf 86.4%
if -1.5200000000000001e32 < x < -1 or 1.44999999999999996 < x Initial program 78.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 70.4%
+-commutative70.4%
*-commutative70.4%
+-commutative70.4%
associate-/l*80.1%
Simplified80.1%
Taylor expanded in x around inf 80.1%
Taylor expanded in y around 0 80.1%
if -1 < x < -2.50000000000000006e-47 or 5.19999999999999982e-127 < x < 1.44999999999999996Initial program 99.5%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 68.9%
+-commutative68.9%
*-commutative68.9%
+-commutative68.9%
associate-/l*68.7%
Simplified68.7%
Taylor expanded in x around 0 61.2%
if -2.50000000000000006e-47 < x < 5.19999999999999982e-127Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 87.3%
Final simplification82.5%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (+ x -1.0) y)))
(if (<= x -1.9e+57)
(/ x y)
(if (<= x -1.45e+32)
1.0
(if (<= x -1.0)
t_0
(if (<= x -5.2e-46)
(* (/ 1.0 y) (* x x))
(if (<= x 5.2e-127) x (if (<= x 1.3) (/ x (/ y x)) t_0))))))))
double code(double x, double y) {
double t_0 = (x + -1.0) / y;
double tmp;
if (x <= -1.9e+57) {
tmp = x / y;
} else if (x <= -1.45e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= -5.2e-46) {
tmp = (1.0 / y) * (x * x);
} else if (x <= 5.2e-127) {
tmp = x;
} else if (x <= 1.3) {
tmp = x / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x + (-1.0d0)) / y
if (x <= (-1.9d+57)) then
tmp = x / y
else if (x <= (-1.45d+32)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = t_0
else if (x <= (-5.2d-46)) then
tmp = (1.0d0 / y) * (x * x)
else if (x <= 5.2d-127) then
tmp = x
else if (x <= 1.3d0) then
tmp = x / (y / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x + -1.0) / y;
double tmp;
if (x <= -1.9e+57) {
tmp = x / y;
} else if (x <= -1.45e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = t_0;
} else if (x <= -5.2e-46) {
tmp = (1.0 / y) * (x * x);
} else if (x <= 5.2e-127) {
tmp = x;
} else if (x <= 1.3) {
tmp = x / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x + -1.0) / y tmp = 0 if x <= -1.9e+57: tmp = x / y elif x <= -1.45e+32: tmp = 1.0 elif x <= -1.0: tmp = t_0 elif x <= -5.2e-46: tmp = (1.0 / y) * (x * x) elif x <= 5.2e-127: tmp = x elif x <= 1.3: tmp = x / (y / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x + -1.0) / y) tmp = 0.0 if (x <= -1.9e+57) tmp = Float64(x / y); elseif (x <= -1.45e+32) tmp = 1.0; elseif (x <= -1.0) tmp = t_0; elseif (x <= -5.2e-46) tmp = Float64(Float64(1.0 / y) * Float64(x * x)); elseif (x <= 5.2e-127) tmp = x; elseif (x <= 1.3) tmp = Float64(x / Float64(y / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x + -1.0) / y; tmp = 0.0; if (x <= -1.9e+57) tmp = x / y; elseif (x <= -1.45e+32) tmp = 1.0; elseif (x <= -1.0) tmp = t_0; elseif (x <= -5.2e-46) tmp = (1.0 / y) * (x * x); elseif (x <= 5.2e-127) tmp = x; elseif (x <= 1.3) tmp = x / (y / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]}, If[LessEqual[x, -1.9e+57], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.45e+32], 1.0, If[LessEqual[x, -1.0], t$95$0, If[LessEqual[x, -5.2e-46], N[(N[(1.0 / y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e-127], x, If[LessEqual[x, 1.3], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -1.9 \cdot 10^{+57}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-46}:\\
\;\;\;\;\frac{1}{y} \cdot \left(x \cdot x\right)\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-127}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1.3:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -1.8999999999999999e57Initial program 74.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 87.9%
if -1.8999999999999999e57 < x < -1.45000000000000001e32Initial program 100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around inf 86.4%
if -1.45000000000000001e32 < x < -1 or 1.30000000000000004 < x Initial program 78.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in y around 0 70.4%
+-commutative70.4%
*-commutative70.4%
+-commutative70.4%
associate-/l*80.1%
Simplified80.1%
Taylor expanded in x around inf 80.1%
Taylor expanded in y around 0 80.1%
if -1 < x < -5.2000000000000004e-46Initial program 99.1%
associate-/l*99.3%
Simplified99.3%
Taylor expanded in y around 0 81.9%
+-commutative81.9%
*-commutative81.9%
+-commutative81.9%
associate-/l*81.9%
Simplified81.9%
Taylor expanded in x around 0 62.3%
clear-num62.3%
inv-pow62.3%
Applied egg-rr62.3%
unpow-162.3%
associate-/l/62.3%
unpow262.3%
associate-/r/62.7%
unpow262.7%
Simplified62.7%
if -5.2000000000000004e-46 < x < 5.19999999999999982e-127Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 87.3%
if 5.19999999999999982e-127 < x < 1.30000000000000004Initial program 99.6%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in x around 0 60.8%
Final simplification82.5%
(FPCore (x y)
:precision binary64
(if (<= x -1e+56)
(/ x y)
(if (<= x -1.4e+32)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 2.35e-51) x (if (<= x 1.0) (* x (/ x y)) (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= -1.4e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 2.35e-51) {
tmp = x;
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1d+56)) then
tmp = x / y
else if (x <= (-1.4d+32)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 2.35d-51) then
tmp = x
else if (x <= 1.0d0) then
tmp = x * (x / y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= -1.4e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 2.35e-51) {
tmp = x;
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1e+56: tmp = x / y elif x <= -1.4e+32: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 2.35e-51: tmp = x elif x <= 1.0: tmp = x * (x / y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1e+56) tmp = Float64(x / y); elseif (x <= -1.4e+32) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 2.35e-51) tmp = x; elseif (x <= 1.0) tmp = Float64(x * Float64(x / y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1e+56) tmp = x / y; elseif (x <= -1.4e+32) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 2.35e-51) tmp = x; elseif (x <= 1.0) tmp = x * (x / y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.4e+32], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 2.35e-51], x, If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.4 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 2.35 \cdot 10^{-51}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.00000000000000009e56 or -1.4e32 < x < -1 or 1 < x Initial program 76.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if -1.00000000000000009e56 < x < -1.4e32Initial program 100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around inf 86.4%
if -1 < x < 2.3499999999999999e-51Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 78.7%
if 2.3499999999999999e-51 < x < 1Initial program 99.5%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 75.6%
+-commutative75.6%
*-commutative75.6%
+-commutative75.6%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in x around 0 68.4%
associate-/r/68.3%
Applied egg-rr68.3%
Final simplification81.0%
(FPCore (x y)
:precision binary64
(if (<= x -1.35e+56)
(/ x y)
(if (<= x -1.25e+32)
1.0
(if (<= x -1.0)
(/ x y)
(if (<= x 1.25e-50)
(- x (* x x))
(if (<= x 1.0) (* x (/ x y)) (/ x y)))))))
double code(double x, double y) {
double tmp;
if (x <= -1.35e+56) {
tmp = x / y;
} else if (x <= -1.25e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.25e-50) {
tmp = x - (x * x);
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.35d+56)) then
tmp = x / y
else if (x <= (-1.25d+32)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 1.25d-50) then
tmp = x - (x * x)
else if (x <= 1.0d0) then
tmp = x * (x / y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.35e+56) {
tmp = x / y;
} else if (x <= -1.25e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.25e-50) {
tmp = x - (x * x);
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.35e+56: tmp = x / y elif x <= -1.25e+32: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 1.25e-50: tmp = x - (x * x) elif x <= 1.0: tmp = x * (x / y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.35e+56) tmp = Float64(x / y); elseif (x <= -1.25e+32) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 1.25e-50) tmp = Float64(x - Float64(x * x)); elseif (x <= 1.0) tmp = Float64(x * Float64(x / y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.35e+56) tmp = x / y; elseif (x <= -1.25e+32) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 1.25e-50) tmp = x - (x * x); elseif (x <= 1.0) tmp = x * (x / y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.35e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.25e+32], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.25e-50], N[(x - N[(x * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.35 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.25 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{-50}:\\
\;\;\;\;x - x \cdot x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.35000000000000005e56 or -1.2499999999999999e32 < x < -1 or 1 < x Initial program 76.9%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 83.6%
if -1.35000000000000005e56 < x < -1.2499999999999999e32Initial program 100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around inf 86.4%
if -1 < x < 1.24999999999999992e-50Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 91.9%
fma-def91.9%
sub-neg91.9%
metadata-eval91.9%
unpow291.9%
Simplified91.9%
fma-udef91.9%
+-commutative91.9%
Applied egg-rr91.9%
Taylor expanded in y around inf 79.1%
+-commutative79.1%
mul-1-neg79.1%
unsub-neg79.1%
unpow279.1%
Simplified79.1%
if 1.24999999999999992e-50 < x < 1Initial program 99.5%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 75.6%
+-commutative75.6%
*-commutative75.6%
+-commutative75.6%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in x around 0 68.4%
associate-/r/68.3%
Applied egg-rr68.3%
Final simplification81.1%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (+ 1.0 (/ (+ x -1.0) y)) (+ x (* (+ -1.0 (/ 1.0 y)) (* x x)))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + ((-1.0 + (1.0 / y)) * (x * x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.0d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else
tmp = x + (((-1.0d0) + (1.0d0 / y)) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + ((-1.0 + (1.0 / y)) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x + ((-1.0 + (1.0 / y)) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); else tmp = Float64(x + Float64(Float64(-1.0 + Float64(1.0 / y)) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x + ((-1.0 + (1.0 / y)) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(-1.0 + N[(1.0 / y), $MachinePrecision]), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \left(-1 + \frac{1}{y}\right) \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 78.1%
flip-+38.3%
associate-*r/33.6%
metadata-eval33.6%
sub-neg33.6%
pow233.6%
metadata-eval33.6%
sub-neg33.6%
metadata-eval33.6%
Applied egg-rr33.6%
*-commutative33.6%
associate-/l*38.2%
+-commutative38.2%
+-commutative38.2%
Simplified38.2%
Taylor expanded in x around inf 99.3%
associate--l+99.3%
div-sub99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
if -1 < x < 1Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 91.9%
fma-def91.9%
sub-neg91.9%
metadata-eval91.9%
unpow291.9%
Simplified91.9%
fma-udef91.9%
+-commutative91.9%
Applied egg-rr91.9%
Final simplification96.0%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= x -290000000.0)
t_0
(if (<= x 5.2e-127) (/ x (+ x 1.0)) (if (<= x 0.42) (/ x (/ y x)) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -290000000.0) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 0.42) {
tmp = x / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
if (x <= (-290000000.0d0)) then
tmp = t_0
else if (x <= 5.2d-127) then
tmp = x / (x + 1.0d0)
else if (x <= 0.42d0) then
tmp = x / (y / x)
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -290000000.0) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 0.42) {
tmp = x / (y / x);
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if x <= -290000000.0: tmp = t_0 elif x <= 5.2e-127: tmp = x / (x + 1.0) elif x <= 0.42: tmp = x / (y / x) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) tmp = 0.0 if (x <= -290000000.0) tmp = t_0; elseif (x <= 5.2e-127) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 0.42) tmp = Float64(x / Float64(y / x)); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); tmp = 0.0; if (x <= -290000000.0) tmp = t_0; elseif (x <= 5.2e-127) tmp = x / (x + 1.0); elseif (x <= 0.42) tmp = x / (y / x); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -290000000.0], t$95$0, If[LessEqual[x, 5.2e-127], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 0.42], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -290000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 0.42:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.9e8 or 0.419999999999999984 < x Initial program 77.8%
flip-+37.4%
associate-*r/32.6%
metadata-eval32.6%
sub-neg32.6%
pow232.6%
metadata-eval32.6%
sub-neg32.6%
metadata-eval32.6%
Applied egg-rr32.6%
*-commutative32.6%
associate-/l*37.3%
+-commutative37.3%
+-commutative37.3%
Simplified37.3%
Taylor expanded in x around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if -2.9e8 < x < 5.19999999999999982e-127Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if 5.19999999999999982e-127 < x < 0.419999999999999984Initial program 99.6%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in x around 0 60.8%
Final simplification90.2%
(FPCore (x y)
:precision binary64
(let* ((t_0 (+ 1.0 (/ (+ x -1.0) y))))
(if (<= x -290000000.0)
t_0
(if (<= x 5.2e-127)
(/ x (+ x 1.0))
(if (<= x 18000.0) (/ x (+ y (/ y x))) t_0)))))
double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -290000000.0) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 18000.0) {
tmp = x / (y + (y / x));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = 1.0d0 + ((x + (-1.0d0)) / y)
if (x <= (-290000000.0d0)) then
tmp = t_0
else if (x <= 5.2d-127) then
tmp = x / (x + 1.0d0)
else if (x <= 18000.0d0) then
tmp = x / (y + (y / x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = 1.0 + ((x + -1.0) / y);
double tmp;
if (x <= -290000000.0) {
tmp = t_0;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 18000.0) {
tmp = x / (y + (y / x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = 1.0 + ((x + -1.0) / y) tmp = 0 if x <= -290000000.0: tmp = t_0 elif x <= 5.2e-127: tmp = x / (x + 1.0) elif x <= 18000.0: tmp = x / (y + (y / x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(1.0 + Float64(Float64(x + -1.0) / y)) tmp = 0.0 if (x <= -290000000.0) tmp = t_0; elseif (x <= 5.2e-127) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 18000.0) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = 1.0 + ((x + -1.0) / y); tmp = 0.0; if (x <= -290000000.0) tmp = t_0; elseif (x <= 5.2e-127) tmp = x / (x + 1.0); elseif (x <= 18000.0) tmp = x / (y + (y / x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -290000000.0], t$95$0, If[LessEqual[x, 5.2e-127], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 18000.0], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 1 + \frac{x + -1}{y}\\
\mathbf{if}\;x \leq -290000000:\\
\;\;\;\;t_0\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 18000:\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if x < -2.9e8 or 18000 < x Initial program 77.8%
flip-+37.4%
associate-*r/32.6%
metadata-eval32.6%
sub-neg32.6%
pow232.6%
metadata-eval32.6%
sub-neg32.6%
metadata-eval32.6%
Applied egg-rr32.6%
*-commutative32.6%
associate-/l*37.3%
+-commutative37.3%
+-commutative37.3%
Simplified37.3%
Taylor expanded in x around inf 100.0%
associate--l+100.0%
div-sub100.0%
sub-neg100.0%
metadata-eval100.0%
+-commutative100.0%
Simplified100.0%
if -2.9e8 < x < 5.19999999999999982e-127Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 82.4%
if 5.19999999999999982e-127 < x < 18000Initial program 99.6%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in x around 0 64.8%
Final simplification90.5%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.25))) (+ 1.0 (/ (+ x -1.0) y)) (+ x (* (/ 1.0 y) (* x x)))))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.25)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + ((1.0 / y) * (x * x));
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if ((x <= (-1.0d0)) .or. (.not. (x <= 1.25d0))) then
tmp = 1.0d0 + ((x + (-1.0d0)) / y)
else
tmp = x + ((1.0d0 / y) * (x * x))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.25)) {
tmp = 1.0 + ((x + -1.0) / y);
} else {
tmp = x + ((1.0 / y) * (x * x));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.25): tmp = 1.0 + ((x + -1.0) / y) else: tmp = x + ((1.0 / y) * (x * x)) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.25)) tmp = Float64(1.0 + Float64(Float64(x + -1.0) / y)); else tmp = Float64(x + Float64(Float64(1.0 / y) * Float64(x * x))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.25))) tmp = 1.0 + ((x + -1.0) / y); else tmp = x + ((1.0 / y) * (x * x)); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.25]], $MachinePrecision]], N[(1.0 + N[(N[(x + -1.0), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(1.0 / y), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1.25\right):\\
\;\;\;\;1 + \frac{x + -1}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{y} \cdot \left(x \cdot x\right)\\
\end{array}
\end{array}
if x < -1 or 1.25 < x Initial program 78.1%
flip-+38.3%
associate-*r/33.6%
metadata-eval33.6%
sub-neg33.6%
pow233.6%
metadata-eval33.6%
sub-neg33.6%
metadata-eval33.6%
Applied egg-rr33.6%
*-commutative33.6%
associate-/l*38.2%
+-commutative38.2%
+-commutative38.2%
Simplified38.2%
Taylor expanded in x around inf 99.3%
associate--l+99.3%
div-sub99.3%
sub-neg99.3%
metadata-eval99.3%
+-commutative99.3%
Simplified99.3%
if -1 < x < 1.25Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 91.9%
fma-def91.9%
sub-neg91.9%
metadata-eval91.9%
unpow291.9%
Simplified91.9%
fma-udef91.9%
+-commutative91.9%
Applied egg-rr91.9%
Taylor expanded in y around 0 91.6%
Final simplification95.9%
(FPCore (x y)
:precision binary64
(if (<= x -9e+56)
(/ x y)
(if (<= x -1.52e+32)
1.0
(if (<= x -1.0) (/ x y) (if (<= x 6.5e-13) x (/ x y))))))
double code(double x, double y) {
double tmp;
if (x <= -9e+56) {
tmp = x / y;
} else if (x <= -1.52e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 6.5e-13) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-9d+56)) then
tmp = x / y
else if (x <= (-1.52d+32)) then
tmp = 1.0d0
else if (x <= (-1.0d0)) then
tmp = x / y
else if (x <= 6.5d-13) then
tmp = x
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -9e+56) {
tmp = x / y;
} else if (x <= -1.52e+32) {
tmp = 1.0;
} else if (x <= -1.0) {
tmp = x / y;
} else if (x <= 6.5e-13) {
tmp = x;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -9e+56: tmp = x / y elif x <= -1.52e+32: tmp = 1.0 elif x <= -1.0: tmp = x / y elif x <= 6.5e-13: tmp = x else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -9e+56) tmp = Float64(x / y); elseif (x <= -1.52e+32) tmp = 1.0; elseif (x <= -1.0) tmp = Float64(x / y); elseif (x <= 6.5e-13) tmp = x; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -9e+56) tmp = x / y; elseif (x <= -1.52e+32) tmp = 1.0; elseif (x <= -1.0) tmp = x / y; elseif (x <= 6.5e-13) tmp = x; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -9e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, -1.52e+32], 1.0, If[LessEqual[x, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 6.5e-13], x, N[(x / y), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq -1.52 \cdot 10^{+32}:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq -1:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 6.5 \cdot 10^{-13}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -9.0000000000000006e56 or -1.5200000000000001e32 < x < -1 or 6.49999999999999957e-13 < x Initial program 77.3%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 82.5%
if -9.0000000000000006e56 < x < -1.5200000000000001e32Initial program 100.0%
distribute-lft-in100.0%
*-rgt-identity100.0%
Applied egg-rr100.0%
Taylor expanded in y around inf 86.4%
+-commutative86.4%
Simplified86.4%
Taylor expanded in x around inf 86.4%
if -1 < x < 6.49999999999999957e-13Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 74.6%
Final simplification79.2%
(FPCore (x y) :precision binary64 (if (<= x -1e+56) (/ x y) (if (<= x 1.06e-50) (/ x (+ x 1.0)) (if (<= x 1.0) (* x (/ x y)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= 1.06e-50) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1d+56)) then
tmp = x / y
else if (x <= 1.06d-50) then
tmp = x / (x + 1.0d0)
else if (x <= 1.0d0) then
tmp = x * (x / y)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1e+56) {
tmp = x / y;
} else if (x <= 1.06e-50) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = x * (x / y);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1e+56: tmp = x / y elif x <= 1.06e-50: tmp = x / (x + 1.0) elif x <= 1.0: tmp = x * (x / y) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1e+56) tmp = Float64(x / y); elseif (x <= 1.06e-50) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.0) tmp = Float64(x * Float64(x / y)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1e+56) tmp = x / y; elseif (x <= 1.06e-50) tmp = x / (x + 1.0); elseif (x <= 1.0) tmp = x * (x / y); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.06e-50], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.06 \cdot 10^{-50}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.00000000000000009e56 or 1 < x Initial program 75.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 85.1%
if -1.00000000000000009e56 < x < 1.05999999999999995e-50Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 77.3%
if 1.05999999999999995e-50 < x < 1Initial program 99.5%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 75.6%
+-commutative75.6%
*-commutative75.6%
+-commutative75.6%
associate-/l*75.5%
Simplified75.5%
Taylor expanded in x around 0 68.4%
associate-/r/68.3%
Applied egg-rr68.3%
Final simplification80.8%
(FPCore (x y) :precision binary64 (if (<= x -1.4e+56) (/ x y) (if (<= x 5.2e-127) (/ x (+ x 1.0)) (if (<= x 1.0) (/ x (/ y x)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.4e+56) {
tmp = x / y;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = x / (y / x);
} else {
tmp = x / y;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1.4d+56)) then
tmp = x / y
else if (x <= 5.2d-127) then
tmp = x / (x + 1.0d0)
else if (x <= 1.0d0) then
tmp = x / (y / x)
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1.4e+56) {
tmp = x / y;
} else if (x <= 5.2e-127) {
tmp = x / (x + 1.0);
} else if (x <= 1.0) {
tmp = x / (y / x);
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1.4e+56: tmp = x / y elif x <= 5.2e-127: tmp = x / (x + 1.0) elif x <= 1.0: tmp = x / (y / x) else: tmp = x / y return tmp
function code(x, y) tmp = 0.0 if (x <= -1.4e+56) tmp = Float64(x / y); elseif (x <= 5.2e-127) tmp = Float64(x / Float64(x + 1.0)); elseif (x <= 1.0) tmp = Float64(x / Float64(y / x)); else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1.4e+56) tmp = x / y; elseif (x <= 5.2e-127) tmp = x / (x + 1.0); elseif (x <= 1.0) tmp = x / (y / x); else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1.4e+56], N[(x / y), $MachinePrecision], If[LessEqual[x, 5.2e-127], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.0], N[(x / N[(y / x), $MachinePrecision]), $MachinePrecision], N[(x / y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+56}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{-127}:\\
\;\;\;\;\frac{x}{x + 1}\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;\frac{x}{\frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1.40000000000000004e56 or 1 < x Initial program 75.7%
associate-/l*100.0%
Simplified100.0%
Taylor expanded in x around inf 85.1%
if -1.40000000000000004e56 < x < 5.19999999999999982e-127Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 79.8%
if 5.19999999999999982e-127 < x < 1Initial program 99.6%
associate-/l*99.5%
Simplified99.5%
Taylor expanded in y around 0 64.8%
+-commutative64.8%
*-commutative64.8%
+-commutative64.8%
associate-/l*64.6%
Simplified64.6%
Taylor expanded in x around 0 60.8%
Final simplification80.8%
(FPCore (x y) :precision binary64 (if (<= x -0.000112) 1.0 (if (<= x 0.00345) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -0.000112) {
tmp = 1.0;
} else if (x <= 0.00345) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-0.000112d0)) then
tmp = 1.0d0
else if (x <= 0.00345d0) then
tmp = x
else
tmp = 1.0d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -0.000112) {
tmp = 1.0;
} else if (x <= 0.00345) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -0.000112: tmp = 1.0 elif x <= 0.00345: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -0.000112) tmp = 1.0; elseif (x <= 0.00345) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -0.000112) tmp = 1.0; elseif (x <= 0.00345) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -0.000112], 1.0, If[LessEqual[x, 0.00345], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.000112:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 0.00345:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -1.11999999999999998e-4 or 0.0034499999999999999 < x Initial program 78.5%
distribute-lft-in78.5%
*-rgt-identity78.5%
Applied egg-rr78.5%
Taylor expanded in y around inf 20.2%
+-commutative20.2%
Simplified20.2%
Taylor expanded in x around inf 19.7%
if -1.11999999999999998e-4 < x < 0.0034499999999999999Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around 0 75.3%
Final simplification43.8%
(FPCore (x y) :precision binary64 1.0)
double code(double x, double y) {
return 1.0;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 1.0d0
end function
public static double code(double x, double y) {
return 1.0;
}
def code(x, y): return 1.0
function code(x, y) return 1.0 end
function tmp = code(x, y) tmp = 1.0; end
code[x_, y_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 87.7%
distribute-lft-in87.7%
*-rgt-identity87.7%
Applied egg-rr87.7%
Taylor expanded in y around inf 44.2%
+-commutative44.2%
Simplified44.2%
Taylor expanded in x around inf 12.7%
Final simplification12.7%
(FPCore (x y) :precision binary64 (* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0))))
double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x / 1.0d0) * (((x / y) + 1.0d0) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0));
}
def code(x, y): return (x / 1.0) * (((x / y) + 1.0) / (x + 1.0))
function code(x, y) return Float64(Float64(x / 1.0) * Float64(Float64(Float64(x / y) + 1.0) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = (x / 1.0) * (((x / y) + 1.0) / (x + 1.0)); end
code[x_, y_] := N[(N[(x / 1.0), $MachinePrecision] * N[(N[(N[(x / y), $MachinePrecision] + 1.0), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x}{1} \cdot \frac{\frac{x}{y} + 1}{x + 1}
\end{array}
herbie shell --seed 2023279
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:herbie-target
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))