
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
double code(double x) {
return (x - sin(x)) / (x - tan(x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x - sin(x)) / (x - tan(x))
end function
public static double code(double x) {
return (x - Math.sin(x)) / (x - Math.tan(x));
}
def code(x): return (x - math.sin(x)) / (x - math.tan(x))
function code(x) return Float64(Float64(x - sin(x)) / Float64(x - tan(x))) end
function tmp = code(x) tmp = (x - sin(x)) / (x - tan(x)); end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - \sin x}{x - \tan x}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x) :precision binary64 (/ (- x (sin x)) (- x (tan x))))
double code(double x) {
return (x - sin(x)) / (x - tan(x));
}
real(8) function code(x)
real(8), intent (in) :: x
code = (x - sin(x)) / (x - tan(x))
end function
public static double code(double x) {
return (x - Math.sin(x)) / (x - Math.tan(x));
}
def code(x): return (x - math.sin(x)) / (x - math.tan(x))
function code(x) return Float64(Float64(x - sin(x)) / Float64(x - tan(x))) end
function tmp = code(x) tmp = (x - sin(x)) / (x - tan(x)); end
code[x_] := N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x - \sin x}{x - \tan x}
\end{array}
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 0.0285) (+ (+ (* 0.225 (* x x)) (* -0.009642857142857142 (* (* x x) (* x x)))) -0.5) (/ (- x (sin x)) (- x (tan x)))))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 0.0285) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x - sin(x)) / (x - tan(x));
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 0.0285d0) then
tmp = ((0.225d0 * (x * x)) + ((-0.009642857142857142d0) * ((x * x) * (x * x)))) + (-0.5d0)
else
tmp = (x - sin(x)) / (x - tan(x))
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 0.0285) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x - Math.sin(x)) / (x - Math.tan(x));
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 0.0285: tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5 else: tmp = (x - math.sin(x)) / (x - math.tan(x)) return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 0.0285) tmp = Float64(Float64(Float64(0.225 * Float64(x * x)) + Float64(-0.009642857142857142 * Float64(Float64(x * x) * Float64(x * x)))) + -0.5); else tmp = Float64(Float64(x - sin(x)) / Float64(x - tan(x))); end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 0.0285) tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5; else tmp = (x - sin(x)) / (x - tan(x)); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 0.0285], N[(N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.009642857142857142 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(N[(x - N[Sin[x], $MachinePrecision]), $MachinePrecision] / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 0.0285:\\
\;\;\;\;\left(0.225 \cdot \left(x \cdot x\right) + -0.009642857142857142 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x - \sin x}{x - \tan x}\\
\end{array}
\end{array}
if x < 0.028500000000000001Initial program 33.0%
Taylor expanded in x around 0 67.5%
sub-neg67.5%
fma-def67.5%
unpow267.5%
metadata-eval67.5%
Simplified67.5%
fma-udef67.5%
Applied egg-rr67.5%
sqr-pow67.5%
metadata-eval67.5%
pow267.5%
metadata-eval67.5%
pow267.5%
Applied egg-rr67.5%
if 0.028500000000000001 < x Initial program 100.0%
Final simplification74.7%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 2.6) (+ (+ (* 0.225 (* x x)) (* -0.009642857142857142 (* (* x x) (* x x)))) -0.5) (+ 1.0 (/ (- (tan x) (sin x)) x))))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 2.6) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = 1.0 + ((tan(x) - sin(x)) / x);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.6d0) then
tmp = ((0.225d0 * (x * x)) + ((-0.009642857142857142d0) * ((x * x) * (x * x)))) + (-0.5d0)
else
tmp = 1.0d0 + ((tan(x) - sin(x)) / x)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 2.6) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = 1.0 + ((Math.tan(x) - Math.sin(x)) / x);
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 2.6: tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5 else: tmp = 1.0 + ((math.tan(x) - math.sin(x)) / x) return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 2.6) tmp = Float64(Float64(Float64(0.225 * Float64(x * x)) + Float64(-0.009642857142857142 * Float64(Float64(x * x) * Float64(x * x)))) + -0.5); else tmp = Float64(1.0 + Float64(Float64(tan(x) - sin(x)) / x)); end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 2.6) tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5; else tmp = 1.0 + ((tan(x) - sin(x)) / x); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 2.6], N[(N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.009642857142857142 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(1.0 + N[(N[(N[Tan[x], $MachinePrecision] - N[Sin[x], $MachinePrecision]), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.6:\\
\;\;\;\;\left(0.225 \cdot \left(x \cdot x\right) + -0.009642857142857142 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;1 + \frac{\tan x - \sin x}{x}\\
\end{array}
\end{array}
if x < 2.60000000000000009Initial program 33.0%
Taylor expanded in x around 0 67.5%
sub-neg67.5%
fma-def67.5%
unpow267.5%
metadata-eval67.5%
Simplified67.5%
fma-udef67.5%
Applied egg-rr67.5%
sqr-pow67.5%
metadata-eval67.5%
pow267.5%
metadata-eval67.5%
pow267.5%
Applied egg-rr67.5%
if 2.60000000000000009 < x Initial program 100.0%
Taylor expanded in x around inf 99.4%
associate--l+99.4%
sub-neg99.4%
*-lft-identity99.4%
metadata-eval99.4%
cancel-sign-sub-inv99.4%
distribute-lft-out--99.4%
mul-1-neg99.4%
remove-double-neg99.4%
associate-/r*99.4%
div-sub99.4%
mul-1-neg99.4%
unsub-neg99.4%
Simplified99.4%
tan-quot99.4%
sub-neg99.4%
Applied egg-rr99.4%
sub-neg99.4%
Simplified99.4%
Final simplification74.6%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 3.05) (+ (+ (* 0.225 (* x x)) (* -0.009642857142857142 (* (* x x) (* x x)))) -0.5) (- (/ x (- x (tan x))) (/ (/ -3.0 x) x))))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 3.05) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x / (x - tan(x))) - ((-3.0 / x) / x);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 3.05d0) then
tmp = ((0.225d0 * (x * x)) + ((-0.009642857142857142d0) * ((x * x) * (x * x)))) + (-0.5d0)
else
tmp = (x / (x - tan(x))) - (((-3.0d0) / x) / x)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 3.05) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x / (x - Math.tan(x))) - ((-3.0 / x) / x);
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 3.05: tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5 else: tmp = (x / (x - math.tan(x))) - ((-3.0 / x) / x) return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 3.05) tmp = Float64(Float64(Float64(0.225 * Float64(x * x)) + Float64(-0.009642857142857142 * Float64(Float64(x * x) * Float64(x * x)))) + -0.5); else tmp = Float64(Float64(x / Float64(x - tan(x))) - Float64(Float64(-3.0 / x) / x)); end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 3.05) tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5; else tmp = (x / (x - tan(x))) - ((-3.0 / x) / x); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 3.05], N[(N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.009642857142857142 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(N[(x / N[(x - N[Tan[x], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(-3.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.05:\\
\;\;\;\;\left(0.225 \cdot \left(x \cdot x\right) + -0.009642857142857142 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x - \tan x} - \frac{\frac{-3}{x}}{x}\\
\end{array}
\end{array}
if x < 3.0499999999999998Initial program 33.0%
Taylor expanded in x around 0 67.5%
sub-neg67.5%
fma-def67.5%
unpow267.5%
metadata-eval67.5%
Simplified67.5%
fma-udef67.5%
Applied egg-rr67.5%
sqr-pow67.5%
metadata-eval67.5%
pow267.5%
metadata-eval67.5%
pow267.5%
Applied egg-rr67.5%
if 3.0499999999999998 < x Initial program 100.0%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.7%
unpow298.7%
associate-/r*98.7%
Simplified98.7%
Final simplification74.4%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 3.1) (+ (+ (* 0.225 (* x x)) (* -0.009642857142857142 (* (* x x) (* x x)))) -0.5) (- (/ x x) (/ (/ -3.0 x) x))))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 3.1) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x / x) - ((-3.0 / x) / x);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 3.1d0) then
tmp = ((0.225d0 * (x * x)) + ((-0.009642857142857142d0) * ((x * x) * (x * x)))) + (-0.5d0)
else
tmp = (x / x) - (((-3.0d0) / x) / x)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 3.1) {
tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5;
} else {
tmp = (x / x) - ((-3.0 / x) / x);
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 3.1: tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5 else: tmp = (x / x) - ((-3.0 / x) / x) return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 3.1) tmp = Float64(Float64(Float64(0.225 * Float64(x * x)) + Float64(-0.009642857142857142 * Float64(Float64(x * x) * Float64(x * x)))) + -0.5); else tmp = Float64(Float64(x / x) - Float64(Float64(-3.0 / x) / x)); end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 3.1) tmp = ((0.225 * (x * x)) + (-0.009642857142857142 * ((x * x) * (x * x)))) + -0.5; else tmp = (x / x) - ((-3.0 / x) / x); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 3.1], N[(N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + N[(-0.009642857142857142 * N[(N[(x * x), $MachinePrecision] * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(N[(x / x), $MachinePrecision] - N[(N[(-3.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 3.1:\\
\;\;\;\;\left(0.225 \cdot \left(x \cdot x\right) + -0.009642857142857142 \cdot \left(\left(x \cdot x\right) \cdot \left(x \cdot x\right)\right)\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x} - \frac{\frac{-3}{x}}{x}\\
\end{array}
\end{array}
if x < 3.10000000000000009Initial program 33.0%
Taylor expanded in x around 0 67.5%
sub-neg67.5%
fma-def67.5%
unpow267.5%
metadata-eval67.5%
Simplified67.5%
fma-udef67.5%
Applied egg-rr67.5%
sqr-pow67.5%
metadata-eval67.5%
pow267.5%
metadata-eval67.5%
pow267.5%
Applied egg-rr67.5%
if 3.10000000000000009 < x Initial program 100.0%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.7%
unpow298.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in x around inf 98.7%
Final simplification74.5%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 2.9) (+ (* 0.225 (* x x)) -0.5) (- (/ x x) (/ (/ -3.0 x) x))))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 2.9) {
tmp = (0.225 * (x * x)) + -0.5;
} else {
tmp = (x / x) - ((-3.0 / x) / x);
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.9d0) then
tmp = (0.225d0 * (x * x)) + (-0.5d0)
else
tmp = (x / x) - (((-3.0d0) / x) / x)
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 2.9) {
tmp = (0.225 * (x * x)) + -0.5;
} else {
tmp = (x / x) - ((-3.0 / x) / x);
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 2.9: tmp = (0.225 * (x * x)) + -0.5 else: tmp = (x / x) - ((-3.0 / x) / x) return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 2.9) tmp = Float64(Float64(0.225 * Float64(x * x)) + -0.5); else tmp = Float64(Float64(x / x) - Float64(Float64(-3.0 / x) / x)); end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 2.9) tmp = (0.225 * (x * x)) + -0.5; else tmp = (x / x) - ((-3.0 / x) / x); end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 2.9], N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], N[(N[(x / x), $MachinePrecision] - N[(N[(-3.0 / x), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.9:\\
\;\;\;\;0.225 \cdot \left(x \cdot x\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{x} - \frac{\frac{-3}{x}}{x}\\
\end{array}
\end{array}
if x < 2.89999999999999991Initial program 33.0%
Taylor expanded in x around 0 68.8%
fma-neg68.8%
unpow268.8%
metadata-eval68.8%
Simplified68.8%
fma-udef68.8%
Applied egg-rr68.8%
if 2.89999999999999991 < x Initial program 100.0%
div-sub100.0%
Applied egg-rr100.0%
Taylor expanded in x around 0 98.7%
unpow298.7%
associate-/r*98.7%
Simplified98.7%
Taylor expanded in x around inf 98.7%
Final simplification75.4%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 2.6) (+ (* 0.225 (* x x)) -0.5) 1.0))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 2.6) {
tmp = (0.225 * (x * x)) + -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 2.6d0) then
tmp = (0.225d0 * (x * x)) + (-0.5d0)
else
tmp = 1.0d0
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 2.6) {
tmp = (0.225 * (x * x)) + -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 2.6: tmp = (0.225 * (x * x)) + -0.5 else: tmp = 1.0 return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 2.6) tmp = Float64(Float64(0.225 * Float64(x * x)) + -0.5); else tmp = 1.0; end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 2.6) tmp = (0.225 * (x * x)) + -0.5; else tmp = 1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 2.6], N[(N[(0.225 * N[(x * x), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision], 1.0]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 2.6:\\
\;\;\;\;0.225 \cdot \left(x \cdot x\right) + -0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 2.60000000000000009Initial program 33.0%
Taylor expanded in x around 0 68.8%
fma-neg68.8%
unpow268.8%
metadata-eval68.8%
Simplified68.8%
fma-udef68.8%
Applied egg-rr68.8%
if 2.60000000000000009 < x Initial program 100.0%
Taylor expanded in x around inf 98.7%
Final simplification75.4%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 (if (<= x 1.58) -0.5 1.0))
x = abs(x);
double code(double x) {
double tmp;
if (x <= 1.58) {
tmp = -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
real(8) :: tmp
if (x <= 1.58d0) then
tmp = -0.5d0
else
tmp = 1.0d0
end if
code = tmp
end function
x = Math.abs(x);
public static double code(double x) {
double tmp;
if (x <= 1.58) {
tmp = -0.5;
} else {
tmp = 1.0;
}
return tmp;
}
x = abs(x) def code(x): tmp = 0 if x <= 1.58: tmp = -0.5 else: tmp = 1.0 return tmp
x = abs(x) function code(x) tmp = 0.0 if (x <= 1.58) tmp = -0.5; else tmp = 1.0; end return tmp end
x = abs(x) function tmp_2 = code(x) tmp = 0.0; if (x <= 1.58) tmp = -0.5; else tmp = 1.0; end tmp_2 = tmp; end
NOTE: x should be positive before calling this function code[x_] := If[LessEqual[x, 1.58], -0.5, 1.0]
\begin{array}{l}
x = |x|\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq 1.58:\\
\;\;\;\;-0.5\\
\mathbf{else}:\\
\;\;\;\;1\\
\end{array}
\end{array}
if x < 1.5800000000000001Initial program 33.0%
Taylor expanded in x around 0 67.6%
if 1.5800000000000001 < x Initial program 100.0%
Taylor expanded in x around inf 98.7%
Final simplification74.5%
NOTE: x should be positive before calling this function (FPCore (x) :precision binary64 -0.5)
x = abs(x);
double code(double x) {
return -0.5;
}
NOTE: x should be positive before calling this function
real(8) function code(x)
real(8), intent (in) :: x
code = -0.5d0
end function
x = Math.abs(x);
public static double code(double x) {
return -0.5;
}
x = abs(x) def code(x): return -0.5
x = abs(x) function code(x) return -0.5 end
x = abs(x) function tmp = code(x) tmp = -0.5; end
NOTE: x should be positive before calling this function code[x_] := -0.5
\begin{array}{l}
x = |x|\\
\\
-0.5
\end{array}
Initial program 47.9%
Taylor expanded in x around 0 52.9%
Final simplification52.9%
herbie shell --seed 2023274
(FPCore (x)
:name "sintan (problem 3.4.5)"
:precision binary64
(/ (- x (sin x)) (- x (tan x))))