Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, D

Percentage Accurate: 97.9% → 99.6%
Time: 7.6s
Alternatives: 5
Speedup: 1.2×

Specification

?
\[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
(FPCore (x y z t)
  :precision binary64
  (*
 (/ 1.0 3.0)
 (acos (* (/ (* 3.0 (/ x (* y 27.0))) (* z 2.0)) (sqrt t)))))
double code(double x, double y, double z, double t) {
	return (1.0 / 3.0) * acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * sqrt(t)));
}
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(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (1.0d0 / 3.0d0) * acos((((3.0d0 * (x / (y * 27.0d0))) / (z * 2.0d0)) * sqrt(t)))
end function
public static double code(double x, double y, double z, double t) {
	return (1.0 / 3.0) * Math.acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * Math.sqrt(t)));
}
def code(x, y, z, t):
	return (1.0 / 3.0) * math.acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * math.sqrt(t)))
function code(x, y, z, t)
	return Float64(Float64(1.0 / 3.0) * acos(Float64(Float64(Float64(3.0 * Float64(x / Float64(y * 27.0))) / Float64(z * 2.0)) * sqrt(t))))
end
function tmp = code(x, y, z, t)
	tmp = (1.0 / 3.0) * acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * sqrt(t)));
end
code[x_, y_, z_, t_] := N[(N[(1.0 / 3.0), $MachinePrecision] * N[ArcCos[N[(N[(N[(3.0 * N[(x / N[(y * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * 2.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 5 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 97.9% accurate, 1.0× speedup?

\[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
(FPCore (x y z t)
  :precision binary64
  (*
 (/ 1.0 3.0)
 (acos (* (/ (* 3.0 (/ x (* y 27.0))) (* z 2.0)) (sqrt t)))))
double code(double x, double y, double z, double t) {
	return (1.0 / 3.0) * acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * sqrt(t)));
}
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(x, y, z, t)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    real(8), intent (in) :: t
    code = (1.0d0 / 3.0d0) * acos((((3.0d0 * (x / (y * 27.0d0))) / (z * 2.0d0)) * sqrt(t)))
end function
public static double code(double x, double y, double z, double t) {
	return (1.0 / 3.0) * Math.acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * Math.sqrt(t)));
}
def code(x, y, z, t):
	return (1.0 / 3.0) * math.acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * math.sqrt(t)))
function code(x, y, z, t)
	return Float64(Float64(1.0 / 3.0) * acos(Float64(Float64(Float64(3.0 * Float64(x / Float64(y * 27.0))) / Float64(z * 2.0)) * sqrt(t))))
end
function tmp = code(x, y, z, t)
	tmp = (1.0 / 3.0) * acos((((3.0 * (x / (y * 27.0))) / (z * 2.0)) * sqrt(t)));
end
code[x_, y_, z_, t_] := N[(N[(1.0 / 3.0), $MachinePrecision] * N[ArcCos[N[(N[(N[(3.0 * N[(x / N[(y * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * 2.0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)

Alternative 1: 99.6% accurate, 1.0× speedup?

\[\left(\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right) \cdot \frac{0.3333333333333333}{\pi \cdot \pi}\right) \cdot \left(\pi \cdot \pi\right) \]
(FPCore (x y z t)
  :precision binary64
  (*
 (*
  (acos (* (* (/ x (* z y)) 0.05555555555555555) (sqrt t)))
  (/ 0.3333333333333333 (* PI PI)))
 (* PI PI)))
double code(double x, double y, double z, double t) {
	return (acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t))) * (0.3333333333333333 / (((double) M_PI) * ((double) M_PI)))) * (((double) M_PI) * ((double) M_PI));
}
public static double code(double x, double y, double z, double t) {
	return (Math.acos((((x / (z * y)) * 0.05555555555555555) * Math.sqrt(t))) * (0.3333333333333333 / (Math.PI * Math.PI))) * (Math.PI * Math.PI);
}
def code(x, y, z, t):
	return (math.acos((((x / (z * y)) * 0.05555555555555555) * math.sqrt(t))) * (0.3333333333333333 / (math.pi * math.pi))) * (math.pi * math.pi)
function code(x, y, z, t)
	return Float64(Float64(acos(Float64(Float64(Float64(x / Float64(z * y)) * 0.05555555555555555) * sqrt(t))) * Float64(0.3333333333333333 / Float64(pi * pi))) * Float64(pi * pi))
end
function tmp = code(x, y, z, t)
	tmp = (acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t))) * (0.3333333333333333 / (pi * pi))) * (pi * pi);
end
code[x_, y_, z_, t_] := N[(N[(N[ArcCos[N[(N[(N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.05555555555555555), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(0.3333333333333333 / N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(Pi * Pi), $MachinePrecision]), $MachinePrecision]
\left(\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right) \cdot \frac{0.3333333333333333}{\pi \cdot \pi}\right) \cdot \left(\pi \cdot \pi\right)
Derivation
  1. Initial program 97.9%

    \[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
  2. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
    3. lower-*.f6497.9%

      \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
  3. Applied rewrites98.1%

    \[\leadsto \color{blue}{\cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot 0.1111111111111111}{y \cdot \left(z + z\right)}\right) \cdot 0.3333333333333333} \]
  4. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}\right)} \cdot \frac{1}{3} \]
    2. lift-/.f64N/A

      \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
    3. lift-*.f64N/A

      \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{\color{blue}{x \cdot \frac{1}{9}}}{y \cdot \left(z + z\right)}\right) \cdot \frac{1}{3} \]
    4. lift-*.f64N/A

      \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{\color{blue}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
    5. times-fracN/A

      \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{\frac{1}{9}}{z + z}\right)}\right) \cdot \frac{1}{3} \]
    6. associate-*r*N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(\sqrt{t} \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{9}}{z + z}\right)} \cdot \frac{1}{3} \]
    7. associate-/l*N/A

      \[\leadsto \cos^{-1} \left(\color{blue}{\frac{\sqrt{t} \cdot x}{y}} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
    8. *-commutativeN/A

      \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
    9. lift-*.f64N/A

      \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
    10. lift-+.f64N/A

      \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{z + z}}\right) \cdot \frac{1}{3} \]
    11. count-2N/A

      \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{2 \cdot z}}\right) \cdot \frac{1}{3} \]
    12. associate-/r*N/A

      \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \color{blue}{\frac{\frac{\frac{1}{9}}{2}}{z}}\right) \cdot \frac{1}{3} \]
    13. metadata-evalN/A

      \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\color{blue}{\frac{1}{18}}}{z}\right) \cdot \frac{1}{3} \]
    14. frac-timesN/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
    15. lift-*.f64N/A

      \[\leadsto \cos^{-1} \left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{\color{blue}{y \cdot z}}\right) \cdot \frac{1}{3} \]
    16. *-commutativeN/A

      \[\leadsto \cos^{-1} \left(\frac{\color{blue}{\frac{1}{18} \cdot \left(x \cdot \sqrt{t}\right)}}{y \cdot z}\right) \cdot \frac{1}{3} \]
    17. associate-*r/N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
    18. lift-*.f64N/A

      \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \frac{\color{blue}{x \cdot \sqrt{t}}}{y \cdot z}\right) \cdot \frac{1}{3} \]
    19. associate-/l*N/A

      \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \color{blue}{\left(x \cdot \frac{\sqrt{t}}{y \cdot z}\right)}\right) \cdot \frac{1}{3} \]
    20. associate-*r*N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
    21. lower-*.f64N/A

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
    22. lower-*.f64N/A

      \[\leadsto \cos^{-1} \left(\color{blue}{\left(\frac{1}{18} \cdot x\right)} \cdot \frac{\sqrt{t}}{y \cdot z}\right) \cdot \frac{1}{3} \]
    23. lower-/.f6498.1%

      \[\leadsto \cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \color{blue}{\frac{\sqrt{t}}{y \cdot z}}\right) \cdot 0.3333333333333333 \]
  5. Applied rewrites98.1%

    \[\leadsto \cos^{-1} \color{blue}{\left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right)} \cdot 0.3333333333333333 \]
  6. Applied rewrites99.6%

    \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot 0.05555555555555555\right) \cdot \frac{x}{y \cdot z}\right)}{\pi \cdot \pi}\right) \cdot \left(\left(\left(2 \cdot \pi\right) \cdot \pi\right) \cdot 0.5\right)} \]
  7. Step-by-step derivation
    1. Applied rewrites99.6%

      \[\leadsto \color{blue}{\left(\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right) \cdot \frac{0.3333333333333333}{\pi \cdot \pi}\right) \cdot \left(\pi \cdot \pi\right)} \]
    2. Add Preprocessing

    Alternative 2: 98.1% accurate, 1.1× speedup?

    \[\left(0.3333333333333333 \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot 0.05555555555555555\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right) \cdot \pi \]
    (FPCore (x y z t)
      :precision binary64
      (*
     (*
      0.3333333333333333
      (/ (acos (* (* (sqrt t) 0.05555555555555555) (/ x (* y z)))) PI))
     PI))
    double code(double x, double y, double z, double t) {
    	return (0.3333333333333333 * (acos(((sqrt(t) * 0.05555555555555555) * (x / (y * z)))) / ((double) M_PI))) * ((double) M_PI);
    }
    
    public static double code(double x, double y, double z, double t) {
    	return (0.3333333333333333 * (Math.acos(((Math.sqrt(t) * 0.05555555555555555) * (x / (y * z)))) / Math.PI)) * Math.PI;
    }
    
    def code(x, y, z, t):
    	return (0.3333333333333333 * (math.acos(((math.sqrt(t) * 0.05555555555555555) * (x / (y * z)))) / math.pi)) * math.pi
    
    function code(x, y, z, t)
    	return Float64(Float64(0.3333333333333333 * Float64(acos(Float64(Float64(sqrt(t) * 0.05555555555555555) * Float64(x / Float64(y * z)))) / pi)) * pi)
    end
    
    function tmp = code(x, y, z, t)
    	tmp = (0.3333333333333333 * (acos(((sqrt(t) * 0.05555555555555555) * (x / (y * z)))) / pi)) * pi;
    end
    
    code[x_, y_, z_, t_] := N[(N[(0.3333333333333333 * N[(N[ArcCos[N[(N[(N[Sqrt[t], $MachinePrecision] * 0.05555555555555555), $MachinePrecision] * N[(x / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / Pi), $MachinePrecision]), $MachinePrecision] * Pi), $MachinePrecision]
    
    \left(0.3333333333333333 \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot 0.05555555555555555\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right) \cdot \pi
    
    Derivation
    1. Initial program 97.9%

      \[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
      3. lower-*.f6497.9%

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
    3. Applied rewrites98.1%

      \[\leadsto \color{blue}{\cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot 0.1111111111111111}{y \cdot \left(z + z\right)}\right) \cdot 0.3333333333333333} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}\right)} \cdot \frac{1}{3} \]
      2. lift-/.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      3. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{\color{blue}{x \cdot \frac{1}{9}}}{y \cdot \left(z + z\right)}\right) \cdot \frac{1}{3} \]
      4. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{\color{blue}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      5. times-fracN/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{\frac{1}{9}}{z + z}\right)}\right) \cdot \frac{1}{3} \]
      6. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\sqrt{t} \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{9}}{z + z}\right)} \cdot \frac{1}{3} \]
      7. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\frac{\sqrt{t} \cdot x}{y}} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      8. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      9. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      10. lift-+.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{z + z}}\right) \cdot \frac{1}{3} \]
      11. count-2N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{2 \cdot z}}\right) \cdot \frac{1}{3} \]
      12. associate-/r*N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \color{blue}{\frac{\frac{\frac{1}{9}}{2}}{z}}\right) \cdot \frac{1}{3} \]
      13. metadata-evalN/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\color{blue}{\frac{1}{18}}}{z}\right) \cdot \frac{1}{3} \]
      14. frac-timesN/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      15. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{\color{blue}{y \cdot z}}\right) \cdot \frac{1}{3} \]
      16. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{\frac{1}{18} \cdot \left(x \cdot \sqrt{t}\right)}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      17. associate-*r/N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      18. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \frac{\color{blue}{x \cdot \sqrt{t}}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      19. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \color{blue}{\left(x \cdot \frac{\sqrt{t}}{y \cdot z}\right)}\right) \cdot \frac{1}{3} \]
      20. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      21. lower-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      22. lower-*.f64N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\left(\frac{1}{18} \cdot x\right)} \cdot \frac{\sqrt{t}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      23. lower-/.f6498.1%

        \[\leadsto \cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \color{blue}{\frac{\sqrt{t}}{y \cdot z}}\right) \cdot 0.3333333333333333 \]
    5. Applied rewrites98.1%

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right)} \cdot 0.3333333333333333 \]
    6. Applied rewrites98.1%

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot 0.05555555555555555\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right) \cdot \pi} \]
    7. Add Preprocessing

    Alternative 3: 98.1% accurate, 1.1× speedup?

    \[\frac{\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right)}{3} \]
    (FPCore (x y z t)
      :precision binary64
      (/ (acos (* (* (/ x (* z y)) 0.05555555555555555) (sqrt t))) 3.0))
    double code(double x, double y, double z, double t) {
    	return acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t))) / 3.0;
    }
    
    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(x, y, z, t)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = acos((((x / (z * y)) * 0.05555555555555555d0) * sqrt(t))) / 3.0d0
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return Math.acos((((x / (z * y)) * 0.05555555555555555) * Math.sqrt(t))) / 3.0;
    }
    
    def code(x, y, z, t):
    	return math.acos((((x / (z * y)) * 0.05555555555555555) * math.sqrt(t))) / 3.0
    
    function code(x, y, z, t)
    	return Float64(acos(Float64(Float64(Float64(x / Float64(z * y)) * 0.05555555555555555) * sqrt(t))) / 3.0)
    end
    
    function tmp = code(x, y, z, t)
    	tmp = acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t))) / 3.0;
    end
    
    code[x_, y_, z_, t_] := N[(N[ArcCos[N[(N[(N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.05555555555555555), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / 3.0), $MachinePrecision]
    
    \frac{\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right)}{3}
    
    Derivation
    1. Initial program 97.9%

      \[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
      3. lower-*.f6497.9%

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
    3. Applied rewrites98.1%

      \[\leadsto \color{blue}{\cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot 0.1111111111111111}{y \cdot \left(z + z\right)}\right) \cdot 0.3333333333333333} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}\right)} \cdot \frac{1}{3} \]
      2. lift-/.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      3. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{\color{blue}{x \cdot \frac{1}{9}}}{y \cdot \left(z + z\right)}\right) \cdot \frac{1}{3} \]
      4. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{\color{blue}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      5. times-fracN/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{\frac{1}{9}}{z + z}\right)}\right) \cdot \frac{1}{3} \]
      6. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\sqrt{t} \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{9}}{z + z}\right)} \cdot \frac{1}{3} \]
      7. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\frac{\sqrt{t} \cdot x}{y}} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      8. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      9. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      10. lift-+.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{z + z}}\right) \cdot \frac{1}{3} \]
      11. count-2N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{2 \cdot z}}\right) \cdot \frac{1}{3} \]
      12. associate-/r*N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \color{blue}{\frac{\frac{\frac{1}{9}}{2}}{z}}\right) \cdot \frac{1}{3} \]
      13. metadata-evalN/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\color{blue}{\frac{1}{18}}}{z}\right) \cdot \frac{1}{3} \]
      14. frac-timesN/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      15. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{\color{blue}{y \cdot z}}\right) \cdot \frac{1}{3} \]
      16. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{\frac{1}{18} \cdot \left(x \cdot \sqrt{t}\right)}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      17. associate-*r/N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      18. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \frac{\color{blue}{x \cdot \sqrt{t}}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      19. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \color{blue}{\left(x \cdot \frac{\sqrt{t}}{y \cdot z}\right)}\right) \cdot \frac{1}{3} \]
      20. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      21. lower-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      22. lower-*.f64N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\left(\frac{1}{18} \cdot x\right)} \cdot \frac{\sqrt{t}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      23. lower-/.f6498.1%

        \[\leadsto \cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \color{blue}{\frac{\sqrt{t}}{y \cdot z}}\right) \cdot 0.3333333333333333 \]
    5. Applied rewrites98.1%

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right)} \cdot 0.3333333333333333 \]
    6. Applied rewrites98.1%

      \[\leadsto \color{blue}{\left(0.3333333333333333 \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot 0.05555555555555555\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right) \cdot \pi} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right) \cdot \pi} \]
      2. lift-*.f64N/A

        \[\leadsto \color{blue}{\left(\frac{1}{3} \cdot \frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi}\right)} \cdot \pi \]
      3. associate-*l*N/A

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \left(\frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi} \cdot \pi\right)} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi} \cdot \pi\right) \cdot \frac{1}{3}} \]
      5. metadata-evalN/A

        \[\leadsto \left(\frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi} \cdot \pi\right) \cdot \color{blue}{\frac{1}{3}} \]
      6. metadata-evalN/A

        \[\leadsto \left(\frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi} \cdot \pi\right) \cdot \frac{1}{\color{blue}{2 + 1}} \]
      7. mult-flip-revN/A

        \[\leadsto \color{blue}{\frac{\frac{\cos^{-1} \left(\left(\sqrt{t} \cdot \frac{1}{18}\right) \cdot \frac{x}{y \cdot z}\right)}{\pi} \cdot \pi}{2 + 1}} \]
    8. Applied rewrites98.1%

      \[\leadsto \color{blue}{\frac{\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right)}{3}} \]
    9. Add Preprocessing

    Alternative 4: 98.1% accurate, 1.2× speedup?

    \[\cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right) \cdot 0.3333333333333333 \]
    (FPCore (x y z t)
      :precision binary64
      (*
     (acos (* (* 0.05555555555555555 x) (/ (sqrt t) (* z y))))
     0.3333333333333333))
    double code(double x, double y, double z, double t) {
    	return acos(((0.05555555555555555 * x) * (sqrt(t) / (z * y)))) * 0.3333333333333333;
    }
    
    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(x, y, z, t)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = acos(((0.05555555555555555d0 * x) * (sqrt(t) / (z * y)))) * 0.3333333333333333d0
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return Math.acos(((0.05555555555555555 * x) * (Math.sqrt(t) / (z * y)))) * 0.3333333333333333;
    }
    
    def code(x, y, z, t):
    	return math.acos(((0.05555555555555555 * x) * (math.sqrt(t) / (z * y)))) * 0.3333333333333333
    
    function code(x, y, z, t)
    	return Float64(acos(Float64(Float64(0.05555555555555555 * x) * Float64(sqrt(t) / Float64(z * y)))) * 0.3333333333333333)
    end
    
    function tmp = code(x, y, z, t)
    	tmp = acos(((0.05555555555555555 * x) * (sqrt(t) / (z * y)))) * 0.3333333333333333;
    end
    
    code[x_, y_, z_, t_] := N[(N[ArcCos[N[(N[(0.05555555555555555 * x), $MachinePrecision] * N[(N[Sqrt[t], $MachinePrecision] / N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 0.3333333333333333), $MachinePrecision]
    
    \cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right) \cdot 0.3333333333333333
    
    Derivation
    1. Initial program 97.9%

      \[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
      3. lower-*.f6497.9%

        \[\leadsto \color{blue}{\cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \cdot \frac{1}{3}} \]
    3. Applied rewrites98.1%

      \[\leadsto \color{blue}{\cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot 0.1111111111111111}{y \cdot \left(z + z\right)}\right) \cdot 0.3333333333333333} \]
    4. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}\right)} \cdot \frac{1}{3} \]
      2. lift-/.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\frac{x \cdot \frac{1}{9}}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      3. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{\color{blue}{x \cdot \frac{1}{9}}}{y \cdot \left(z + z\right)}\right) \cdot \frac{1}{3} \]
      4. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \frac{x \cdot \frac{1}{9}}{\color{blue}{y \cdot \left(z + z\right)}}\right) \cdot \frac{1}{3} \]
      5. times-fracN/A

        \[\leadsto \cos^{-1} \left(\sqrt{t} \cdot \color{blue}{\left(\frac{x}{y} \cdot \frac{\frac{1}{9}}{z + z}\right)}\right) \cdot \frac{1}{3} \]
      6. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\sqrt{t} \cdot \frac{x}{y}\right) \cdot \frac{\frac{1}{9}}{z + z}\right)} \cdot \frac{1}{3} \]
      7. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\frac{\sqrt{t} \cdot x}{y}} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      8. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      9. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{x \cdot \sqrt{t}}}{y} \cdot \frac{\frac{1}{9}}{z + z}\right) \cdot \frac{1}{3} \]
      10. lift-+.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{z + z}}\right) \cdot \frac{1}{3} \]
      11. count-2N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\frac{1}{9}}{\color{blue}{2 \cdot z}}\right) \cdot \frac{1}{3} \]
      12. associate-/r*N/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \color{blue}{\frac{\frac{\frac{1}{9}}{2}}{z}}\right) \cdot \frac{1}{3} \]
      13. metadata-evalN/A

        \[\leadsto \cos^{-1} \left(\frac{x \cdot \sqrt{t}}{y} \cdot \frac{\color{blue}{\frac{1}{18}}}{z}\right) \cdot \frac{1}{3} \]
      14. frac-timesN/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      15. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{\left(x \cdot \sqrt{t}\right) \cdot \frac{1}{18}}{\color{blue}{y \cdot z}}\right) \cdot \frac{1}{3} \]
      16. *-commutativeN/A

        \[\leadsto \cos^{-1} \left(\frac{\color{blue}{\frac{1}{18} \cdot \left(x \cdot \sqrt{t}\right)}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      17. associate-*r/N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      18. lift-*.f64N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \frac{\color{blue}{x \cdot \sqrt{t}}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      19. associate-/l*N/A

        \[\leadsto \cos^{-1} \left(\frac{1}{18} \cdot \color{blue}{\left(x \cdot \frac{\sqrt{t}}{y \cdot z}\right)}\right) \cdot \frac{1}{3} \]
      20. associate-*r*N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      21. lower-*.f64N/A

        \[\leadsto \cos^{-1} \color{blue}{\left(\left(\frac{1}{18} \cdot x\right) \cdot \frac{\sqrt{t}}{y \cdot z}\right)} \cdot \frac{1}{3} \]
      22. lower-*.f64N/A

        \[\leadsto \cos^{-1} \left(\color{blue}{\left(\frac{1}{18} \cdot x\right)} \cdot \frac{\sqrt{t}}{y \cdot z}\right) \cdot \frac{1}{3} \]
      23. lower-/.f6498.1%

        \[\leadsto \cos^{-1} \left(\left(0.05555555555555555 \cdot x\right) \cdot \color{blue}{\frac{\sqrt{t}}{y \cdot z}}\right) \cdot 0.3333333333333333 \]
    5. Applied rewrites98.1%

      \[\leadsto \cos^{-1} \color{blue}{\left(\left(0.05555555555555555 \cdot x\right) \cdot \frac{\sqrt{t}}{z \cdot y}\right)} \cdot 0.3333333333333333 \]
    6. Add Preprocessing

    Alternative 5: 96.9% accurate, 1.2× speedup?

    \[0.3333333333333333 \cdot \cos^{-1} \left(0.05555555555555555 \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
    (FPCore (x y z t)
      :precision binary64
      (*
     0.3333333333333333
     (acos (* 0.05555555555555555 (/ (* x (sqrt t)) (* y z))))))
    double code(double x, double y, double z, double t) {
    	return 0.3333333333333333 * acos((0.05555555555555555 * ((x * sqrt(t)) / (y * z))));
    }
    
    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(x, y, z, t)
    use fmin_fmax_functions
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        real(8), intent (in) :: z
        real(8), intent (in) :: t
        code = 0.3333333333333333d0 * acos((0.05555555555555555d0 * ((x * sqrt(t)) / (y * z))))
    end function
    
    public static double code(double x, double y, double z, double t) {
    	return 0.3333333333333333 * Math.acos((0.05555555555555555 * ((x * Math.sqrt(t)) / (y * z))));
    }
    
    def code(x, y, z, t):
    	return 0.3333333333333333 * math.acos((0.05555555555555555 * ((x * math.sqrt(t)) / (y * z))))
    
    function code(x, y, z, t)
    	return Float64(0.3333333333333333 * acos(Float64(0.05555555555555555 * Float64(Float64(x * sqrt(t)) / Float64(y * z)))))
    end
    
    function tmp = code(x, y, z, t)
    	tmp = 0.3333333333333333 * acos((0.05555555555555555 * ((x * sqrt(t)) / (y * z))));
    end
    
    code[x_, y_, z_, t_] := N[(0.3333333333333333 * N[ArcCos[N[(0.05555555555555555 * N[(N[(x * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
    
    0.3333333333333333 \cdot \cos^{-1} \left(0.05555555555555555 \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)
    
    Derivation
    1. Initial program 97.9%

      \[\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right) \]
    2. Taylor expanded in x around 0

      \[\leadsto \color{blue}{\frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \]
    3. Step-by-step derivation
      1. metadata-evalN/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \color{blue}{\cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \]
      3. metadata-evalN/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \color{blue}{\left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \]
      4. lower-acos.f64N/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
      6. lower-/.f64N/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
      8. lower-sqrt.f64N/A

        \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
      9. lower-*.f6496.9%

        \[\leadsto 0.3333333333333333 \cdot \cos^{-1} \left(0.05555555555555555 \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
    4. Applied rewrites96.9%

      \[\leadsto \color{blue}{0.3333333333333333 \cdot \cos^{-1} \left(0.05555555555555555 \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)} \]
    5. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2025258 
    (FPCore (x y z t)
      :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, D"
      :precision binary64
      (* (/ 1.0 3.0) (acos (* (/ (* 3.0 (/ x (* y 27.0))) (* z 2.0)) (sqrt t)))))