
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (a b angle) :precision binary64 (let* ((t_0 (* (PI) (/ angle 180.0)))) (+ (pow (* a (cos t_0)) 2.0) (pow (* b (sin t_0)) 2.0))))
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \frac{angle}{180}\\
{\left(a \cdot \cos t\_0\right)}^{2} + {\left(b \cdot \sin t\_0\right)}^{2}
\end{array}
\end{array}
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (sin (fma (/ angle_m 180.0) (PI) (/ (PI) 2.0)))) 2.0) (pow (* b (sin (* (* (PI) 0.005555555555555556) angle_m))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \sin \left(\mathsf{fma}\left(\frac{angle\_m}{180}, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)}^{2}
\end{array}
Initial program 81.3%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6481.5
Applied rewrites81.5%
lift-cos.f64N/A
sin-+PI/2-revN/A
lower-sin.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-PI.f64N/A
lower-/.f6481.5
Applied rewrites81.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a (cos (* (PI) (/ angle_m 180.0)))) 2.0) (pow (* b (sin (* (* (PI) 0.005555555555555556) angle_m))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot \cos \left(\mathsf{PI}\left(\right) \cdot \frac{angle\_m}{180}\right)\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)}^{2}
\end{array}
Initial program 81.3%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6481.5
Applied rewrites81.5%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (* (- 0.5 (* 0.5 (cos (* 2.0 (fma (/ angle_m 180.0) (PI) (/ (PI) 2.0)))))) a) a (pow (* (sin (* (/ angle_m 180.0) (PI))) b) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \mathsf{fma}\left(\frac{angle\_m}{180}, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{2}\right)\right)\right) \cdot a, a, {\left(\sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)}^{2}\right)
\end{array}
Initial program 81.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.3%
lift-pow.f64N/A
unpow2N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
sin-+PI/2-revN/A
sqr-sin-aN/A
lower--.f64N/A
Applied rewrites81.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (* (- 0.5 (* 0.5 (cos (* 2.0 (fma (/ angle_m 180.0) (PI) (/ (PI) -2.0)))))) a) a (pow (* (sin (* (/ angle_m 180.0) (PI))) b) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \mathsf{fma}\left(\frac{angle\_m}{180}, \mathsf{PI}\left(\right), \frac{\mathsf{PI}\left(\right)}{-2}\right)\right)\right) \cdot a, a, {\left(\sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)}^{2}\right)
\end{array}
Initial program 81.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.3%
lift-pow.f64N/A
unpow2N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
1-sub-sin-revN/A
metadata-evalN/A
Applied rewrites81.3%
rem-cube-cbrtN/A
lift-cbrt.f64N/A
cube-unmultN/A
unpow2N/A
lift-pow.f64N/A
*-commutativeN/A
lower-*.f6481.2
Applied rewrites81.2%
Applied rewrites81.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (let* ((t_0 (* (/ angle_m 180.0) (PI)))) (fma (* (+ 0.5 (* 0.5 (cos (* 2.0 t_0)))) a) a (pow (* (sin t_0) b) 2.0))))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\\
\mathsf{fma}\left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot t\_0\right)\right) \cdot a, a, {\left(\sin t\_0 \cdot b\right)}^{2}\right)
\end{array}
\end{array}
Initial program 81.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.3%
Applied rewrites81.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (* (+ 0.5 (* 0.5 (cos (* 2.0 (* (* angle_m (PI)) -0.005555555555555556))))) a) a (pow (* (sin (* (/ angle_m 180.0) (PI))) b) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(\left(0.5 + 0.5 \cdot \cos \left(2 \cdot \left(\left(angle\_m \cdot \mathsf{PI}\left(\right)\right) \cdot -0.005555555555555556\right)\right)\right) \cdot a, a, {\left(\sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)}^{2}\right)
\end{array}
Initial program 81.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.3%
lift-pow.f64N/A
unpow2N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
1-sub-sin-revN/A
metadata-evalN/A
Applied rewrites81.3%
Taylor expanded in angle around inf
unpow2N/A
1-sub-sin-revN/A
unpow2N/A
lower-pow.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6481.3
Applied rewrites81.3%
Applied rewrites81.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (+ (pow (* a 1.0) 2.0) (pow (* b (sin (* (* (PI) 0.005555555555555556) angle_m))) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
{\left(a \cdot 1\right)}^{2} + {\left(b \cdot \sin \left(\left(\mathsf{PI}\left(\right) \cdot 0.005555555555555556\right) \cdot angle\_m\right)\right)}^{2}
\end{array}
Initial program 81.3%
Taylor expanded in angle around inf
*-commutativeN/A
associate-*r*N/A
lower-sin.f64N/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f6481.5
Applied rewrites81.5%
Taylor expanded in angle around 0
Applied rewrites81.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (fma (* 1.0 a) a (pow (* (sin (* (/ angle_m 180.0) (PI))) b) 2.0)))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\mathsf{fma}\left(1 \cdot a, a, {\left(\sin \left(\frac{angle\_m}{180} \cdot \mathsf{PI}\left(\right)\right) \cdot b\right)}^{2}\right)
\end{array}
Initial program 81.3%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites81.3%
lift-pow.f64N/A
unpow2N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
1-sub-sin-revN/A
metadata-evalN/A
Applied rewrites81.3%
Taylor expanded in angle around 0
Applied rewrites80.9%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 1.25e-37)
(* (pow (cos (* -0.005555555555555556 (* (PI) angle_m))) 2.0) (* a a))
(if (<= b 4.1e+144)
(fma
(* (* (* t_0 3.08641975308642e-5) b) b)
(* angle_m angle_m)
(* a a))
(* (* 3.08641975308642e-5 (* (* b angle_m) (* b angle_m))) t_0)))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 1.25 \cdot 10^{-37}:\\
\;\;\;\;{\cos \left(-0.005555555555555556 \cdot \left(\mathsf{PI}\left(\right) \cdot angle\_m\right)\right)}^{2} \cdot \left(a \cdot a\right)\\
\mathbf{elif}\;b \leq 4.1 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot b\right) \cdot b, angle\_m \cdot angle\_m, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(b \cdot angle\_m\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if b < 1.2499999999999999e-37Initial program 77.6%
lift-+.f64N/A
lift-pow.f64N/A
unpow2N/A
lift-*.f64N/A
*-commutativeN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites77.6%
lift-pow.f64N/A
unpow2N/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
lift-cos.f64N/A
cos-neg-revN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
cos-neg-revN/A
1-sub-sin-revN/A
metadata-evalN/A
Applied rewrites77.6%
Taylor expanded in a around inf
*-commutativeN/A
unpow2N/A
1-sub-sin-revN/A
unpow2N/A
lower-*.f64N/A
lower-pow.f64N/A
cos-neg-revN/A
lower-cos.f64N/A
distribute-lft-neg-inN/A
lower-*.f64N/A
metadata-evalN/A
*-commutativeN/A
lower-*.f64N/A
lower-PI.f64N/A
unpow2N/A
lower-*.f6462.0
Applied rewrites62.0%
if 1.2499999999999999e-37 < b < 4.10000000000000001e144Initial program 82.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites39.2%
Taylor expanded in a around 0
Applied rewrites67.3%
if 4.10000000000000001e144 < b Initial program 97.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites46.0%
Taylor expanded in a around 0
Applied rewrites83.2%
Applied rewrites92.9%
Final simplification67.4%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 1.25e-37)
(* (pow (cos (* (* 0.005555555555555556 (PI)) angle_m)) 2.0) (* a a))
(if (<= b 4.1e+144)
(fma
(* (* (* t_0 3.08641975308642e-5) b) b)
(* angle_m angle_m)
(* a a))
(* (* 3.08641975308642e-5 (* (* b angle_m) (* b angle_m))) t_0)))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 1.25 \cdot 10^{-37}:\\
\;\;\;\;{\cos \left(\left(0.005555555555555556 \cdot \mathsf{PI}\left(\right)\right) \cdot angle\_m\right)}^{2} \cdot \left(a \cdot a\right)\\
\mathbf{elif}\;b \leq 4.1 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot b\right) \cdot b, angle\_m \cdot angle\_m, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(b \cdot angle\_m\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if b < 1.2499999999999999e-37Initial program 77.6%
lift-+.f64N/A
lift-pow.f64N/A
sqr-powN/A
metadata-evalN/A
unpow1N/A
metadata-evalN/A
sqr-powN/A
associate-*r*N/A
lower-fma.f64N/A
Applied rewrites35.0%
Taylor expanded in a around -inf
mul-1-negN/A
*-commutativeN/A
distribute-rgt-neg-inN/A
*-commutativeN/A
unpow2N/A
rem-square-sqrtN/A
mul-1-negN/A
distribute-lft-neg-inN/A
distribute-rgt-neg-inN/A
unpow2N/A
distribute-rgt-neg-inN/A
distribute-lft-neg-inN/A
sqr-neg-revN/A
unpow2N/A
lower-*.f64N/A
Applied rewrites61.9%
if 1.2499999999999999e-37 < b < 4.10000000000000001e144Initial program 82.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites39.2%
Taylor expanded in a around 0
Applied rewrites67.3%
if 4.10000000000000001e144 < b Initial program 97.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites46.0%
Taylor expanded in a around 0
Applied rewrites83.2%
Applied rewrites92.9%
Final simplification67.4%
angle_m = (fabs.f64 angle)
(FPCore (a b angle_m)
:precision binary64
(let* ((t_0 (* (PI) (PI))))
(if (<= b 1.25e-37)
(* a a)
(if (<= b 4.1e+144)
(fma
(* (* (* t_0 3.08641975308642e-5) b) b)
(* angle_m angle_m)
(* a a))
(* (* 3.08641975308642e-5 (* (* b angle_m) (* b angle_m))) t_0)))))\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
t_0 := \mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\\
\mathbf{if}\;b \leq 1.25 \cdot 10^{-37}:\\
\;\;\;\;a \cdot a\\
\mathbf{elif}\;b \leq 4.1 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(\left(\left(t\_0 \cdot 3.08641975308642 \cdot 10^{-5}\right) \cdot b\right) \cdot b, angle\_m \cdot angle\_m, a \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(b \cdot angle\_m\right)\right)\right) \cdot t\_0\\
\end{array}
\end{array}
if b < 1.2499999999999999e-37Initial program 77.6%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.8
Applied rewrites61.8%
if 1.2499999999999999e-37 < b < 4.10000000000000001e144Initial program 82.4%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites39.2%
Taylor expanded in a around 0
Applied rewrites67.3%
if 4.10000000000000001e144 < b Initial program 97.8%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites46.0%
Taylor expanded in a around 0
Applied rewrites83.2%
Applied rewrites92.9%
Final simplification67.3%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.75e+123) (* a a) (* (* 3.08641975308642e-5 (* (* b angle_m) (* b angle_m))) (* (PI) (PI)))))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{+123}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(\left(b \cdot angle\_m\right) \cdot \left(b \cdot angle\_m\right)\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if b < 1.75e123Initial program 78.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.1
Applied rewrites61.1%
if 1.75e123 < b Initial program 97.9%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites46.3%
Taylor expanded in a around 0
Applied rewrites79.4%
Applied rewrites90.9%
Final simplification66.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (if (<= b 1.75e+123) (* a a) (* (* 3.08641975308642e-5 (* angle_m (* angle_m (* b b)))) (* (PI) (PI)))))
\begin{array}{l}
angle_m = \left|angle\right|
\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.75 \cdot 10^{+123}:\\
\;\;\;\;a \cdot a\\
\mathbf{else}:\\
\;\;\;\;\left(3.08641975308642 \cdot 10^{-5} \cdot \left(angle\_m \cdot \left(angle\_m \cdot \left(b \cdot b\right)\right)\right)\right) \cdot \left(\mathsf{PI}\left(\right) \cdot \mathsf{PI}\left(\right)\right)\\
\end{array}
\end{array}
if b < 1.75e123Initial program 78.1%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6461.1
Applied rewrites61.1%
if 1.75e123 < b Initial program 97.9%
Taylor expanded in angle around 0
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites46.3%
Taylor expanded in a around 0
Applied rewrites79.4%
Applied rewrites72.8%
Final simplification63.0%
angle_m = (fabs.f64 angle) (FPCore (a b angle_m) :precision binary64 (* a a))
angle_m = fabs(angle);
double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = private
module fmin_fmax_functions
implicit none
private
public fmax
public fmin
interface fmax
module procedure fmax88
module procedure fmax44
module procedure fmax84
module procedure fmax48
end interface
interface fmin
module procedure fmin88
module procedure fmin44
module procedure fmin84
module procedure fmin48
end interface
contains
real(8) function fmax88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(4) function fmax44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, max(x, y), y /= y), x /= x)
end function
real(8) function fmax84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmax48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
end function
real(8) function fmin88(x, y) result (res)
real(8), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(4) function fmin44(x, y) result (res)
real(4), intent (in) :: x
real(4), intent (in) :: y
res = merge(y, merge(x, min(x, y), y /= y), x /= x)
end function
real(8) function fmin84(x, y) result(res)
real(8), intent (in) :: x
real(4), intent (in) :: y
res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
end function
real(8) function fmin48(x, y) result(res)
real(4), intent (in) :: x
real(8), intent (in) :: y
res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
end function
end module
real(8) function code(a, b, angle_m)
use fmin_fmax_functions
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: angle_m
code = a * a
end function
angle_m = Math.abs(angle);
public static double code(double a, double b, double angle_m) {
return a * a;
}
angle_m = math.fabs(angle) def code(a, b, angle_m): return a * a
angle_m = abs(angle) function code(a, b, angle_m) return Float64(a * a) end
angle_m = abs(angle); function tmp = code(a, b, angle_m) tmp = a * a; end
angle_m = N[Abs[angle], $MachinePrecision] code[a_, b_, angle$95$m_] := N[(a * a), $MachinePrecision]
\begin{array}{l}
angle_m = \left|angle\right|
\\
a \cdot a
\end{array}
Initial program 81.3%
Taylor expanded in angle around 0
unpow2N/A
lower-*.f6456.5
Applied rewrites56.5%
Final simplification56.5%
herbie shell --seed 2024359
(FPCore (a b angle)
:name "ab-angle->ABCF C"
:precision binary64
(+ (pow (* a (cos (* (PI) (/ angle 180.0)))) 2.0) (pow (* b (sin (* (PI) (/ angle 180.0)))) 2.0)))