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

Percentage Accurate: 98.0% → 99.5%
Time: 1.3min
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 3) (acos (* (/ (* 3 (/ x (* y 27))) (* z 2)) (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 / 3), $MachinePrecision] * N[ArcCos[N[(N[(N[(3 * N[(x / N[(y * 27), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * 2), $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: 98.0% 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 3) (acos (* (/ (* 3 (/ x (* y 27))) (* z 2)) (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 / 3), $MachinePrecision] * N[ArcCos[N[(N[(N[(3 * N[(x / N[(y * 27), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(z * 2), $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.5% accurate, 0.4× speedup?

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

    \[\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-*.f6497.0%

      \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
  4. Applied rewrites97.0%

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

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

Alternative 2: 99.5% accurate, 0.5× speedup?

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

    \[\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-*.f6497.0%

      \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
  4. Applied rewrites97.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{3} \cdot \left(\left(\frac{1}{2} \cdot \frac{{\pi}^{1}}{{\pi}^{\frac{2}{3}}}\right) \cdot \frac{\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot \frac{1}{18}\right) \cdot \sqrt{t}\right)}{\sqrt[3]{\pi} \cdot \frac{1}{2}}\right) \]
    7. pow-divN/A

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

      \[\leadsto \frac{1}{3} \cdot \left(\left(\frac{1}{2} \cdot {\pi}^{\frac{1}{3}}\right) \cdot \frac{\cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot \frac{1}{18}\right) \cdot \sqrt{t}\right)}{\sqrt[3]{\pi} \cdot \frac{1}{2}}\right) \]
    9. pow1/3N/A

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

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

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

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

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

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

Alternative 3: 98.0% accurate, 1.0× speedup?

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

    \[\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-*.f6497.0%

      \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
  4. Applied rewrites97.0%

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 98.0% accurate, 1.2× speedup?

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

    \[\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. metadata-eval98.0%

      \[\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) \]
  3. Applied rewrites98.0%

    \[\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) \]
  4. Step-by-step derivation
    1. lift-/.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 97.0% accurate, 1.2× speedup?

\[\frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
(FPCore (x y z t)
  :precision binary64
  (* 1/3 (acos (* 1/18 (/ (* 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[(1/3 * N[ArcCos[N[(1/18 * N[(N[(x * N[Sqrt[t], $MachinePrecision]), $MachinePrecision] / N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)
Derivation
  1. Initial program 98.0%

    \[\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-*.f6497.0%

      \[\leadsto \frac{1}{3} \cdot \cos^{-1} \left(\frac{1}{18} \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right) \]
  4. Applied rewrites97.0%

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

Reproduce

?
herbie shell --seed 2025271 -o generate:evaluate
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, D"
  :precision binary64
  (* (/ 1 3) (acos (* (/ (* 3 (/ x (* y 27))) (* z 2)) (sqrt t)))))