Gyroid sphere

Percentage Accurate: 46.8% → 90.1%
Time: 9.8s
Alternatives: 6
Speedup: 4.7×

Specification

?
\[\begin{array}{l} \\ \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (fmax
  (-
   (sqrt
    (+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0)))
   25.0)
  (-
   (fabs
    (+
     (+
      (* (sin (* x 30.0)) (cos (* y 30.0)))
      (* (sin (* y 30.0)) (cos (* z 30.0))))
     (* (sin (* z 30.0)) (cos (* x 30.0)))))
   0.2)))
double code(double x, double y, double z) {
	return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
	return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z):
	return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z)
	return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2))
end
function tmp = code(x, y, z)
	tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
\end{array}

Sampling outcomes in binary64 precision:

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 6 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: 46.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (fmax
  (-
   (sqrt
    (+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0)))
   25.0)
  (-
   (fabs
    (+
     (+
      (* (sin (* x 30.0)) (cos (* y 30.0)))
      (* (sin (* y 30.0)) (cos (* z 30.0))))
     (* (sin (* z 30.0)) (cos (* x 30.0)))))
   0.2)))
double code(double x, double y, double z) {
	return fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
}
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)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = fmax((sqrt(((((x * 30.0d0) ** 2.0d0) + ((y * 30.0d0) ** 2.0d0)) + ((z * 30.0d0) ** 2.0d0))) - 25.0d0), (abs((((sin((x * 30.0d0)) * cos((y * 30.0d0))) + (sin((y * 30.0d0)) * cos((z * 30.0d0)))) + (sin((z * 30.0d0)) * cos((x * 30.0d0))))) - 0.2d0))
end function
public static double code(double x, double y, double z) {
	return fmax((Math.sqrt(((Math.pow((x * 30.0), 2.0) + Math.pow((y * 30.0), 2.0)) + Math.pow((z * 30.0), 2.0))) - 25.0), (Math.abs((((Math.sin((x * 30.0)) * Math.cos((y * 30.0))) + (Math.sin((y * 30.0)) * Math.cos((z * 30.0)))) + (Math.sin((z * 30.0)) * Math.cos((x * 30.0))))) - 0.2));
}
def code(x, y, z):
	return fmax((math.sqrt(((math.pow((x * 30.0), 2.0) + math.pow((y * 30.0), 2.0)) + math.pow((z * 30.0), 2.0))) - 25.0), (math.fabs((((math.sin((x * 30.0)) * math.cos((y * 30.0))) + (math.sin((y * 30.0)) * math.cos((z * 30.0)))) + (math.sin((z * 30.0)) * math.cos((x * 30.0))))) - 0.2))
function code(x, y, z)
	return fmax(Float64(sqrt(Float64(Float64((Float64(x * 30.0) ^ 2.0) + (Float64(y * 30.0) ^ 2.0)) + (Float64(z * 30.0) ^ 2.0))) - 25.0), Float64(abs(Float64(Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))) + Float64(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))))) - 0.2))
end
function tmp = code(x, y, z)
	tmp = max((sqrt(((((x * 30.0) ^ 2.0) + ((y * 30.0) ^ 2.0)) + ((z * 30.0) ^ 2.0))) - 25.0), (abs((((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))) + (sin((z * 30.0)) * cos((x * 30.0))))) - 0.2));
end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(N[(N[Power[N[(x * 30.0), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[(y * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[Power[N[(z * 30.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(N[(N[Sin[N[(x * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(y * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(y * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(z * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right)
\end{array}

Alternative 1: 90.1% accurate, 2.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(30 \cdot y\right)\\ \mathbf{if}\;z \leq -5.5 \cdot 10^{+75} \lor \neg \left(z \leq 115000000\right):\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (let* ((t_0 (sin (* 30.0 y))))
   (if (or (<= z -5.5e+75) (not (<= z 115000000.0)))
     (fmax
      (- (hypot (* -30.0 z) (* -30.0 y)) 25.0)
      (- (fabs (fma t_0 1.0 (* z 30.0))) 0.2))
     (fmax
      (- (hypot (* -30.0 y) (* -30.0 x)) 25.0)
      (- (fabs (fma t_0 1.0 (sin (* 30.0 z)))) 0.2)))))
double code(double x, double y, double z) {
	double t_0 = sin((30.0 * y));
	double tmp;
	if ((z <= -5.5e+75) || !(z <= 115000000.0)) {
		tmp = fmax((hypot((-30.0 * z), (-30.0 * y)) - 25.0), (fabs(fma(t_0, 1.0, (z * 30.0))) - 0.2));
	} else {
		tmp = fmax((hypot((-30.0 * y), (-30.0 * x)) - 25.0), (fabs(fma(t_0, 1.0, sin((30.0 * z)))) - 0.2));
	}
	return tmp;
}
function code(x, y, z)
	t_0 = sin(Float64(30.0 * y))
	tmp = 0.0
	if ((z <= -5.5e+75) || !(z <= 115000000.0))
		tmp = fmax(Float64(hypot(Float64(-30.0 * z), Float64(-30.0 * y)) - 25.0), Float64(abs(fma(t_0, 1.0, Float64(z * 30.0))) - 0.2));
	else
		tmp = fmax(Float64(hypot(Float64(-30.0 * y), Float64(-30.0 * x)) - 25.0), Float64(abs(fma(t_0, 1.0, sin(Float64(30.0 * z)))) - 0.2));
	end
	return tmp
end
code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[z, -5.5e+75], N[Not[LessEqual[z, 115000000.0]], $MachinePrecision]], N[Max[N[(N[Sqrt[N[(-30.0 * z), $MachinePrecision] ^ 2 + N[(-30.0 * y), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(-30.0 * y), $MachinePrecision] ^ 2 + N[(-30.0 * x), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(30 \cdot y\right)\\
\mathbf{if}\;z \leq -5.5 \cdot 10^{+75} \lor \neg \left(z \leq 115000000\right):\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if z < -5.5000000000000001e75 or 1.15e8 < z

    1. Initial program 39.2%

      \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
    2. Add Preprocessing
    3. Taylor expanded in x around 0

      \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. Applied rewrites39.2%

        \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
      2. Taylor expanded in x around 0

        \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
      3. Step-by-step derivation
        1. Applied rewrites87.3%

          \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
        2. Taylor expanded in z around 0

          \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
        3. Step-by-step derivation
          1. Applied rewrites87.3%

            \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
          2. Taylor expanded in z around 0

            \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
          3. Step-by-step derivation
            1. Applied rewrites87.3%

              \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right) \]

            if -5.5000000000000001e75 < z < 1.15e8

            1. Initial program 59.2%

              \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
            2. Add Preprocessing
            3. Taylor expanded in x around 0

              \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
            4. Step-by-step derivation
              1. Applied rewrites59.2%

                \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
              2. Taylor expanded in z around 0

                \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {x}^{2} + 900 \cdot {y}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
              3. Step-by-step derivation
                1. Applied rewrites97.1%

                  \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                2. Taylor expanded in z around 0

                  \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites97.1%

                    \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                4. Recombined 2 regimes into one program.
                5. Final simplification92.4%

                  \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -5.5 \cdot 10^{+75} \lor \neg \left(z \leq 115000000\right):\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot y, -30 \cdot x\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \]
                6. Add Preprocessing

                Alternative 2: 88.4% accurate, 2.4× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(30 \cdot y\right)\\ \mathbf{if}\;y \leq -6.2 \cdot 10^{+117} \lor \neg \left(y \leq 2.6 \cdot 10^{-19}\right):\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot x, z \cdot 30\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
                (FPCore (x y z)
                 :precision binary64
                 (let* ((t_0 (sin (* 30.0 y))))
                   (if (or (<= y -6.2e+117) (not (<= y 2.6e-19)))
                     (fmax
                      (- (hypot (* -30.0 z) (* -30.0 y)) 25.0)
                      (- (fabs (fma t_0 1.0 (* z 30.0))) 0.2))
                     (fmax
                      (- (hypot (* -30.0 x) (* z 30.0)) 25.0)
                      (- (fabs (fma t_0 1.0 (sin (* 30.0 z)))) 0.2)))))
                double code(double x, double y, double z) {
                	double t_0 = sin((30.0 * y));
                	double tmp;
                	if ((y <= -6.2e+117) || !(y <= 2.6e-19)) {
                		tmp = fmax((hypot((-30.0 * z), (-30.0 * y)) - 25.0), (fabs(fma(t_0, 1.0, (z * 30.0))) - 0.2));
                	} else {
                		tmp = fmax((hypot((-30.0 * x), (z * 30.0)) - 25.0), (fabs(fma(t_0, 1.0, sin((30.0 * z)))) - 0.2));
                	}
                	return tmp;
                }
                
                function code(x, y, z)
                	t_0 = sin(Float64(30.0 * y))
                	tmp = 0.0
                	if ((y <= -6.2e+117) || !(y <= 2.6e-19))
                		tmp = fmax(Float64(hypot(Float64(-30.0 * z), Float64(-30.0 * y)) - 25.0), Float64(abs(fma(t_0, 1.0, Float64(z * 30.0))) - 0.2));
                	else
                		tmp = fmax(Float64(hypot(Float64(-30.0 * x), Float64(z * 30.0)) - 25.0), Float64(abs(fma(t_0, 1.0, sin(Float64(30.0 * z)))) - 0.2));
                	end
                	return tmp
                end
                
                code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[y, -6.2e+117], N[Not[LessEqual[y, 2.6e-19]], $MachinePrecision]], N[Max[N[(N[Sqrt[N[(-30.0 * z), $MachinePrecision] ^ 2 + N[(-30.0 * y), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[Sqrt[N[(-30.0 * x), $MachinePrecision] ^ 2 + N[(z * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \sin \left(30 \cdot y\right)\\
                \mathbf{if}\;y \leq -6.2 \cdot 10^{+117} \lor \neg \left(y \leq 2.6 \cdot 10^{-19}\right):\\
                \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot x, z \cdot 30\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 2 regimes
                2. if y < -6.1999999999999995e117 or 2.60000000000000013e-19 < y

                  1. Initial program 31.6%

                    \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in x around 0

                    \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                  4. Step-by-step derivation
                    1. Applied rewrites31.6%

                      \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                    2. Taylor expanded in x around 0

                      \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites84.8%

                        \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                      2. Taylor expanded in z around 0

                        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                      3. Step-by-step derivation
                        1. Applied rewrites84.8%

                          \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                        2. Taylor expanded in z around 0

                          \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
                        3. Step-by-step derivation
                          1. Applied rewrites84.8%

                            \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right) \]

                          if -6.1999999999999995e117 < y < 2.60000000000000013e-19

                          1. Initial program 63.4%

                            \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in x around 0

                            \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                          4. Step-by-step derivation
                            1. Applied rewrites63.4%

                              \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                            2. Taylor expanded in x around 0

                              \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                            3. Step-by-step derivation
                              1. Applied rewrites63.0%

                                \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                              2. Taylor expanded in z around 0

                                \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites63.0%

                                  \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                2. Taylor expanded in y around 0

                                  \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {x}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                3. Step-by-step derivation
                                  1. Applied rewrites96.1%

                                    \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot x, z \cdot 30\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                4. Recombined 2 regimes into one program.
                                5. Final simplification91.2%

                                  \[\leadsto \begin{array}{l} \mathbf{if}\;y \leq -6.2 \cdot 10^{+117} \lor \neg \left(y \leq 2.6 \cdot 10^{-19}\right):\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot x, z \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \]
                                6. Add Preprocessing

                                Alternative 3: 86.7% accurate, 3.1× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(30 \cdot y\right)\\ t_1 := \sin \left(30 \cdot z\right)\\ \mathbf{if}\;x \leq -1.35 \cdot 10^{+38}:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, t\_1\right)\right| - 0.2\right)\\ \mathbf{elif}\;x \leq 8.5 \cdot 10^{+164}:\\ \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(t\_0, 1, t\_1\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
                                (FPCore (x y z)
                                 :precision binary64
                                 (let* ((t_0 (sin (* 30.0 y))) (t_1 (sin (* 30.0 z))))
                                   (if (<= x -1.35e+38)
                                     (fmax (- (* -30.0 x) 25.0) (- (fabs (fma (* y 30.0) 1.0 t_1)) 0.2))
                                     (if (<= x 8.5e+164)
                                       (fmax
                                        (- (hypot (* -30.0 z) (* -30.0 y)) 25.0)
                                        (- (fabs (fma t_0 1.0 (* z 30.0))) 0.2))
                                       (fmax (* 30.0 x) (- (fabs (fma t_0 1.0 t_1)) 0.2))))))
                                double code(double x, double y, double z) {
                                	double t_0 = sin((30.0 * y));
                                	double t_1 = sin((30.0 * z));
                                	double tmp;
                                	if (x <= -1.35e+38) {
                                		tmp = fmax(((-30.0 * x) - 25.0), (fabs(fma((y * 30.0), 1.0, t_1)) - 0.2));
                                	} else if (x <= 8.5e+164) {
                                		tmp = fmax((hypot((-30.0 * z), (-30.0 * y)) - 25.0), (fabs(fma(t_0, 1.0, (z * 30.0))) - 0.2));
                                	} else {
                                		tmp = fmax((30.0 * x), (fabs(fma(t_0, 1.0, t_1)) - 0.2));
                                	}
                                	return tmp;
                                }
                                
                                function code(x, y, z)
                                	t_0 = sin(Float64(30.0 * y))
                                	t_1 = sin(Float64(30.0 * z))
                                	tmp = 0.0
                                	if (x <= -1.35e+38)
                                		tmp = fmax(Float64(Float64(-30.0 * x) - 25.0), Float64(abs(fma(Float64(y * 30.0), 1.0, t_1)) - 0.2));
                                	elseif (x <= 8.5e+164)
                                		tmp = fmax(Float64(hypot(Float64(-30.0 * z), Float64(-30.0 * y)) - 25.0), Float64(abs(fma(t_0, 1.0, Float64(z * 30.0))) - 0.2));
                                	else
                                		tmp = fmax(Float64(30.0 * x), Float64(abs(fma(t_0, 1.0, t_1)) - 0.2));
                                	end
                                	return tmp
                                end
                                
                                code[x_, y_, z_] := Block[{t$95$0 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[x, -1.35e+38], N[Max[N[(N[(-30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(y * 30.0), $MachinePrecision] * 1.0 + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[x, 8.5e+164], N[Max[N[(N[Sqrt[N[(-30.0 * z), $MachinePrecision] ^ 2 + N[(-30.0 * y), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(30.0 * x), $MachinePrecision], N[(N[Abs[N[(t$95$0 * 1.0 + t$95$1), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                t_0 := \sin \left(30 \cdot y\right)\\
                                t_1 := \sin \left(30 \cdot z\right)\\
                                \mathbf{if}\;x \leq -1.35 \cdot 10^{+38}:\\
                                \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, t\_1\right)\right| - 0.2\right)\\
                                
                                \mathbf{elif}\;x \leq 8.5 \cdot 10^{+164}:\\
                                \;\;\;\;\mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(t\_0, 1, z \cdot 30\right)\right| - 0.2\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\mathsf{max}\left(30 \cdot x, \left|\mathsf{fma}\left(t\_0, 1, t\_1\right)\right| - 0.2\right)\\
                                
                                
                                \end{array}
                                \end{array}
                                
                                Derivation
                                1. Split input into 3 regimes
                                2. if x < -1.34999999999999998e38

                                  1. Initial program 36.1%

                                    \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                  2. Add Preprocessing
                                  3. Taylor expanded in x around 0

                                    \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                  4. Step-by-step derivation
                                    1. Applied rewrites36.1%

                                      \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                    2. Taylor expanded in x around -inf

                                      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites63.3%

                                        \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                      2. Taylor expanded in z around 0

                                        \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites63.3%

                                          \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                        2. Taylor expanded in y around 0

                                          \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(30 \cdot y, 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                        3. Step-by-step derivation
                                          1. Applied rewrites84.1%

                                            \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]

                                          if -1.34999999999999998e38 < x < 8.50000000000000027e164

                                          1. Initial program 59.9%

                                            \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in x around 0

                                            \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites59.9%

                                              \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                            2. Taylor expanded in x around 0

                                              \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites90.7%

                                                \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                              2. Taylor expanded in z around 0

                                                \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites90.7%

                                                  \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                2. Taylor expanded in z around 0

                                                  \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites90.0%

                                                    \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right) \]

                                                  if 8.50000000000000027e164 < x

                                                  1. Initial program 6.9%

                                                    \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                  2. Add Preprocessing
                                                  3. Taylor expanded in x around 0

                                                    \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                  4. Step-by-step derivation
                                                    1. Applied rewrites6.9%

                                                      \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                    2. Taylor expanded in x around 0

                                                      \[\leadsto \mathsf{max}\left(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{2}}} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites20.6%

                                                        \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right)} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                      2. Taylor expanded in z around 0

                                                        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites20.6%

                                                          \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(-30 \cdot z, -30 \cdot y\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                        2. Taylor expanded in x around inf

                                                          \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot x}, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites82.6%

                                                            \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot x}, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                        4. Recombined 3 regimes into one program.
                                                        5. Add Preprocessing

                                                        Alternative 4: 76.4% accurate, 3.1× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := -30 \cdot x - 25\\ t_1 := \sin \left(30 \cdot y\right)\\ \mathbf{if}\;y \leq -9.2 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \mathbf{elif}\;y \leq 2.6 \cdot 10^{-19}:\\ \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(t\_1, 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(30 \cdot y - 25, \left|\mathsf{fma}\left(t\_1, \cos \left(-30 \cdot z\right), z \cdot 30\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
                                                        (FPCore (x y z)
                                                         :precision binary64
                                                         (let* ((t_0 (- (* -30.0 x) 25.0)) (t_1 (sin (* 30.0 y))))
                                                           (if (<= y -9.2e+137)
                                                             (fmax t_0 (- (fabs (fma (* y 30.0) 1.0 (sin (* 30.0 z)))) 0.2))
                                                             (if (<= y 2.6e-19)
                                                               (fmax t_0 (- (fabs (fma t_1 1.0 (* z 30.0))) 0.2))
                                                               (fmax
                                                                (- (* 30.0 y) 25.0)
                                                                (- (fabs (fma t_1 (cos (* -30.0 z)) (* z 30.0))) 0.2))))))
                                                        double code(double x, double y, double z) {
                                                        	double t_0 = (-30.0 * x) - 25.0;
                                                        	double t_1 = sin((30.0 * y));
                                                        	double tmp;
                                                        	if (y <= -9.2e+137) {
                                                        		tmp = fmax(t_0, (fabs(fma((y * 30.0), 1.0, sin((30.0 * z)))) - 0.2));
                                                        	} else if (y <= 2.6e-19) {
                                                        		tmp = fmax(t_0, (fabs(fma(t_1, 1.0, (z * 30.0))) - 0.2));
                                                        	} else {
                                                        		tmp = fmax(((30.0 * y) - 25.0), (fabs(fma(t_1, cos((-30.0 * z)), (z * 30.0))) - 0.2));
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        function code(x, y, z)
                                                        	t_0 = Float64(Float64(-30.0 * x) - 25.0)
                                                        	t_1 = sin(Float64(30.0 * y))
                                                        	tmp = 0.0
                                                        	if (y <= -9.2e+137)
                                                        		tmp = fmax(t_0, Float64(abs(fma(Float64(y * 30.0), 1.0, sin(Float64(30.0 * z)))) - 0.2));
                                                        	elseif (y <= 2.6e-19)
                                                        		tmp = fmax(t_0, Float64(abs(fma(t_1, 1.0, Float64(z * 30.0))) - 0.2));
                                                        	else
                                                        		tmp = fmax(Float64(Float64(30.0 * y) - 25.0), Float64(abs(fma(t_1, cos(Float64(-30.0 * z)), Float64(z * 30.0))) - 0.2));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[y, -9.2e+137], N[Max[t$95$0, N[(N[Abs[N[(N[(y * 30.0), $MachinePrecision] * 1.0 + N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], If[LessEqual[y, 2.6e-19], N[Max[t$95$0, N[(N[Abs[N[(t$95$1 * 1.0 + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(N[(30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(t$95$1 * N[Cos[N[(-30.0 * z), $MachinePrecision]], $MachinePrecision] + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        t_0 := -30 \cdot x - 25\\
                                                        t_1 := \sin \left(30 \cdot y\right)\\
                                                        \mathbf{if}\;y \leq -9.2 \cdot 10^{+137}:\\
                                                        \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\
                                                        
                                                        \mathbf{elif}\;y \leq 2.6 \cdot 10^{-19}:\\
                                                        \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(t\_1, 1, z \cdot 30\right)\right| - 0.2\right)\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\mathsf{max}\left(30 \cdot y - 25, \left|\mathsf{fma}\left(t\_1, \cos \left(-30 \cdot z\right), z \cdot 30\right)\right| - 0.2\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 3 regimes
                                                        2. if y < -9.19999999999999997e137

                                                          1. Initial program 21.8%

                                                            \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                          2. Add Preprocessing
                                                          3. Taylor expanded in x around 0

                                                            \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                          4. Step-by-step derivation
                                                            1. Applied rewrites21.8%

                                                              \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                            2. Taylor expanded in x around -inf

                                                              \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites6.7%

                                                                \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                              2. Taylor expanded in z around 0

                                                                \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites6.4%

                                                                  \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                2. Taylor expanded in y around 0

                                                                  \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(30 \cdot y, 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites71.6%

                                                                    \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]

                                                                  if -9.19999999999999997e137 < y < 2.60000000000000013e-19

                                                                  1. Initial program 63.5%

                                                                    \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                                  2. Add Preprocessing
                                                                  3. Taylor expanded in x around 0

                                                                    \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                                  4. Step-by-step derivation
                                                                    1. Applied rewrites63.5%

                                                                      \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                                    2. Taylor expanded in x around -inf

                                                                      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites37.4%

                                                                        \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                      2. Taylor expanded in z around 0

                                                                        \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites37.4%

                                                                          \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                        2. Taylor expanded in z around 0

                                                                          \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites78.1%

                                                                            \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right) \]

                                                                          if 2.60000000000000013e-19 < y

                                                                          1. Initial program 35.3%

                                                                            \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                                          2. Add Preprocessing
                                                                          3. Taylor expanded in x around 0

                                                                            \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                                          4. Step-by-step derivation
                                                                            1. Applied rewrites35.3%

                                                                              \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                                            2. Taylor expanded in y around inf

                                                                              \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites64.7%

                                                                                \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                              2. Taylor expanded in z around 0

                                                                                \[\leadsto \mathsf{max}\left(30 \cdot y - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites84.8%

                                                                                  \[\leadsto \mathsf{max}\left(30 \cdot y - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), z \cdot 30\right)\right| - 0.2\right) \]
                                                                              4. Recombined 3 regimes into one program.
                                                                              5. Add Preprocessing

                                                                              Alternative 5: 74.7% accurate, 4.5× speedup?

                                                                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := -30 \cdot x - 25\\ \mathbf{if}\;z \leq -1.25 \cdot 10^{+20} \lor \neg \left(z \leq 1.32 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
                                                                              (FPCore (x y z)
                                                                               :precision binary64
                                                                               (let* ((t_0 (- (* -30.0 x) 25.0)))
                                                                                 (if (or (<= z -1.25e+20) (not (<= z 1.32e+16)))
                                                                                   (fmax t_0 (- (fabs (fma (sin (* 30.0 y)) 1.0 (* z 30.0))) 0.2))
                                                                                   (fmax t_0 (- (fabs (fma (* y 30.0) 1.0 (sin (* 30.0 z)))) 0.2)))))
                                                                              double code(double x, double y, double z) {
                                                                              	double t_0 = (-30.0 * x) - 25.0;
                                                                              	double tmp;
                                                                              	if ((z <= -1.25e+20) || !(z <= 1.32e+16)) {
                                                                              		tmp = fmax(t_0, (fabs(fma(sin((30.0 * y)), 1.0, (z * 30.0))) - 0.2));
                                                                              	} else {
                                                                              		tmp = fmax(t_0, (fabs(fma((y * 30.0), 1.0, sin((30.0 * z)))) - 0.2));
                                                                              	}
                                                                              	return tmp;
                                                                              }
                                                                              
                                                                              function code(x, y, z)
                                                                              	t_0 = Float64(Float64(-30.0 * x) - 25.0)
                                                                              	tmp = 0.0
                                                                              	if ((z <= -1.25e+20) || !(z <= 1.32e+16))
                                                                              		tmp = fmax(t_0, Float64(abs(fma(sin(Float64(30.0 * y)), 1.0, Float64(z * 30.0))) - 0.2));
                                                                              	else
                                                                              		tmp = fmax(t_0, Float64(abs(fma(Float64(y * 30.0), 1.0, sin(Float64(30.0 * z)))) - 0.2));
                                                                              	end
                                                                              	return tmp
                                                                              end
                                                                              
                                                                              code[x_, y_, z_] := Block[{t$95$0 = N[(N[(-30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision]}, If[Or[LessEqual[z, -1.25e+20], N[Not[LessEqual[z, 1.32e+16]], $MachinePrecision]], N[Max[t$95$0, N[(N[Abs[N[(N[Sin[N[(30.0 * y), $MachinePrecision]], $MachinePrecision] * 1.0 + N[(z * 30.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[t$95$0, N[(N[Abs[N[(N[(y * 30.0), $MachinePrecision] * 1.0 + N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]]
                                                                              
                                                                              \begin{array}{l}
                                                                              
                                                                              \\
                                                                              \begin{array}{l}
                                                                              t_0 := -30 \cdot x - 25\\
                                                                              \mathbf{if}\;z \leq -1.25 \cdot 10^{+20} \lor \neg \left(z \leq 1.32 \cdot 10^{+16}\right):\\
                                                                              \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right)\\
                                                                              
                                                                              \mathbf{else}:\\
                                                                              \;\;\;\;\mathsf{max}\left(t\_0, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\
                                                                              
                                                                              
                                                                              \end{array}
                                                                              \end{array}
                                                                              
                                                                              Derivation
                                                                              1. Split input into 2 regimes
                                                                              2. if z < -1.25e20 or 1.32e16 < z

                                                                                1. Initial program 40.0%

                                                                                  \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                                                2. Add Preprocessing
                                                                                3. Taylor expanded in x around 0

                                                                                  \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                                                4. Step-by-step derivation
                                                                                  1. Applied rewrites40.0%

                                                                                    \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                                                  2. Taylor expanded in x around -inf

                                                                                    \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites12.6%

                                                                                      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                    2. Taylor expanded in z around 0

                                                                                      \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites12.4%

                                                                                        \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                      2. Taylor expanded in z around 0

                                                                                        \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
                                                                                      3. Step-by-step derivation
                                                                                        1. Applied rewrites74.9%

                                                                                          \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right) \]

                                                                                        if -1.25e20 < z < 1.32e16

                                                                                        1. Initial program 59.7%

                                                                                          \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                                                        2. Add Preprocessing
                                                                                        3. Taylor expanded in x around 0

                                                                                          \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                                                        4. Step-by-step derivation
                                                                                          1. Applied rewrites59.7%

                                                                                            \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                                                          2. Taylor expanded in x around -inf

                                                                                            \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                          3. Step-by-step derivation
                                                                                            1. Applied rewrites41.2%

                                                                                              \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                            2. Taylor expanded in z around 0

                                                                                              \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                            3. Step-by-step derivation
                                                                                              1. Applied rewrites41.1%

                                                                                                \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                              2. Taylor expanded in y around 0

                                                                                                \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(30 \cdot y, 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites77.7%

                                                                                                  \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                              4. Recombined 2 regimes into one program.
                                                                                              5. Final simplification76.3%

                                                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -1.25 \cdot 10^{+20} \lor \neg \left(z \leq 1.32 \cdot 10^{+16}\right):\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, z \cdot 30\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \]
                                                                                              6. Add Preprocessing

                                                                                              Alternative 6: 57.1% accurate, 4.7× speedup?

                                                                                              \[\begin{array}{l} \\ \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \end{array} \]
                                                                                              (FPCore (x y z)
                                                                                               :precision binary64
                                                                                               (fmax
                                                                                                (- (* -30.0 x) 25.0)
                                                                                                (- (fabs (fma (* y 30.0) 1.0 (sin (* 30.0 z)))) 0.2)))
                                                                                              double code(double x, double y, double z) {
                                                                                              	return fmax(((-30.0 * x) - 25.0), (fabs(fma((y * 30.0), 1.0, sin((30.0 * z)))) - 0.2));
                                                                                              }
                                                                                              
                                                                                              function code(x, y, z)
                                                                                              	return fmax(Float64(Float64(-30.0 * x) - 25.0), Float64(abs(fma(Float64(y * 30.0), 1.0, sin(Float64(30.0 * z)))) - 0.2))
                                                                                              end
                                                                                              
                                                                                              code[x_, y_, z_] := N[Max[N[(N[(-30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(N[(y * 30.0), $MachinePrecision] * 1.0 + N[Sin[N[(30.0 * z), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
                                                                                              
                                                                                              \begin{array}{l}
                                                                                              
                                                                                              \\
                                                                                              \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right)
                                                                                              \end{array}
                                                                                              
                                                                                              Derivation
                                                                                              1. Initial program 49.6%

                                                                                                \[\mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\left(\sin \left(x \cdot 30\right) \cdot \cos \left(y \cdot 30\right) + \sin \left(y \cdot 30\right) \cdot \cos \left(z \cdot 30\right)\right) + \sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right)\right| - 0.2\right) \]
                                                                                              2. Add Preprocessing
                                                                                              3. Taylor expanded in x around 0

                                                                                                \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\sin \left(30 \cdot z\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
                                                                                              4. Step-by-step derivation
                                                                                                1. Applied rewrites49.6%

                                                                                                  \[\leadsto \mathsf{max}\left(\sqrt{\left({\left(x \cdot 30\right)}^{2} + {\left(y \cdot 30\right)}^{2}\right) + {\left(z \cdot 30\right)}^{2}} - 25, \left|\color{blue}{\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)}\right| - 0.2\right) \]
                                                                                                2. Taylor expanded in x around -inf

                                                                                                  \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                                3. Step-by-step derivation
                                                                                                  1. Applied rewrites26.5%

                                                                                                    \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), \cos \left(-30 \cdot z\right), \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                                  2. Taylor expanded in z around 0

                                                                                                    \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                                  3. Step-by-step derivation
                                                                                                    1. Applied rewrites26.4%

                                                                                                      \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot y\right), 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                                    2. Taylor expanded in y around 0

                                                                                                      \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(30 \cdot y, 1, \sin \left(30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites53.8%

                                                                                                        \[\leadsto \mathsf{max}\left(-30 \cdot x - 25, \left|\mathsf{fma}\left(y \cdot 30, 1, \sin \left(30 \cdot z\right)\right)\right| - 0.2\right) \]
                                                                                                      2. Add Preprocessing

                                                                                                      Reproduce

                                                                                                      ?
                                                                                                      herbie shell --seed 2025019 
                                                                                                      (FPCore (x y z)
                                                                                                        :name "Gyroid sphere"
                                                                                                        :precision binary64
                                                                                                        (fmax (- (sqrt (+ (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0)) (pow (* z 30.0) 2.0))) 25.0) (- (fabs (+ (+ (* (sin (* x 30.0)) (cos (* y 30.0))) (* (sin (* y 30.0)) (cos (* z 30.0)))) (* (sin (* z 30.0)) (cos (* x 30.0))))) 0.2)))