
(FPCore (x y z t) :precision binary64 :pre TRUE (* (/ 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)));
}
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]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = ((1) / (3)) * (acos(((((3) * (x / (y * (27)))) / (z * (2))) * (sqrt(t))))) END code
\frac{1}{3} \cdot \cos^{-1} \left(\frac{3 \cdot \frac{x}{y \cdot 27}}{z \cdot 2} \cdot \sqrt{t}\right)
Herbie found 4 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t) :precision binary64 :pre TRUE (* (/ 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)));
}
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]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = ((1) / (3)) * (acos(((((3) * (x / (y * (27)))) / (z * (2))) * (sqrt(t))))) END code
\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 :pre TRUE (* 0.3333333333333333 (acos (* (sqrt t) (* 0.05555555555555555 (/ (/ x y) z))))))
double code(double x, double y, double z, double t) {
return 0.3333333333333333 * acos((sqrt(t) * (0.05555555555555555 * ((x / y) / z))));
}
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((sqrt(t) * (0.05555555555555555d0 * ((x / y) / z))))
end function
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))));
}
def code(x, y, z, t): return 0.3333333333333333 * math.acos((math.sqrt(t) * (0.05555555555555555 * ((x / y) / z))))
function code(x, y, z, t) return Float64(0.3333333333333333 * acos(Float64(sqrt(t) * Float64(0.05555555555555555 * Float64(Float64(x / y) / z))))) end
function tmp = code(x, y, z, t) tmp = 0.3333333333333333 * acos((sqrt(t) * (0.05555555555555555 * ((x / y) / z)))); end
code[x_, y_, z_, t_] := N[(0.3333333333333333 * N[ArcCos[N[(N[Sqrt[t], $MachinePrecision] * N[(0.05555555555555555 * N[(N[(x / y), $MachinePrecision] / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (333333333333333314829616256247390992939472198486328125e-54) * (acos(((sqrt(t)) * ((555555555555555524716027093745651654899120330810546875e-55) * ((x / y) / z))))) END code
0.3333333333333333 \cdot \cos^{-1} \left(\sqrt{t} \cdot \left(0.05555555555555555 \cdot \frac{\frac{x}{y}}{z}\right)\right)
Initial program 98.0%
Applied rewrites98.0%
(FPCore (x y z t) :precision binary64 :pre TRUE (* 0.3333333333333333 (acos (* (* (/ x (* z y)) 0.05555555555555555) (sqrt t)))))
double code(double x, double y, double z, double t) {
return 0.3333333333333333 * acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t)));
}
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 / (z * y)) * 0.05555555555555555d0) * sqrt(t)))
end function
public static double code(double x, double y, double z, double t) {
return 0.3333333333333333 * Math.acos((((x / (z * y)) * 0.05555555555555555) * Math.sqrt(t)));
}
def code(x, y, z, t): return 0.3333333333333333 * math.acos((((x / (z * y)) * 0.05555555555555555) * math.sqrt(t)))
function code(x, y, z, t) return Float64(0.3333333333333333 * acos(Float64(Float64(Float64(x / Float64(z * y)) * 0.05555555555555555) * sqrt(t)))) end
function tmp = code(x, y, z, t) tmp = 0.3333333333333333 * acos((((x / (z * y)) * 0.05555555555555555) * sqrt(t))); end
code[x_, y_, z_, t_] := N[(0.3333333333333333 * N[ArcCos[N[(N[(N[(x / N[(z * y), $MachinePrecision]), $MachinePrecision] * 0.05555555555555555), $MachinePrecision] * N[Sqrt[t], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (333333333333333314829616256247390992939472198486328125e-54) * (acos((((x / (z * y)) * (555555555555555524716027093745651654899120330810546875e-55)) * (sqrt(t))))) END code
0.3333333333333333 \cdot \cos^{-1} \left(\left(\frac{x}{z \cdot y} \cdot 0.05555555555555555\right) \cdot \sqrt{t}\right)
Initial program 98.0%
Applied rewrites98.0%
Applied rewrites98.0%
(FPCore (x y z t) :precision binary64 :pre TRUE (* 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))));
}
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]
f(x, y, z, t): x in [-inf, +inf], y in [-inf, +inf], z in [-inf, +inf], t in [-inf, +inf] code: THEORY BEGIN f(x, y, z, t: real): real = (333333333333333314829616256247390992939472198486328125e-54) * (acos(((555555555555555524716027093745651654899120330810546875e-55) * ((x * (sqrt(t))) / (y * z))))) END code
0.3333333333333333 \cdot \cos^{-1} \left(0.05555555555555555 \cdot \frac{x \cdot \sqrt{t}}{y \cdot z}\right)
Initial program 98.0%
Taylor expanded in x around 0
Applied rewrites96.8%
herbie shell --seed 2026092
(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)))))