
(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 9 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 89.0%
associate-/l*99.9%
Simplified99.9%
clear-num99.8%
un-div-inv99.9%
Applied egg-rr99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ x (+ x 1.0))))
(if (<= x -5.6e+14)
(/ x y)
(if (<= x 4.3e-62)
t_0
(if (<= x 2.3e-24) (* x (/ x y)) (if (<= x 2.4e+21) t_0 (/ x y)))))))
double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -5.6e+14) {
tmp = x / y;
} else if (x <= 4.3e-62) {
tmp = t_0;
} else if (x <= 2.3e-24) {
tmp = x * (x / y);
} else if (x <= 2.4e+21) {
tmp = t_0;
} else {
tmp = x / y;
}
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 / (x + 1.0d0)
if (x <= (-5.6d+14)) then
tmp = x / y
else if (x <= 4.3d-62) then
tmp = t_0
else if (x <= 2.3d-24) then
tmp = x * (x / y)
else if (x <= 2.4d+21) then
tmp = t_0
else
tmp = x / y
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = x / (x + 1.0);
double tmp;
if (x <= -5.6e+14) {
tmp = x / y;
} else if (x <= 4.3e-62) {
tmp = t_0;
} else if (x <= 2.3e-24) {
tmp = x * (x / y);
} else if (x <= 2.4e+21) {
tmp = t_0;
} else {
tmp = x / y;
}
return tmp;
}
def code(x, y): t_0 = x / (x + 1.0) tmp = 0 if x <= -5.6e+14: tmp = x / y elif x <= 4.3e-62: tmp = t_0 elif x <= 2.3e-24: tmp = x * (x / y) elif x <= 2.4e+21: tmp = t_0 else: tmp = x / y return tmp
function code(x, y) t_0 = Float64(x / Float64(x + 1.0)) tmp = 0.0 if (x <= -5.6e+14) tmp = Float64(x / y); elseif (x <= 4.3e-62) tmp = t_0; elseif (x <= 2.3e-24) tmp = Float64(x * Float64(x / y)); elseif (x <= 2.4e+21) tmp = t_0; else tmp = Float64(x / y); end return tmp end
function tmp_2 = code(x, y) t_0 = x / (x + 1.0); tmp = 0.0; if (x <= -5.6e+14) tmp = x / y; elseif (x <= 4.3e-62) tmp = t_0; elseif (x <= 2.3e-24) tmp = x * (x / y); elseif (x <= 2.4e+21) tmp = t_0; else tmp = x / y; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e+14], N[(x / y), $MachinePrecision], If[LessEqual[x, 4.3e-62], t$95$0, If[LessEqual[x, 2.3e-24], N[(x * N[(x / y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e+21], t$95$0, N[(x / y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x}{x + 1}\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+14}:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 4.3 \cdot 10^{-62}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{-24}:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{+21}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -5.6e14 or 2.4e21 < x Initial program 71.5%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 76.4%
if -5.6e14 < x < 4.2999999999999997e-62 or 2.3000000000000001e-24 < x < 2.4e21Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 81.9%
if 4.2999999999999997e-62 < x < 2.3000000000000001e-24Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 67.0%
clear-num66.7%
un-div-inv67.0%
+-commutative67.0%
*-commutative67.0%
associate-/l*67.0%
Applied egg-rr67.0%
Taylor expanded in x around 0 67.0%
associate-/r/67.0%
Applied egg-rr67.0%
Final simplification79.0%
(FPCore (x y) :precision binary64 (if (or (<= x -6.4e-6) (not (<= x 0.07))) (/ x (+ y (/ y x))) (* x (+ 1.0 (* x (+ (/ 1.0 y) -1.0))))))
double code(double x, double y) {
double tmp;
if ((x <= -6.4e-6) || !(x <= 0.07)) {
tmp = x / (y + (y / x));
} else {
tmp = x * (1.0 + (x * ((1.0 / y) + -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 <= (-6.4d-6)) .or. (.not. (x <= 0.07d0))) then
tmp = x / (y + (y / x))
else
tmp = x * (1.0d0 + (x * ((1.0d0 / y) + (-1.0d0))))
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -6.4e-6) || !(x <= 0.07)) {
tmp = x / (y + (y / x));
} else {
tmp = x * (1.0 + (x * ((1.0 / y) + -1.0)));
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -6.4e-6) or not (x <= 0.07): tmp = x / (y + (y / x)) else: tmp = x * (1.0 + (x * ((1.0 / y) + -1.0))) return tmp
function code(x, y) tmp = 0.0 if ((x <= -6.4e-6) || !(x <= 0.07)) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = Float64(x * Float64(1.0 + Float64(x * Float64(Float64(1.0 / y) + -1.0)))); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -6.4e-6) || ~((x <= 0.07))) tmp = x / (y + (y / x)); else tmp = x * (1.0 + (x * ((1.0 / y) + -1.0))); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -6.4e-6], N[Not[LessEqual[x, 0.07]], $MachinePrecision]], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(1.0 + N[(x * N[(N[(1.0 / y), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6.4 \cdot 10^{-6} \lor \neg \left(x \leq 0.07\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(1 + x \cdot \left(\frac{1}{y} + -1\right)\right)\\
\end{array}
\end{array}
if x < -6.3999999999999997e-6 or 0.070000000000000007 < x Initial program 74.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 65.7%
clear-num65.8%
un-div-inv65.9%
+-commutative65.9%
*-commutative65.9%
associate-/l*74.8%
Applied egg-rr74.8%
*-commutative74.8%
+-commutative74.8%
distribute-rgt-in67.4%
*-un-lft-identity67.4%
associate-/l*65.9%
*-commutative65.9%
associate-/l*75.0%
*-inverses75.0%
*-commutative75.0%
*-un-lft-identity75.0%
Applied egg-rr75.0%
if -6.3999999999999997e-6 < x < 0.070000000000000007Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 99.9%
Final simplification89.4%
(FPCore (x y) :precision binary64 (if (<= x -1.0) (/ x y) (if (<= x 1.35e-66) x (if (<= x 1.0) (* x (/ x y)) (/ x y)))))
double code(double x, double y) {
double tmp;
if (x <= -1.0) {
tmp = x / y;
} else if (x <= 1.35e-66) {
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 <= (-1.0d0)) then
tmp = x / y
else if (x <= 1.35d-66) 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 <= -1.0) {
tmp = x / y;
} else if (x <= 1.35e-66) {
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 <= -1.0: tmp = x / y elif x <= 1.35e-66: 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 <= -1.0) tmp = Float64(x / y); elseif (x <= 1.35e-66) 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 <= -1.0) tmp = x / y; elseif (x <= 1.35e-66) 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, -1.0], N[(x / y), $MachinePrecision], If[LessEqual[x, 1.35e-66], 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:\\
\;\;\;\;\frac{x}{y}\\
\mathbf{elif}\;x \leq 1.35 \cdot 10^{-66}:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 1:\\
\;\;\;\;x \cdot \frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{y}\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 73.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 72.5%
if -1 < x < 1.34999999999999998e-66Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 84.0%
if 1.34999999999999998e-66 < x < 1Initial program 99.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 62.4%
clear-num62.2%
un-div-inv62.4%
+-commutative62.4%
*-commutative62.4%
associate-/l*62.4%
Applied egg-rr62.4%
Taylor expanded in x around 0 62.4%
associate-/r/62.4%
Applied egg-rr62.4%
Final simplification78.0%
(FPCore (x y) :precision binary64 (if (or (<= x -1.1e-10) (not (<= x 3.9e-65))) (/ x (+ y (/ y x))) (/ x (+ x 1.0))))
double code(double x, double y) {
double tmp;
if ((x <= -1.1e-10) || !(x <= 3.9e-65)) {
tmp = x / (y + (y / x));
} else {
tmp = x / (x + 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 <= (-1.1d-10)) .or. (.not. (x <= 3.9d-65))) then
tmp = x / (y + (y / x))
else
tmp = x / (x + 1.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if ((x <= -1.1e-10) || !(x <= 3.9e-65)) {
tmp = x / (y + (y / x));
} else {
tmp = x / (x + 1.0);
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.1e-10) or not (x <= 3.9e-65): tmp = x / (y + (y / x)) else: tmp = x / (x + 1.0) return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.1e-10) || !(x <= 3.9e-65)) tmp = Float64(x / Float64(y + Float64(y / x))); else tmp = Float64(x / Float64(x + 1.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.1e-10) || ~((x <= 3.9e-65))) tmp = x / (y + (y / x)); else tmp = x / (x + 1.0); end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.1e-10], N[Not[LessEqual[x, 3.9e-65]], $MachinePrecision]], N[(x / N[(y + N[(y / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.1 \cdot 10^{-10} \lor \neg \left(x \leq 3.9 \cdot 10^{-65}\right):\\
\;\;\;\;\frac{x}{y + \frac{y}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x + 1}\\
\end{array}
\end{array}
if x < -1.09999999999999995e-10 or 3.9000000000000004e-65 < x Initial program 77.0%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around 0 65.3%
clear-num65.4%
un-div-inv65.5%
+-commutative65.5%
*-commutative65.5%
associate-/l*73.4%
Applied egg-rr73.4%
*-commutative73.4%
+-commutative73.4%
distribute-rgt-in66.9%
*-un-lft-identity66.9%
associate-/l*65.5%
*-commutative65.5%
associate-/l*73.5%
*-inverses73.5%
*-commutative73.5%
*-un-lft-identity73.5%
Applied egg-rr73.5%
if -1.09999999999999995e-10 < x < 3.9000000000000004e-65Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 84.8%
Final simplification79.4%
(FPCore (x y) :precision binary64 (if (or (<= x -1.0) (not (<= x 1.0))) (/ x y) x))
double code(double x, double y) {
double tmp;
if ((x <= -1.0) || !(x <= 1.0)) {
tmp = x / y;
} else {
tmp = 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 = x / y
else
tmp = 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 = x / y;
} else {
tmp = x;
}
return tmp;
}
def code(x, y): tmp = 0 if (x <= -1.0) or not (x <= 1.0): tmp = x / y else: tmp = x return tmp
function code(x, y) tmp = 0.0 if ((x <= -1.0) || !(x <= 1.0)) tmp = Float64(x / y); else tmp = x; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if ((x <= -1.0) || ~((x <= 1.0))) tmp = x / y; else tmp = x; end tmp_2 = tmp; end
code[x_, y_] := If[Or[LessEqual[x, -1.0], N[Not[LessEqual[x, 1.0]], $MachinePrecision]], N[(x / y), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \lor \neg \left(x \leq 1\right):\\
\;\;\;\;\frac{x}{y}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -1 or 1 < x Initial program 73.8%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in x around inf 72.5%
if -1 < x < 1Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 79.2%
Final simplification76.4%
(FPCore (x y) :precision binary64 (if (<= x -740000000000.0) 1.0 (if (<= x 44.0) x 1.0)))
double code(double x, double y) {
double tmp;
if (x <= -740000000000.0) {
tmp = 1.0;
} else if (x <= 44.0) {
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 <= (-740000000000.0d0)) then
tmp = 1.0d0
else if (x <= 44.0d0) 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 <= -740000000000.0) {
tmp = 1.0;
} else if (x <= 44.0) {
tmp = x;
} else {
tmp = 1.0;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -740000000000.0: tmp = 1.0 elif x <= 44.0: tmp = x else: tmp = 1.0 return tmp
function code(x, y) tmp = 0.0 if (x <= -740000000000.0) tmp = 1.0; elseif (x <= 44.0) tmp = x; else tmp = 1.0; end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -740000000000.0) tmp = 1.0; elseif (x <= 44.0) tmp = x; else tmp = 1.0; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -740000000000.0], 1.0, If[LessEqual[x, 44.0], x, 1.0]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -740000000000:\\
\;\;\;\;1\\
\mathbf{elif}\;x \leq 44:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < -7.4e11 or 44 < x Initial program 73.1%
associate-/l*99.8%
Simplified99.8%
Taylor expanded in y around inf 28.2%
Taylor expanded in x around inf 27.6%
if -7.4e11 < x < 44Initial program 99.9%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in x around 0 77.7%
(FPCore (x y) :precision binary64 (* x (/ (+ 1.0 (/ x y)) (+ x 1.0))))
double code(double x, double y) {
return x * ((1.0 + (x / y)) / (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)) / (x + 1.0d0))
end function
public static double code(double x, double y) {
return x * ((1.0 + (x / y)) / (x + 1.0));
}
def code(x, y): return x * ((1.0 + (x / y)) / (x + 1.0))
function code(x, y) return Float64(x * Float64(Float64(1.0 + Float64(x / y)) / Float64(x + 1.0))) end
function tmp = code(x, y) tmp = x * ((1.0 + (x / y)) / (x + 1.0)); end
code[x_, y_] := N[(x * N[(N[(1.0 + N[(x / y), $MachinePrecision]), $MachinePrecision] / N[(x + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \frac{1 + \frac{x}{y}}{x + 1}
\end{array}
Initial program 89.0%
associate-/l*99.9%
Simplified99.9%
Final simplification99.9%
(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 89.0%
associate-/l*99.9%
Simplified99.9%
Taylor expanded in y around inf 57.7%
Taylor expanded in x around inf 13.4%
(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 2024101
(FPCore (x y)
:name "Codec.Picture.Types:toneMapping from JuicyPixels-3.2.6.1"
:precision binary64
:alt
(* (/ x 1.0) (/ (+ (/ x y) 1.0) (+ x 1.0)))
(/ (* x (+ (/ x y) 1.0)) (+ x 1.0)))