
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
(FPCore (x y z a)
:precision binary64
(+
(/
(+
(/ (pow (tan y) 2.0) (- (tan y) (tan z)))
(/ (pow (tan z) 2.0) (- (tan z) (tan y))))
(- 1.0 (* (tan y) (tan z))))
(- x (tan a))))
double code(double x, double y, double z, double a) {
return (((pow(tan(y), 2.0) / (tan(y) - tan(z))) + (pow(tan(z), 2.0) / (tan(z) - tan(y)))) / (1.0 - (tan(y) * tan(z)))) + (x - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = ((((tan(y) ** 2.0d0) / (tan(y) - tan(z))) + ((tan(z) ** 2.0d0) / (tan(z) - tan(y)))) / (1.0d0 - (tan(y) * tan(z)))) + (x - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return (((Math.pow(Math.tan(y), 2.0) / (Math.tan(y) - Math.tan(z))) + (Math.pow(Math.tan(z), 2.0) / (Math.tan(z) - Math.tan(y)))) / (1.0 - (Math.tan(y) * Math.tan(z)))) + (x - Math.tan(a));
}
def code(x, y, z, a): return (((math.pow(math.tan(y), 2.0) / (math.tan(y) - math.tan(z))) + (math.pow(math.tan(z), 2.0) / (math.tan(z) - math.tan(y)))) / (1.0 - (math.tan(y) * math.tan(z)))) + (x - math.tan(a))
function code(x, y, z, a) return Float64(Float64(Float64(Float64((tan(y) ^ 2.0) / Float64(tan(y) - tan(z))) + Float64((tan(z) ^ 2.0) / Float64(tan(z) - tan(y)))) / Float64(1.0 - Float64(tan(y) * tan(z)))) + Float64(x - tan(a))) end
function tmp = code(x, y, z, a) tmp = ((((tan(y) ^ 2.0) / (tan(y) - tan(z))) + ((tan(z) ^ 2.0) / (tan(z) - tan(y)))) / (1.0 - (tan(y) * tan(z)))) + (x - tan(a)); end
code[x_, y_, z_, a_] := N[(N[(N[(N[(N[Power[N[Tan[y], $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Tan[y], $MachinePrecision] - N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Tan[z], $MachinePrecision], 2.0], $MachinePrecision] / N[(N[Tan[z], $MachinePrecision] - N[Tan[y], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\frac{{\tan y}^{2}}{\tan y - \tan z} + \frac{{\tan z}^{2}}{\tan z - \tan y}}{1 - \tan y \cdot \tan z} + \left(x - \tan a\right)
\end{array}
Initial program 81.1%
+-commutative81.1%
associate-+l-81.1%
tan-sum99.7%
div-inv99.6%
fmm-def99.7%
Applied egg-rr99.7%
fmm-undef99.6%
add-cube-cbrt97.9%
prod-diff97.9%
pow297.9%
Applied egg-rr97.9%
Simplified99.7%
flip-+99.6%
div-sub99.7%
pow299.7%
pow299.7%
Applied egg-rr99.7%
Taylor expanded in x around 0 99.7%
Final simplification99.7%
(FPCore (x y z a)
:precision binary64
(if (<= (tan a) -0.01)
(+ x (- (tan (+ y z)) (tan a)))
(if (<= (tan a) 5e-51)
(+ x (- (* (+ (tan y) (tan z)) (/ -1.0 (+ (* (tan y) (tan z)) -1.0))) a))
(+ (/ (sin (+ y z)) (cos (+ y z))) (- x (tan a))))))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -0.01) {
tmp = x + (tan((y + z)) - tan(a));
} else if (tan(a) <= 5e-51) {
tmp = x + (((tan(y) + tan(z)) * (-1.0 / ((tan(y) * tan(z)) + -1.0))) - a);
} else {
tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (tan(a) <= (-0.01d0)) then
tmp = x + (tan((y + z)) - tan(a))
else if (tan(a) <= 5d-51) then
tmp = x + (((tan(y) + tan(z)) * ((-1.0d0) / ((tan(y) * tan(z)) + (-1.0d0)))) - a)
else
tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -0.01) {
tmp = x + (Math.tan((y + z)) - Math.tan(a));
} else if (Math.tan(a) <= 5e-51) {
tmp = x + (((Math.tan(y) + Math.tan(z)) * (-1.0 / ((Math.tan(y) * Math.tan(z)) + -1.0))) - a);
} else {
tmp = (Math.sin((y + z)) / Math.cos((y + z))) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -0.01: tmp = x + (math.tan((y + z)) - math.tan(a)) elif math.tan(a) <= 5e-51: tmp = x + (((math.tan(y) + math.tan(z)) * (-1.0 / ((math.tan(y) * math.tan(z)) + -1.0))) - a) else: tmp = (math.sin((y + z)) / math.cos((y + z))) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -0.01) tmp = Float64(x + Float64(tan(Float64(y + z)) - tan(a))); elseif (tan(a) <= 5e-51) tmp = Float64(x + Float64(Float64(Float64(tan(y) + tan(z)) * Float64(-1.0 / Float64(Float64(tan(y) * tan(z)) + -1.0))) - a)); else tmp = Float64(Float64(sin(Float64(y + z)) / cos(Float64(y + z))) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (tan(a) <= -0.01) tmp = x + (tan((y + z)) - tan(a)); elseif (tan(a) <= 5e-51) tmp = x + (((tan(y) + tan(z)) * (-1.0 / ((tan(y) * tan(z)) + -1.0))) - a); else tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-51], N[(x + N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-51}:\\
\;\;\;\;x + \left(\left(\tan y + \tan z\right) \cdot \frac{-1}{\tan y \cdot \tan z + -1} - a\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)} + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002Initial program 83.6%
if -0.0100000000000000002 < (tan.f64 a) < 5.00000000000000004e-51Initial program 81.4%
Taylor expanded in a around 0 81.4%
tan-sum99.8%
div-inv99.8%
Applied egg-rr99.8%
if 5.00000000000000004e-51 < (tan.f64 a) Initial program 77.9%
+-commutative77.9%
sub-neg77.9%
associate-+l+78.0%
tan-quot78.0%
div-inv77.9%
fma-define77.9%
neg-mul-177.9%
fma-define77.9%
Applied egg-rr77.9%
fma-undefine77.9%
neg-mul-177.9%
neg-sub077.9%
associate-+l-77.9%
neg-sub077.9%
fmm-undef77.9%
associate-*r/78.0%
*-rgt-identity78.0%
Simplified78.0%
Final simplification89.3%
(FPCore (x y z a)
:precision binary64
(if (<= (tan a) -0.01)
(+ x (- (tan (+ y z)) (tan a)))
(if (<= (tan a) 5e-51)
(- x (+ a (/ (+ (tan y) (tan z)) (+ (* (tan y) (tan z)) -1.0))))
(+ (/ (sin (+ y z)) (cos (+ y z))) (- x (tan a))))))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -0.01) {
tmp = x + (tan((y + z)) - tan(a));
} else if (tan(a) <= 5e-51) {
tmp = x - (a + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + -1.0)));
} else {
tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (tan(a) <= (-0.01d0)) then
tmp = x + (tan((y + z)) - tan(a))
else if (tan(a) <= 5d-51) then
tmp = x - (a + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + (-1.0d0))))
else
tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -0.01) {
tmp = x + (Math.tan((y + z)) - Math.tan(a));
} else if (Math.tan(a) <= 5e-51) {
tmp = x - (a + ((Math.tan(y) + Math.tan(z)) / ((Math.tan(y) * Math.tan(z)) + -1.0)));
} else {
tmp = (Math.sin((y + z)) / Math.cos((y + z))) + (x - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -0.01: tmp = x + (math.tan((y + z)) - math.tan(a)) elif math.tan(a) <= 5e-51: tmp = x - (a + ((math.tan(y) + math.tan(z)) / ((math.tan(y) * math.tan(z)) + -1.0))) else: tmp = (math.sin((y + z)) / math.cos((y + z))) + (x - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -0.01) tmp = Float64(x + Float64(tan(Float64(y + z)) - tan(a))); elseif (tan(a) <= 5e-51) tmp = Float64(x - Float64(a + Float64(Float64(tan(y) + tan(z)) / Float64(Float64(tan(y) * tan(z)) + -1.0)))); else tmp = Float64(Float64(sin(Float64(y + z)) / cos(Float64(y + z))) + Float64(x - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (tan(a) <= -0.01) tmp = x + (tan((y + z)) - tan(a)); elseif (tan(a) <= 5e-51) tmp = x - (a + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + -1.0))); else tmp = (sin((y + z)) / cos((y + z))) + (x - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 5e-51], N[(x - N[(a + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sin[N[(y + z), $MachinePrecision]], $MachinePrecision] / N[Cos[N[(y + z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - \tan a\right)\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-51}:\\
\;\;\;\;x - \left(a + \frac{\tan y + \tan z}{\tan y \cdot \tan z + -1}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sin \left(y + z\right)}{\cos \left(y + z\right)} + \left(x - \tan a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002Initial program 83.6%
if -0.0100000000000000002 < (tan.f64 a) < 5.00000000000000004e-51Initial program 81.4%
Taylor expanded in a around 0 81.4%
tan-sum99.8%
div-inv99.8%
fmm-def99.8%
Applied egg-rr99.8%
fmm-undef99.8%
associate-*r/99.8%
*-rgt-identity99.8%
Simplified99.8%
if 5.00000000000000004e-51 < (tan.f64 a) Initial program 77.9%
+-commutative77.9%
sub-neg77.9%
associate-+l+78.0%
tan-quot78.0%
div-inv77.9%
fma-define77.9%
neg-mul-177.9%
fma-define77.9%
Applied egg-rr77.9%
fma-undefine77.9%
neg-mul-177.9%
neg-sub077.9%
associate-+l-77.9%
neg-sub077.9%
fmm-undef77.9%
associate-*r/78.0%
*-rgt-identity78.0%
Simplified78.0%
Final simplification89.3%
(FPCore (x y z a) :precision binary64 (+ (/ (+ (tan y) (tan z)) (- 1.0 (* (tan y) (tan z)))) (- x (tan a))))
double code(double x, double y, double z, double a) {
return ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) + (x - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = ((tan(y) + tan(z)) / (1.0d0 - (tan(y) * tan(z)))) + (x - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return ((Math.tan(y) + Math.tan(z)) / (1.0 - (Math.tan(y) * Math.tan(z)))) + (x - Math.tan(a));
}
def code(x, y, z, a): return ((math.tan(y) + math.tan(z)) / (1.0 - (math.tan(y) * math.tan(z)))) + (x - math.tan(a))
function code(x, y, z, a) return Float64(Float64(Float64(tan(y) + tan(z)) / Float64(1.0 - Float64(tan(y) * tan(z)))) + Float64(x - tan(a))) end
function tmp = code(x, y, z, a) tmp = ((tan(y) + tan(z)) / (1.0 - (tan(y) * tan(z)))) + (x - tan(a)); end
code[x_, y_, z_, a_] := N[(N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(1.0 - N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\tan y + \tan z}{1 - \tan y \cdot \tan z} + \left(x - \tan a\right)
\end{array}
Initial program 81.1%
+-commutative81.1%
associate-+l-81.1%
tan-sum99.7%
div-inv99.6%
fmm-def99.7%
Applied egg-rr99.7%
fmm-undef99.6%
add-cube-cbrt97.9%
prod-diff97.9%
pow297.9%
Applied egg-rr97.9%
Simplified99.7%
Taylor expanded in x around 0 99.7%
Final simplification99.7%
(FPCore (x y z a) :precision binary64 (- x (+ (tan a) (/ (+ (tan y) (tan z)) (+ (* (tan y) (tan z)) -1.0)))))
double code(double x, double y, double z, double a) {
return x - (tan(a) + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + -1.0)));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x - (tan(a) + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + (-1.0d0))))
end function
public static double code(double x, double y, double z, double a) {
return x - (Math.tan(a) + ((Math.tan(y) + Math.tan(z)) / ((Math.tan(y) * Math.tan(z)) + -1.0)));
}
def code(x, y, z, a): return x - (math.tan(a) + ((math.tan(y) + math.tan(z)) / ((math.tan(y) * math.tan(z)) + -1.0)))
function code(x, y, z, a) return Float64(x - Float64(tan(a) + Float64(Float64(tan(y) + tan(z)) / Float64(Float64(tan(y) * tan(z)) + -1.0)))) end
function tmp = code(x, y, z, a) tmp = x - (tan(a) + ((tan(y) + tan(z)) / ((tan(y) * tan(z)) + -1.0))); end
code[x_, y_, z_, a_] := N[(x - N[(N[Tan[a], $MachinePrecision] + N[(N[(N[Tan[y], $MachinePrecision] + N[Tan[z], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Tan[y], $MachinePrecision] * N[Tan[z], $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \left(\tan a + \frac{\tan y + \tan z}{\tan y \cdot \tan z + -1}\right)
\end{array}
Initial program 81.1%
+-commutative81.1%
sub-neg81.1%
associate-+l+81.1%
tan-sum99.7%
div-inv99.6%
fma-define99.7%
neg-mul-199.7%
fma-define99.7%
Applied egg-rr99.7%
fma-undefine99.6%
fma-undefine99.6%
neg-mul-199.6%
associate-+r+99.6%
sub-neg99.6%
associate-*r/99.6%
*-rgt-identity99.6%
Simplified99.6%
Final simplification99.6%
(FPCore (x y z a) :precision binary64 (if (or (<= (tan a) -0.01) (not (<= (tan a) 1e-12))) (+ x (- (tan y) (tan a))) (+ x (- (tan (+ y z)) a))))
double code(double x, double y, double z, double a) {
double tmp;
if ((tan(a) <= -0.01) || !(tan(a) <= 1e-12)) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan((y + z)) - a);
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((tan(a) <= (-0.01d0)) .or. (.not. (tan(a) <= 1d-12))) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan((y + z)) - a)
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((Math.tan(a) <= -0.01) || !(Math.tan(a) <= 1e-12)) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan((y + z)) - a);
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (math.tan(a) <= -0.01) or not (math.tan(a) <= 1e-12): tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan((y + z)) - a) return tmp
function code(x, y, z, a) tmp = 0.0 if ((tan(a) <= -0.01) || !(tan(a) <= 1e-12)) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((tan(a) <= -0.01) || ~((tan(a) <= 1e-12))) tmp = x + (tan(y) - tan(a)); else tmp = x + (tan((y + z)) - a); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[Or[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[Not[LessEqual[N[Tan[a], $MachinePrecision], 1e-12]], $MachinePrecision]], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01 \lor \neg \left(\tan a \leq 10^{-12}\right):\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002 or 9.9999999999999998e-13 < (tan.f64 a) Initial program 80.4%
Taylor expanded in y around inf 63.9%
if -0.0100000000000000002 < (tan.f64 a) < 9.9999999999999998e-13Initial program 81.9%
Taylor expanded in a around 0 81.9%
Final simplification72.1%
(FPCore (x y z a) :precision binary64 (if (<= (tan a) -0.01) (exp (log x)) (if (<= (tan a) 1e-12) (+ x (- (tan (+ y z)) a)) (expm1 (log1p x)))))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -0.01) {
tmp = exp(log(x));
} else if (tan(a) <= 1e-12) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = expm1(log1p(x));
}
return tmp;
}
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -0.01) {
tmp = Math.exp(Math.log(x));
} else if (Math.tan(a) <= 1e-12) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = Math.expm1(Math.log1p(x));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -0.01: tmp = math.exp(math.log(x)) elif math.tan(a) <= 1e-12: tmp = x + (math.tan((y + z)) - a) else: tmp = math.expm1(math.log1p(x)) return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -0.01) tmp = exp(log(x)); elseif (tan(a) <= 1e-12) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = expm1(log1p(x)); end return tmp end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 1e-12], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], N[(Exp[N[Log[1 + x], $MachinePrecision]] - 1), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;e^{\log x}\\
\mathbf{elif}\;\tan a \leq 10^{-12}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{expm1}\left(\mathsf{log1p}\left(x\right)\right)\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002Initial program 83.6%
add-cbrt-cube83.1%
pow1/379.7%
pow379.8%
+-commutative79.8%
associate-+l-79.8%
Applied egg-rr79.8%
add-exp-log79.9%
log-pow79.6%
associate--r-79.6%
pow179.6%
metadata-eval79.6%
sqrt-pow165.5%
+-commutative65.5%
sqrt-pow179.6%
metadata-eval79.6%
pow179.6%
Applied egg-rr79.6%
Taylor expanded in x around inf 23.2%
mul-1-neg23.2%
log-rec23.2%
remove-double-neg23.2%
Simplified23.2%
*-commutative23.2%
pow-to-exp23.2%
pow323.2%
pow1/323.2%
add-cbrt-cube23.2%
add-exp-log23.2%
Applied egg-rr23.2%
if -0.0100000000000000002 < (tan.f64 a) < 9.9999999999999998e-13Initial program 81.9%
Taylor expanded in a around 0 81.9%
if 9.9999999999999998e-13 < (tan.f64 a) Initial program 76.9%
add-cbrt-cube76.7%
pow1/358.9%
pow358.9%
+-commutative58.9%
associate-+l-58.9%
Applied egg-rr58.9%
add-exp-log59.1%
log-pow58.9%
associate--r-58.8%
pow158.8%
metadata-eval58.8%
sqrt-pow141.7%
+-commutative41.7%
sqrt-pow158.8%
metadata-eval58.8%
pow158.8%
Applied egg-rr58.8%
Taylor expanded in x around inf 18.4%
mul-1-neg18.4%
log-rec18.4%
remove-double-neg18.4%
Simplified18.4%
*-commutative18.4%
pow-to-exp18.4%
pow318.4%
pow1/318.4%
expm1-log1p-u18.4%
add-cbrt-cube18.4%
expm1-undefine18.4%
Applied egg-rr18.4%
expm1-define18.4%
Simplified18.4%
(FPCore (x y z a) :precision binary64 (log (exp (+ (tan (+ y z)) (- x (tan a))))))
double code(double x, double y, double z, double a) {
return log(exp((tan((y + z)) + (x - tan(a)))));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = log(exp((tan((y + z)) + (x - tan(a)))))
end function
public static double code(double x, double y, double z, double a) {
return Math.log(Math.exp((Math.tan((y + z)) + (x - Math.tan(a)))));
}
def code(x, y, z, a): return math.log(math.exp((math.tan((y + z)) + (x - math.tan(a)))))
function code(x, y, z, a) return log(exp(Float64(tan(Float64(y + z)) + Float64(x - tan(a))))) end
function tmp = code(x, y, z, a) tmp = log(exp((tan((y + z)) + (x - tan(a))))); end
code[x_, y_, z_, a_] := N[Log[N[Exp[N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] + N[(x - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\log \left(e^{\tan \left(y + z\right) + \left(x - \tan a\right)}\right)
\end{array}
Initial program 81.1%
add-log-exp81.1%
+-commutative81.1%
associate-+l-81.1%
Applied egg-rr81.1%
Final simplification81.1%
(FPCore (x y z a) :precision binary64 (if (<= (tan a) -0.01) (exp (log x)) (if (<= (tan a) 1e-12) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -0.01) {
tmp = exp(log(x));
} else if (tan(a) <= 1e-12) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (tan(a) <= (-0.01d0)) then
tmp = exp(log(x))
else if (tan(a) <= 1d-12) then
tmp = x + (tan((y + z)) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -0.01) {
tmp = Math.exp(Math.log(x));
} else if (Math.tan(a) <= 1e-12) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -0.01: tmp = math.exp(math.log(x)) elif math.tan(a) <= 1e-12: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -0.01) tmp = exp(log(x)); elseif (tan(a) <= 1e-12) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (tan(a) <= -0.01) tmp = exp(log(x)); elseif (tan(a) <= 1e-12) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], N[Exp[N[Log[x], $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Tan[a], $MachinePrecision], 1e-12], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;e^{\log x}\\
\mathbf{elif}\;\tan a \leq 10^{-12}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002Initial program 83.6%
add-cbrt-cube83.1%
pow1/379.7%
pow379.8%
+-commutative79.8%
associate-+l-79.8%
Applied egg-rr79.8%
add-exp-log79.9%
log-pow79.6%
associate--r-79.6%
pow179.6%
metadata-eval79.6%
sqrt-pow165.5%
+-commutative65.5%
sqrt-pow179.6%
metadata-eval79.6%
pow179.6%
Applied egg-rr79.6%
Taylor expanded in x around inf 23.2%
mul-1-neg23.2%
log-rec23.2%
remove-double-neg23.2%
Simplified23.2%
*-commutative23.2%
pow-to-exp23.2%
pow323.2%
pow1/323.2%
add-cbrt-cube23.2%
add-exp-log23.2%
Applied egg-rr23.2%
if -0.0100000000000000002 < (tan.f64 a) < 9.9999999999999998e-13Initial program 81.9%
Taylor expanded in a around 0 81.9%
if 9.9999999999999998e-13 < (tan.f64 a) Initial program 76.9%
Taylor expanded in x around inf 18.4%
(FPCore (x y z a) :precision binary64 (if (<= (tan a) -0.01) x (if (<= (tan a) 1e-12) (+ x (- (tan (+ y z)) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -0.01) {
tmp = x;
} else if (tan(a) <= 1e-12) {
tmp = x + (tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (tan(a) <= (-0.01d0)) then
tmp = x
else if (tan(a) <= 1d-12) then
tmp = x + (tan((y + z)) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -0.01) {
tmp = x;
} else if (Math.tan(a) <= 1e-12) {
tmp = x + (Math.tan((y + z)) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -0.01: tmp = x elif math.tan(a) <= 1e-12: tmp = x + (math.tan((y + z)) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -0.01) tmp = x; elseif (tan(a) <= 1e-12) tmp = Float64(x + Float64(tan(Float64(y + z)) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (tan(a) <= -0.01) tmp = x; elseif (tan(a) <= 1e-12) tmp = x + (tan((y + z)) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -0.01], x, If[LessEqual[N[Tan[a], $MachinePrecision], 1e-12], N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -0.01:\\
\;\;\;\;x\\
\mathbf{elif}\;\tan a \leq 10^{-12}:\\
\;\;\;\;x + \left(\tan \left(y + z\right) - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (tan.f64 a) < -0.0100000000000000002 or 9.9999999999999998e-13 < (tan.f64 a) Initial program 80.4%
Taylor expanded in x around inf 20.8%
if -0.0100000000000000002 < (tan.f64 a) < 9.9999999999999998e-13Initial program 81.9%
Taylor expanded in a around 0 81.9%
(FPCore (x y z a) :precision binary64 (if (<= (tan a) -1e-5) x (if (<= (tan a) 5e-51) (+ x (- (tan y) a)) x)))
double code(double x, double y, double z, double a) {
double tmp;
if (tan(a) <= -1e-5) {
tmp = x;
} else if (tan(a) <= 5e-51) {
tmp = x + (tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (tan(a) <= (-1d-5)) then
tmp = x
else if (tan(a) <= 5d-51) then
tmp = x + (tan(y) - a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (Math.tan(a) <= -1e-5) {
tmp = x;
} else if (Math.tan(a) <= 5e-51) {
tmp = x + (Math.tan(y) - a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if math.tan(a) <= -1e-5: tmp = x elif math.tan(a) <= 5e-51: tmp = x + (math.tan(y) - a) else: tmp = x return tmp
function code(x, y, z, a) tmp = 0.0 if (tan(a) <= -1e-5) tmp = x; elseif (tan(a) <= 5e-51) tmp = Float64(x + Float64(tan(y) - a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (tan(a) <= -1e-5) tmp = x; elseif (tan(a) <= 5e-51) tmp = x + (tan(y) - a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[Tan[a], $MachinePrecision], -1e-5], x, If[LessEqual[N[Tan[a], $MachinePrecision], 5e-51], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\tan a \leq -1 \cdot 10^{-5}:\\
\;\;\;\;x\\
\mathbf{elif}\;\tan a \leq 5 \cdot 10^{-51}:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if (tan.f64 a) < -1.00000000000000008e-5 or 5.00000000000000004e-51 < (tan.f64 a) Initial program 80.9%
Taylor expanded in x around inf 20.8%
if -1.00000000000000008e-5 < (tan.f64 a) < 5.00000000000000004e-51Initial program 81.2%
Taylor expanded in a around 0 81.2%
Taylor expanded in y around inf 59.4%
(FPCore (x y z a) :precision binary64 (if (<= z 1.55e-7) (- (+ (tan y) x) (tan a)) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.55e-7) {
tmp = (tan(y) + x) - tan(a);
} else {
tmp = x + (tan(z) - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (z <= 1.55d-7) then
tmp = (tan(y) + x) - tan(a)
else
tmp = x + (tan(z) - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.55e-7) {
tmp = (Math.tan(y) + x) - Math.tan(a);
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if z <= 1.55e-7: tmp = (math.tan(y) + x) - math.tan(a) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (z <= 1.55e-7) tmp = Float64(Float64(tan(y) + x) - tan(a)); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (z <= 1.55e-7) tmp = (tan(y) + x) - tan(a); else tmp = x + (tan(z) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[z, 1.55e-7], N[(N[(N[Tan[y], $MachinePrecision] + x), $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.55 \cdot 10^{-7}:\\
\;\;\;\;\left(\tan y + x\right) - \tan a\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 1.55e-7Initial program 87.9%
Taylor expanded in a around inf 87.9%
Taylor expanded in y around inf 74.9%
tan-quot74.9%
associate-+r-74.9%
Applied egg-rr74.9%
if 1.55e-7 < z Initial program 60.0%
Taylor expanded in y around 0 60.0%
Final simplification71.3%
(FPCore (x y z a) :precision binary64 (if (<= z 1.8e-7) (+ x (- (tan y) (tan a))) (+ x (- (tan z) (tan a)))))
double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.8e-7) {
tmp = x + (tan(y) - tan(a));
} else {
tmp = x + (tan(z) - tan(a));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if (z <= 1.8d-7) then
tmp = x + (tan(y) - tan(a))
else
tmp = x + (tan(z) - tan(a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if (z <= 1.8e-7) {
tmp = x + (Math.tan(y) - Math.tan(a));
} else {
tmp = x + (Math.tan(z) - Math.tan(a));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if z <= 1.8e-7: tmp = x + (math.tan(y) - math.tan(a)) else: tmp = x + (math.tan(z) - math.tan(a)) return tmp
function code(x, y, z, a) tmp = 0.0 if (z <= 1.8e-7) tmp = Float64(x + Float64(tan(y) - tan(a))); else tmp = Float64(x + Float64(tan(z) - tan(a))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if (z <= 1.8e-7) tmp = x + (tan(y) - tan(a)); else tmp = x + (tan(z) - tan(a)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[z, 1.8e-7], N[(x + N[(N[Tan[y], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[Tan[z], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.8 \cdot 10^{-7}:\\
\;\;\;\;x + \left(\tan y - \tan a\right)\\
\mathbf{else}:\\
\;\;\;\;x + \left(\tan z - \tan a\right)\\
\end{array}
\end{array}
if z < 1.79999999999999997e-7Initial program 87.9%
Taylor expanded in y around inf 74.9%
if 1.79999999999999997e-7 < z Initial program 60.0%
Taylor expanded in y around 0 60.0%
(FPCore (x y z a) :precision binary64 (+ x (- (tan (+ y z)) (tan a))))
double code(double x, double y, double z, double a) {
return x + (tan((y + z)) - tan(a));
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x + (tan((y + z)) - tan(a))
end function
public static double code(double x, double y, double z, double a) {
return x + (Math.tan((y + z)) - Math.tan(a));
}
def code(x, y, z, a): return x + (math.tan((y + z)) - math.tan(a))
function code(x, y, z, a) return Float64(x + Float64(tan(Float64(y + z)) - tan(a))) end
function tmp = code(x, y, z, a) tmp = x + (tan((y + z)) - tan(a)); end
code[x_, y_, z_, a_] := N[(x + N[(N[Tan[N[(y + z), $MachinePrecision]], $MachinePrecision] - N[Tan[a], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \left(\tan \left(y + z\right) - \tan a\right)
\end{array}
Initial program 81.1%
(FPCore (x y z a) :precision binary64 (if (<= (+ y z) -5000000000000.0) (+ x (- (tan y) a)) (if (<= (+ y z) 1e-16) x (- x (- a (tan z))))))
double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -5000000000000.0) {
tmp = x + (tan(y) - a);
} else if ((y + z) <= 1e-16) {
tmp = x;
} else {
tmp = x - (a - tan(z));
}
return tmp;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
real(8) :: tmp
if ((y + z) <= (-5000000000000.0d0)) then
tmp = x + (tan(y) - a)
else if ((y + z) <= 1d-16) then
tmp = x
else
tmp = x - (a - tan(z))
end if
code = tmp
end function
public static double code(double x, double y, double z, double a) {
double tmp;
if ((y + z) <= -5000000000000.0) {
tmp = x + (Math.tan(y) - a);
} else if ((y + z) <= 1e-16) {
tmp = x;
} else {
tmp = x - (a - Math.tan(z));
}
return tmp;
}
def code(x, y, z, a): tmp = 0 if (y + z) <= -5000000000000.0: tmp = x + (math.tan(y) - a) elif (y + z) <= 1e-16: tmp = x else: tmp = x - (a - math.tan(z)) return tmp
function code(x, y, z, a) tmp = 0.0 if (Float64(y + z) <= -5000000000000.0) tmp = Float64(x + Float64(tan(y) - a)); elseif (Float64(y + z) <= 1e-16) tmp = x; else tmp = Float64(x - Float64(a - tan(z))); end return tmp end
function tmp_2 = code(x, y, z, a) tmp = 0.0; if ((y + z) <= -5000000000000.0) tmp = x + (tan(y) - a); elseif ((y + z) <= 1e-16) tmp = x; else tmp = x - (a - tan(z)); end tmp_2 = tmp; end
code[x_, y_, z_, a_] := If[LessEqual[N[(y + z), $MachinePrecision], -5000000000000.0], N[(x + N[(N[Tan[y], $MachinePrecision] - a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y + z), $MachinePrecision], 1e-16], x, N[(x - N[(a - N[Tan[z], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y + z \leq -5000000000000:\\
\;\;\;\;x + \left(\tan y - a\right)\\
\mathbf{elif}\;y + z \leq 10^{-16}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;x - \left(a - \tan z\right)\\
\end{array}
\end{array}
if (+.f64 y z) < -5e12Initial program 72.4%
Taylor expanded in a around 0 40.3%
Taylor expanded in y around inf 25.4%
if -5e12 < (+.f64 y z) < 9.9999999999999998e-17Initial program 99.9%
Taylor expanded in x around inf 48.3%
if 9.9999999999999998e-17 < (+.f64 y z) Initial program 76.8%
Taylor expanded in a around 0 40.0%
Taylor expanded in y around 0 24.4%
Final simplification30.8%
(FPCore (x y z a) :precision binary64 x)
double code(double x, double y, double z, double a) {
return x;
}
real(8) function code(x, y, z, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: a
code = x
end function
public static double code(double x, double y, double z, double a) {
return x;
}
def code(x, y, z, a): return x
function code(x, y, z, a) return x end
function tmp = code(x, y, z, a) tmp = x; end
code[x_, y_, z_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 81.1%
Taylor expanded in x around inf 28.9%
herbie shell --seed 2024191
(FPCore (x y z a)
:name "tan-example (used to crash)"
:precision binary64
:pre (and (and (and (or (== x 0.0) (and (<= 0.5884142 x) (<= x 505.5909))) (or (and (<= -1.796658e+308 y) (<= y -9.425585e-310)) (and (<= 1.284938e-309 y) (<= y 1.751224e+308)))) (or (and (<= -1.776707e+308 z) (<= z -8.599796e-310)) (and (<= 3.293145e-311 z) (<= z 1.725154e+308)))) (or (and (<= -1.796658e+308 a) (<= a -9.425585e-310)) (and (<= 1.284938e-309 a) (<= a 1.751224e+308))))
(+ x (- (tan (+ y z)) (tan a))))