
(FPCore (x) :precision binary64 :pre TRUE (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x): return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x) return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) end
function tmp = code(x) tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x))); end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = ((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x)))) END code
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 :pre TRUE (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))
double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)));
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = (6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))
end function
public static double code(double x) {
return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)));
}
def code(x): return (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))
function code(x) return Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) end
function tmp = code(x) tmp = (6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x))); end
code[x_] := N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = ((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x)))) END code
\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}}
(FPCore (x) :precision binary64 :pre TRUE (* -6.0 (/ (- 1.0 x) (fma (sqrt x) 4.0 (+ 1.0 x)))))
double code(double x) {
return -6.0 * ((1.0 - x) / fma(sqrt(x), 4.0, (1.0 + x)));
}
function code(x) return Float64(-6.0 * Float64(Float64(1.0 - x) / fma(sqrt(x), 4.0, Float64(1.0 + x)))) end
code[x_] := N[(-6.0 * N[(N[(1.0 - x), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] * 4.0 + N[(1.0 + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = (-6) * (((1) - x) / (((sqrt(x)) * (4)) + ((1) + x))) END code
-6 \cdot \frac{1 - x}{\mathsf{fma}\left(\sqrt{x}, 4, 1 + x\right)}
Initial program 99.7%
Applied rewrites99.9%
(FPCore (x) :precision binary64 :pre TRUE (/ (fma -6.0 x 6.0) (fma -4.0 (sqrt x) (- -1.0 x))))
double code(double x) {
return fma(-6.0, x, 6.0) / fma(-4.0, sqrt(x), (-1.0 - x));
}
function code(x) return Float64(fma(-6.0, x, 6.0) / fma(-4.0, sqrt(x), Float64(-1.0 - x))) end
code[x_] := N[(N[(-6.0 * x + 6.0), $MachinePrecision] / N[(-4.0 * N[Sqrt[x], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = (((-6) * x) + (6)) / (((-4) * (sqrt(x))) + ((-1) - x)) END code
\frac{\mathsf{fma}\left(-6, x, 6\right)}{\mathsf{fma}\left(-4, \sqrt{x}, -1 - x\right)}
Initial program 99.7%
Applied rewrites99.7%
(FPCore (x)
:precision binary64
:pre TRUE
(let* ((t_0 (* 6.0 (- x 1.0))))
(if (<= (/ t_0 (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0)
(/ t_0 (fma 4.0 (sqrt x) 1.0))
(/ 6.0 (- (/ 4.0 (sqrt x)) -1.0)))))double code(double x) {
double t_0 = 6.0 * (x - 1.0);
double tmp;
if ((t_0 / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = t_0 / fma(4.0, sqrt(x), 1.0);
} else {
tmp = 6.0 / ((4.0 / sqrt(x)) - -1.0);
}
return tmp;
}
function code(x) t_0 = Float64(6.0 * Float64(x - 1.0)) tmp = 0.0 if (Float64(t_0 / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(t_0 / fma(4.0, sqrt(x), 1.0)); else tmp = Float64(6.0 / Float64(Float64(4.0 / sqrt(x)) - -1.0)); end return tmp end
code[x_] := Block[{t$95$0 = N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$0 / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(t$95$0 / N[(4.0 * N[Sqrt[x], $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET t_0 = ((6) * (x - (1))) IN LET tmp = IF ((t_0 / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN (t_0 / (((4) * (sqrt(x))) + (1))) ELSE ((6) / (((4) / (sqrt(x))) - (-1))) ENDIF IN tmp END code
\begin{array}{l}
t_0 := 6 \cdot \left(x - 1\right)\\
\mathbf{if}\;\frac{t\_0}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{t\_0}{\mathsf{fma}\left(4, \sqrt{x}, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{4}{\sqrt{x}} - -1}\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites51.7%
Applied rewrites51.7%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Applied rewrites50.4%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (/ (fma x 6.0 -6.0) (fma (sqrt x) 4.0 1.0)) (/ 6.0 (- (/ 4.0 (sqrt x)) -1.0))))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = fma(x, 6.0, -6.0) / fma(sqrt(x), 4.0, 1.0);
} else {
tmp = 6.0 / ((4.0 / sqrt(x)) - -1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(fma(x, 6.0, -6.0) / fma(sqrt(x), 4.0, 1.0)); else tmp = Float64(6.0 / Float64(Float64(4.0 / sqrt(x)) - -1.0)); end return tmp end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(N[(x * 6.0 + -6.0), $MachinePrecision] / N[(N[Sqrt[x], $MachinePrecision] * 4.0 + 1.0), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN (((x * (6)) + (-6)) / (((sqrt(x)) * (4)) + (1))) ELSE ((6) / (((4) / (sqrt(x))) - (-1))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{\mathsf{fma}\left(x, 6, -6\right)}{\mathsf{fma}\left(\sqrt{x}, 4, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{4}{\sqrt{x}} - -1}\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites51.7%
Applied rewrites51.7%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Applied rewrites50.4%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (/ 6.0 (fma -4.0 (sqrt x) (- -1.0 x))) (/ 6.0 (- (/ 4.0 (sqrt x)) -1.0))))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = 6.0 / fma(-4.0, sqrt(x), (-1.0 - x));
} else {
tmp = 6.0 / ((4.0 / sqrt(x)) - -1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(6.0 / fma(-4.0, sqrt(x), Float64(-1.0 - x))); else tmp = Float64(6.0 / Float64(Float64(4.0 / sqrt(x)) - -1.0)); end return tmp end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(6.0 / N[(-4.0 * N[Sqrt[x], $MachinePrecision] + N[(-1.0 - x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN ((6) / (((-4) * (sqrt(x))) + ((-1) - x))) ELSE ((6) / (((4) / (sqrt(x))) - (-1))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{6}{\mathsf{fma}\left(-4, \sqrt{x}, -1 - x\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{4}{\sqrt{x}} - -1}\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Applied rewrites99.7%
Taylor expanded in x around 0
Applied rewrites49.3%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Applied rewrites50.4%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (/ 1.0 (fma (sqrt x) -0.6666666666666666 -0.16666666666666666)) (/ 6.0 (- (/ 4.0 (sqrt x)) -1.0))))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = 1.0 / fma(sqrt(x), -0.6666666666666666, -0.16666666666666666);
} else {
tmp = 6.0 / ((4.0 / sqrt(x)) - -1.0);
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(1.0 / fma(sqrt(x), -0.6666666666666666, -0.16666666666666666)); else tmp = Float64(6.0 / Float64(Float64(4.0 / sqrt(x)) - -1.0)); end return tmp end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] * -0.6666666666666666 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision], N[(6.0 / N[(N[(4.0 / N[Sqrt[x], $MachinePrecision]), $MachinePrecision] - -1.0), $MachinePrecision]), $MachinePrecision]]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN ((1) / (((sqrt(x)) * (-66666666666666662965923251249478198587894439697265625e-53)) + (-1666666666666666574148081281236954964697360992431640625e-55))) ELSE ((6) / (((4) / (sqrt(x))) - (-1))) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt{x}, -0.6666666666666666, -0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{6}{\frac{4}{\sqrt{x}} - -1}\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites49.0%
Applied rewrites49.0%
Applied rewrites49.0%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Applied rewrites50.4%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (/ 1.0 (fma (sqrt x) -0.6666666666666666 -0.16666666666666666)) 6.0))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = 1.0 / fma(sqrt(x), -0.6666666666666666, -0.16666666666666666);
} else {
tmp = 6.0;
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(1.0 / fma(sqrt(x), -0.6666666666666666, -0.16666666666666666)); else tmp = 6.0; end return tmp end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(1.0 / N[(N[Sqrt[x], $MachinePrecision] * -0.6666666666666666 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision], 6.0]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN ((1) / (((sqrt(x)) * (-66666666666666662965923251249478198587894439697265625e-53)) + (-1666666666666666574148081281236954964697360992431640625e-55))) ELSE (6) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(\sqrt{x}, -0.6666666666666666, -0.16666666666666666\right)}\\
\mathbf{else}:\\
\;\;\;\;6\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites49.0%
Applied rewrites49.0%
Applied rewrites49.0%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites4.5%
Applied rewrites4.5%
Taylor expanded in x around inf
Applied rewrites49.1%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (/ -6.0 (fma (sqrt x) 4.0 1.0)) 6.0))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = -6.0 / fma(sqrt(x), 4.0, 1.0);
} else {
tmp = 6.0;
}
return tmp;
}
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(-6.0 / fma(sqrt(x), 4.0, 1.0)); else tmp = 6.0; end return tmp end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(-6.0 / N[(N[Sqrt[x], $MachinePrecision] * 4.0 + 1.0), $MachinePrecision]), $MachinePrecision], 6.0]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN ((-6) / (((sqrt(x)) * (4)) + (1))) ELSE (6) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\frac{-6}{\mathsf{fma}\left(\sqrt{x}, 4, 1\right)}\\
\mathbf{else}:\\
\;\;\;\;6\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around 0
Applied rewrites49.0%
Applied rewrites49.0%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites4.5%
Applied rewrites4.5%
Taylor expanded in x around inf
Applied rewrites49.1%
(FPCore (x) :precision binary64 :pre TRUE (if (<= (/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))) -1.0) (* (sqrt x) -1.5) 6.0))
double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) {
tmp = sqrt(x) * -1.5;
} else {
tmp = 6.0;
}
return tmp;
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
real(8) :: tmp
if (((6.0d0 * (x - 1.0d0)) / ((x + 1.0d0) + (4.0d0 * sqrt(x)))) <= (-1.0d0)) then
tmp = sqrt(x) * (-1.5d0)
else
tmp = 6.0d0
end if
code = tmp
end function
public static double code(double x) {
double tmp;
if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * Math.sqrt(x)))) <= -1.0) {
tmp = Math.sqrt(x) * -1.5;
} else {
tmp = 6.0;
}
return tmp;
}
def code(x): tmp = 0 if ((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * math.sqrt(x)))) <= -1.0: tmp = math.sqrt(x) * -1.5 else: tmp = 6.0 return tmp
function code(x) tmp = 0.0 if (Float64(Float64(6.0 * Float64(x - 1.0)) / Float64(Float64(x + 1.0) + Float64(4.0 * sqrt(x)))) <= -1.0) tmp = Float64(sqrt(x) * -1.5); else tmp = 6.0; end return tmp end
function tmp_2 = code(x) tmp = 0.0; if (((6.0 * (x - 1.0)) / ((x + 1.0) + (4.0 * sqrt(x)))) <= -1.0) tmp = sqrt(x) * -1.5; else tmp = 6.0; end tmp_2 = tmp; end
code[x_] := If[LessEqual[N[(N[(6.0 * N[(x - 1.0), $MachinePrecision]), $MachinePrecision] / N[(N[(x + 1.0), $MachinePrecision] + N[(4.0 * N[Sqrt[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], N[(N[Sqrt[x], $MachinePrecision] * -1.5), $MachinePrecision], 6.0]
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = LET tmp = IF ((((6) * (x - (1))) / ((x + (1)) + ((4) * (sqrt(x))))) <= (-1)) THEN ((sqrt(x)) * (-15e-1)) ELSE (6) ENDIF IN tmp END code
\begin{array}{l}
\mathbf{if}\;\frac{6 \cdot \left(x - 1\right)}{\left(x + 1\right) + 4 \cdot \sqrt{x}} \leq -1:\\
\;\;\;\;\sqrt{x} \cdot -1.5\\
\mathbf{else}:\\
\;\;\;\;6\\
\end{array}
if (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) < -1Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites4.5%
Taylor expanded in x around -inf
Applied rewrites4.1%
Applied rewrites4.1%
if -1 < (/.f64 (*.f64 #s(literal 6 binary64) (-.f64 x #s(literal 1 binary64))) (+.f64 (+.f64 x #s(literal 1 binary64)) (*.f64 #s(literal 4 binary64) (sqrt.f64 x)))) Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites4.5%
Applied rewrites4.5%
Taylor expanded in x around inf
Applied rewrites49.1%
(FPCore (x) :precision binary64 :pre TRUE 6.0)
double code(double x) {
return 6.0;
}
real(8) function code(x)
use fmin_fmax_functions
real(8), intent (in) :: x
code = 6.0d0
end function
public static double code(double x) {
return 6.0;
}
def code(x): return 6.0
function code(x) return 6.0 end
function tmp = code(x) tmp = 6.0; end
code[x_] := 6.0
f(x): x in [-inf, +inf] code: THEORY BEGIN f(x: real): real = 6 END code
6
Initial program 99.7%
Taylor expanded in x around inf
Applied rewrites50.4%
Taylor expanded in x around 0
Applied rewrites4.5%
Applied rewrites4.5%
Taylor expanded in x around inf
Applied rewrites49.1%
herbie shell --seed 2026092
(FPCore (x)
:name "Data.Approximate.Numerics:blog from approximate-0.2.2.1"
:precision binary64
(/ (* 6.0 (- x 1.0)) (+ (+ x 1.0) (* 4.0 (sqrt x)))))