Average Error: 31.1 → 21.4
Time: 16.8s
Precision: binary64
Cost: 13568
\[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
\[\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)\right) \]
(FPCore (a b angle)
 :precision binary64
 (*
  (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0))))
  (cos (* PI (/ angle 180.0)))))
(FPCore (a b angle)
 :precision binary64
 (* (+ b a) (* (- b a) (sin (* PI (* 0.011111111111111112 angle))))))
double code(double a, double b, double angle) {
	return ((2.0 * (pow(b, 2.0) - pow(a, 2.0))) * sin((((double) M_PI) * (angle / 180.0)))) * cos((((double) M_PI) * (angle / 180.0)));
}
double code(double a, double b, double angle) {
	return (b + a) * ((b - a) * sin((((double) M_PI) * (0.011111111111111112 * angle))));
}
public static double code(double a, double b, double angle) {
	return ((2.0 * (Math.pow(b, 2.0) - Math.pow(a, 2.0))) * Math.sin((Math.PI * (angle / 180.0)))) * Math.cos((Math.PI * (angle / 180.0)));
}
public static double code(double a, double b, double angle) {
	return (b + a) * ((b - a) * Math.sin((Math.PI * (0.011111111111111112 * angle))));
}
def code(a, b, angle):
	return ((2.0 * (math.pow(b, 2.0) - math.pow(a, 2.0))) * math.sin((math.pi * (angle / 180.0)))) * math.cos((math.pi * (angle / 180.0)))
def code(a, b, angle):
	return (b + a) * ((b - a) * math.sin((math.pi * (0.011111111111111112 * angle))))
function code(a, b, angle)
	return Float64(Float64(Float64(2.0 * Float64((b ^ 2.0) - (a ^ 2.0))) * sin(Float64(pi * Float64(angle / 180.0)))) * cos(Float64(pi * Float64(angle / 180.0))))
end
function code(a, b, angle)
	return Float64(Float64(b + a) * Float64(Float64(b - a) * sin(Float64(pi * Float64(0.011111111111111112 * angle)))))
end
function tmp = code(a, b, angle)
	tmp = ((2.0 * ((b ^ 2.0) - (a ^ 2.0))) * sin((pi * (angle / 180.0)))) * cos((pi * (angle / 180.0)));
end
function tmp = code(a, b, angle)
	tmp = (b + a) * ((b - a) * sin((pi * (0.011111111111111112 * angle))));
end
code[a_, b_, angle_] := N[(N[(N[(2.0 * N[(N[Power[b, 2.0], $MachinePrecision] - N[Power[a, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Sin[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(Pi * N[(angle / 180.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[a_, b_, angle_] := N[(N[(b + a), $MachinePrecision] * N[(N[(b - a), $MachinePrecision] * N[Sin[N[(Pi * N[(0.011111111111111112 * angle), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)
\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)\right)

Error

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 31.1

    \[\left(\left(2 \cdot \left({b}^{2} - {a}^{2}\right)\right) \cdot \sin \left(\pi \cdot \frac{angle}{180}\right)\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right) \]
  2. Simplified31.1

    \[\leadsto \color{blue}{\left(2 \cdot \left(b \cdot b - a \cdot a\right)\right) \cdot \left(\sin \left(\pi \cdot \frac{angle}{180}\right) \cdot \cos \left(\pi \cdot \frac{angle}{180}\right)\right)} \]
    Proof
    (*.f64 (*.f64 2 (-.f64 (*.f64 b b) (*.f64 a a))) (*.f64 (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))): 0 points increase in error, 0 points decrease in error
    (*.f64 (*.f64 2 (-.f64 (Rewrite<= unpow2_binary64 (pow.f64 b 2)) (*.f64 a a))) (*.f64 (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))): 0 points increase in error, 0 points decrease in error
    (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (Rewrite<= unpow2_binary64 (pow.f64 a 2)))) (*.f64 (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))): 0 points increase in error, 0 points decrease in error
    (Rewrite<= associate-*l*_binary64 (*.f64 (*.f64 (*.f64 2 (-.f64 (pow.f64 b 2) (pow.f64 a 2))) (sin.f64 (*.f64 (PI.f64) (/.f64 angle 180)))) (cos.f64 (*.f64 (PI.f64) (/.f64 angle 180))))): 18 points increase in error, 15 points decrease in error
  3. Applied egg-rr43.6

    \[\leadsto \color{blue}{\sqrt[3]{{\left(\left(b \cdot b - a \cdot a\right) \cdot \sin \left(2 \cdot \left(\pi \cdot \left(angle \cdot 0.005555555555555556\right)\right)\right)\right)}^{3}}} \]
  4. Applied egg-rr21.5

    \[\leadsto \color{blue}{\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\left(\pi \cdot angle\right) \cdot 0.011111111111111112\right)\right)} \]
  5. Taylor expanded in angle around inf 21.5

    \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\sin \left(0.011111111111111112 \cdot \left(angle \cdot \pi\right)\right)}\right) \]
  6. Simplified21.4

    \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \color{blue}{\sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)}\right) \]
    Proof
    (sin.f64 (*.f64 (PI.f64) (*.f64 1/90 angle))): 0 points increase in error, 0 points decrease in error
    (sin.f64 (*.f64 (PI.f64) (Rewrite<= *-commutative_binary64 (*.f64 angle 1/90)))): 0 points increase in error, 0 points decrease in error
    (sin.f64 (Rewrite=> *-commutative_binary64 (*.f64 (*.f64 angle 1/90) (PI.f64)))): 0 points increase in error, 0 points decrease in error
    (sin.f64 (*.f64 (Rewrite=> *-commutative_binary64 (*.f64 1/90 angle)) (PI.f64))): 0 points increase in error, 0 points decrease in error
    (sin.f64 (Rewrite<= associate-*r*_binary64 (*.f64 1/90 (*.f64 angle (PI.f64))))): 50 points increase in error, 39 points decrease in error
  7. Final simplification21.4

    \[\leadsto \left(b + a\right) \cdot \left(\left(b - a\right) \cdot \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right)\right) \]

Alternatives

Alternative 1
Error22.7
Cost13576
\[\begin{array}{l} t_0 := \sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(b \cdot b\right)\\ \mathbf{if}\;angle \leq -0.082:\\ \;\;\;\;t_0\\ \mathbf{elif}\;angle \leq 0.82:\\ \;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 2
Error22.7
Cost13576
\[\begin{array}{l} t_0 := 0.011111111111111112 \cdot \left(\pi \cdot angle\right)\\ \mathbf{if}\;angle \leq -0.048:\\ \;\;\;\;\sin t_0 \cdot \left(-a \cdot a\right)\\ \mathbf{elif}\;angle \leq 0.58:\\ \;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot t_0\right)\\ \mathbf{else}:\\ \;\;\;\;\sin \left(\pi \cdot \left(0.011111111111111112 \cdot angle\right)\right) \cdot \left(b \cdot b\right)\\ \end{array} \]
Alternative 3
Error24.5
Cost13444
\[\begin{array}{l} \mathbf{if}\;angle \leq -0.24:\\ \;\;\;\;\left(b \cdot b\right) \cdot \sin \left(angle \cdot \left(\pi \cdot 0.011111111111111112\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \]
Alternative 4
Error29.0
Cost7696
\[\begin{array}{l} t_0 := 0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right)\\ t_1 := \left(\pi \cdot \left(a \cdot \left(a \cdot angle\right)\right)\right) \cdot -0.011111111111111112\\ \mathbf{if}\;a \leq -1.25 \cdot 10^{+120}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;a \leq -8.6 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 10^{-84}:\\ \;\;\;\;\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\\ \mathbf{elif}\;a \leq 4 \cdot 10^{+126}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 5
Error29.0
Cost7696
\[\begin{array}{l} t_0 := \left(\pi \cdot \left(a \cdot \left(a \cdot angle\right)\right)\right) \cdot -0.011111111111111112\\ \mathbf{if}\;a \leq -1.3 \cdot 10^{+120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq -1.1 \cdot 10^{-69}:\\ \;\;\;\;0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(b \cdot b - a \cdot a\right)\right)\right)\\ \mathbf{elif}\;a \leq 2.2 \cdot 10^{-84}:\\ \;\;\;\;\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\\ \mathbf{elif}\;a \leq 3 \cdot 10^{+126}:\\ \;\;\;\;0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(\left(b + a\right) \cdot \left(b - a\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error25.3
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -450:\\ \;\;\;\;-0.011111111111111112 \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \pi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0.011111111111111112 \cdot \left(\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \]
Alternative 7
Error25.2
Cost7300
\[\begin{array}{l} \mathbf{if}\;angle \leq -450:\\ \;\;\;\;-0.011111111111111112 \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \pi\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b + a\right) \cdot \left(\left(b - a\right) \cdot \left(0.011111111111111112 \cdot \left(\pi \cdot angle\right)\right)\right)\\ \end{array} \]
Alternative 8
Error32.4
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -1.06 \cdot 10^{-49}:\\ \;\;\;\;b \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot 0.011111111111111112\right)\right)\right)\\ \mathbf{elif}\;b \leq 4 \cdot 10^{-50}:\\ \;\;\;\;-0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\\ \end{array} \]
Alternative 9
Error32.4
Cost7176
\[\begin{array}{l} \mathbf{if}\;b \leq -1.05 \cdot 10^{-49}:\\ \;\;\;\;b \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot 0.011111111111111112\right)\right)\right)\\ \mathbf{elif}\;b \leq 7.8 \cdot 10^{-49}:\\ \;\;\;\;-0.011111111111111112 \cdot \left(\pi \cdot \left(angle \cdot \left(a \cdot a\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\\ \end{array} \]
Alternative 10
Error32.3
Cost7176
\[\begin{array}{l} t_0 := \left(\pi \cdot \left(a \cdot \left(a \cdot angle\right)\right)\right) \cdot -0.011111111111111112\\ \mathbf{if}\;a \leq -6 \cdot 10^{-92}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;a \leq 3.5 \cdot 10^{+29}:\\ \;\;\;\;\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 11
Error43.6
Cost6912
\[0.011111111111111112 \cdot \left(angle \cdot \left(b \cdot \left(b \cdot \pi\right)\right)\right) \]
Alternative 12
Error43.6
Cost6912
\[0.011111111111111112 \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot b\right)\right)\right) \]
Alternative 13
Error40.0
Cost6912
\[0.011111111111111112 \cdot \left(b \cdot \left(b \cdot \left(\pi \cdot angle\right)\right)\right) \]
Alternative 14
Error40.0
Cost6912
\[0.011111111111111112 \cdot \left(b \cdot \left(angle \cdot \left(b \cdot \pi\right)\right)\right) \]
Alternative 15
Error40.0
Cost6912
\[b \cdot \left(angle \cdot \left(\pi \cdot \left(b \cdot 0.011111111111111112\right)\right)\right) \]
Alternative 16
Error40.0
Cost6912
\[\left(b \cdot 0.011111111111111112\right) \cdot \left(angle \cdot \left(b \cdot \pi\right)\right) \]

Error

Reproduce

herbie shell --seed 2022331 
(FPCore (a b angle)
  :name "ab-angle->ABCF B"
  :precision binary64
  (* (* (* 2.0 (- (pow b 2.0) (pow a 2.0))) (sin (* PI (/ angle 180.0)))) (cos (* PI (/ angle 180.0)))))