Gyroid sphere

Percentage Accurate: 46.2% → 98.1%
Time: 6.1s
Alternatives: 7
Speedup: 8.9×

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 7 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.2% 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: 98.1% accurate, 4.8× speedup?

\[\begin{array}{l} \\ \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|30 \cdot x\right| - 0.2\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (fmax (- (hypot (* z 30.0) (* y 30.0)) 25.0) (- (fabs (* 30.0 x)) 0.2)))
double code(double x, double y, double z) {
	return fmax((hypot((z * 30.0), (y * 30.0)) - 25.0), (fabs((30.0 * x)) - 0.2));
}
public static double code(double x, double y, double z) {
	return fmax((Math.hypot((z * 30.0), (y * 30.0)) - 25.0), (Math.abs((30.0 * x)) - 0.2));
}
def code(x, y, z):
	return fmax((math.hypot((z * 30.0), (y * 30.0)) - 25.0), (math.fabs((30.0 * x)) - 0.2))
function code(x, y, z)
	return fmax(Float64(hypot(Float64(z * 30.0), Float64(y * 30.0)) - 25.0), Float64(abs(Float64(30.0 * x)) - 0.2))
end
function tmp = code(x, y, z)
	tmp = max((hypot((z * 30.0), (y * 30.0)) - 25.0), (abs((30.0 * x)) - 0.2));
end
code[x_, y_, z_] := N[Max[N[(N[Sqrt[N[(z * 30.0), $MachinePrecision] ^ 2 + N[(y * 30.0), $MachinePrecision] ^ 2], $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|30 \cdot x\right| - 0.2\right)
\end{array}
Derivation
  1. Initial program 41.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(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{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| - \frac{1}{5}\right) \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{max}\left(\sqrt{900 \cdot {z}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot 900 + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
    3. metadata-evalN/A

      \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot {30}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
    4. unpow-prod-downN/A

      \[\leadsto \mathsf{max}\left(\sqrt{{\left(z \cdot 30\right)}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
    5. unpow2N/A

      \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot 900} - 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| - \frac{1}{5}\right) \]
    7. metadata-evalN/A

      \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot {30}^{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| - \frac{1}{5}\right) \]
    8. unpow-prod-downN/A

      \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {\left(y \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| - \frac{1}{5}\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + \left(y \cdot 30\right) \cdot \left(y \cdot 30\right)} - 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| - \frac{1}{5}\right) \]
    10. lower-hypot.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y \cdot 30}\right) - 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| - \frac{1}{5}\right) \]
    11. lift-*.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y} \cdot 30\right) - 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| - \frac{1}{5}\right) \]
    12. lift-*.f6472.6

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot \color{blue}{30}\right) - 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) \]
  5. Applied rewrites72.6%

    \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right)} - 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) \]
  6. Taylor expanded in y around 0

    \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\color{blue}{\sin \left(30 \cdot x\right) + \cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right) + \color{blue}{\sin \left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot z\right) \cdot \cos \left(30 \cdot x\right) + \sin \color{blue}{\left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
    3. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot z\right), \color{blue}{\cos \left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    5. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \color{blue}{\left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    6. lift-*.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    8. lift-cos.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    10. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
    12. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
    13. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
    14. lower-*.f6472.1

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - 0.2\right) \]
  8. Applied rewrites72.1%

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

    \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
  10. Step-by-step derivation
    1. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    2. lift-*.f6472.1

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
  11. Applied rewrites72.1%

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

    \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|30 \cdot x\right| - \frac{1}{5}\right) \]
  13. Step-by-step derivation
    1. lift-*.f6498.7

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|30 \cdot x\right| - 0.2\right) \]
  14. Applied rewrites98.7%

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

Alternative 2: 96.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq 5000:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<=
      (fmax
       (-
        (sqrt
         (+
          (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
          (pow (* z 30.0) 2.0)))
        25.0)
       (-
        (fabs
         (+
          (* (sin (* z 30.0)) (cos (* x 30.0)))
          (+
           (* (sin (* x 30.0)) (cos (* y 30.0)))
           (* (sin (* y 30.0)) (cos (* z 30.0))))))
        0.2))
      5000.0)
   (fmax (- (* -30.0 y) 25.0) (- (fabs (sin (* 30.0 x))) 0.2))
   (fmax (* y 30.0) (- (fabs (fma 30.0 x (fma 30.0 y (* 30.0 z)))) 0.2))))
double code(double x, double y, double z) {
	double tmp;
	if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2)) <= 5000.0) {
		tmp = fmax(((-30.0 * y) - 25.0), (fabs(sin((30.0 * x))) - 0.2));
	} else {
		tmp = fmax((y * 30.0), (fabs(fma(30.0, x, fma(30.0, y, (30.0 * z)))) - 0.2));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))))) - 0.2)) <= 5000.0)
		tmp = fmax(Float64(Float64(-30.0 * y) - 25.0), Float64(abs(sin(Float64(30.0 * x))) - 0.2));
	else
		tmp = fmax(Float64(y * 30.0), Float64(abs(fma(30.0, x, fma(30.0, y, Float64(30.0 * z)))) - 0.2));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], 5000.0], N[Max[N[(N[(-30.0 * y), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(30.0 * x + N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq 5000:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < 5e3

    1. Initial program 99.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(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{900 \cdot {z}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot 900 + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot {30}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      4. unpow-prod-downN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{\left(z \cdot 30\right)}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot 900} - 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| - \frac{1}{5}\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot {30}^{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| - \frac{1}{5}\right) \]
      8. unpow-prod-downN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {\left(y \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| - \frac{1}{5}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + \left(y \cdot 30\right) \cdot \left(y \cdot 30\right)} - 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| - \frac{1}{5}\right) \]
      10. lower-hypot.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y \cdot 30}\right) - 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| - \frac{1}{5}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y} \cdot 30\right) - 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| - \frac{1}{5}\right) \]
      12. lift-*.f6499.9

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot \color{blue}{30}\right) - 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) \]
    5. Applied rewrites99.9%

      \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right)} - 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) \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\color{blue}{\sin \left(30 \cdot x\right) + \cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right) + \color{blue}{\sin \left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot z\right) \cdot \cos \left(30 \cdot x\right) + \sin \color{blue}{\left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot z\right), \color{blue}{\cos \left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      5. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \color{blue}{\left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      8. lift-cos.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      12. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      14. lower-*.f6495.0

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - 0.2\right) \]
    8. Applied rewrites95.0%

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

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
      2. lift-*.f6495.0

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    11. Applied rewrites95.0%

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

      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot y} - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lower-*.f6495.0

        \[\leadsto \mathsf{max}\left(-30 \cdot \color{blue}{y} - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    14. Applied rewrites95.0%

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

    if 5e3 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64)))

    1. Initial program 35.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 y around inf

      \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y}, \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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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| - \frac{1}{5}\right) \]
      2. lift-*.f6419.3

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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) \]
    5. Applied rewrites19.3%

      \[\leadsto \mathsf{max}\left(\color{blue}{y \cdot 30}, \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) \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\color{blue}{\sin \left(30 \cdot z\right) + \left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
      2. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    8. Applied rewrites41.3%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \color{blue}{\left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)}\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)}\right)\right| - \frac{1}{5}\right) \]
      2. lower-sin.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30} \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      7. lower-cos.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      8. lower-*.f6474.3

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right) \]
    11. Applied rewrites74.3%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot x + \left(30 \cdot y + \color{blue}{30 \cdot z}\right)\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot y + 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
      3. lower-*.f6496.5

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right) \]
    14. Applied rewrites96.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq 5000:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot y - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 96.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq -0.1:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (<=
      (fmax
       (-
        (sqrt
         (+
          (+ (pow (* x 30.0) 2.0) (pow (* y 30.0) 2.0))
          (pow (* z 30.0) 2.0)))
        25.0)
       (-
        (fabs
         (+
          (* (sin (* z 30.0)) (cos (* x 30.0)))
          (+
           (* (sin (* x 30.0)) (cos (* y 30.0)))
           (* (sin (* y 30.0)) (cos (* z 30.0))))))
        0.2))
      -0.1)
   (fmax (- (* -30.0 x) 25.0) (- (fabs (sin (* 30.0 x))) 0.2))
   (fmax (* y 30.0) (- (fabs (fma 30.0 x (fma 30.0 y (* 30.0 z)))) 0.2))))
double code(double x, double y, double z) {
	double tmp;
	if (fmax((sqrt(((pow((x * 30.0), 2.0) + pow((y * 30.0), 2.0)) + pow((z * 30.0), 2.0))) - 25.0), (fabs(((sin((z * 30.0)) * cos((x * 30.0))) + ((sin((x * 30.0)) * cos((y * 30.0))) + (sin((y * 30.0)) * cos((z * 30.0)))))) - 0.2)) <= -0.1) {
		tmp = fmax(((-30.0 * x) - 25.0), (fabs(sin((30.0 * x))) - 0.2));
	} else {
		tmp = fmax((y * 30.0), (fabs(fma(30.0, x, fma(30.0, y, (30.0 * z)))) - 0.2));
	}
	return tmp;
}
function code(x, y, z)
	tmp = 0.0
	if (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(sin(Float64(z * 30.0)) * cos(Float64(x * 30.0))) + Float64(Float64(sin(Float64(x * 30.0)) * cos(Float64(y * 30.0))) + Float64(sin(Float64(y * 30.0)) * cos(Float64(z * 30.0)))))) - 0.2)) <= -0.1)
		tmp = fmax(Float64(Float64(-30.0 * x) - 25.0), Float64(abs(sin(Float64(30.0 * x))) - 0.2));
	else
		tmp = fmax(Float64(y * 30.0), Float64(abs(fma(30.0, x, fma(30.0, y, Float64(30.0 * z)))) - 0.2));
	end
	return tmp
end
code[x_, y_, z_] := If[LessEqual[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[Sin[N[(z * 30.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(x * 30.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + 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]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], -0.1], N[Max[N[(N[(-30.0 * x), $MachinePrecision] - 25.0), $MachinePrecision], N[(N[Abs[N[Sin[N[(30.0 * x), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(30.0 * x + N[(30.0 * y + N[(30.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq -0.1:\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64))) < -0.10000000000000001

    1. Initial program 99.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(\color{blue}{\sqrt{900 \cdot {y}^{2} + 900 \cdot {z}^{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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{900 \cdot {z}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot 900 + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      3. metadata-evalN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{z}^{2} \cdot {30}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      4. unpow-prod-downN/A

        \[\leadsto \mathsf{max}\left(\sqrt{{\left(z \cdot 30\right)}^{2} + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      5. unpow2N/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + 900 \cdot {y}^{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| - \frac{1}{5}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot 900} - 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| - \frac{1}{5}\right) \]
      7. metadata-evalN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {y}^{2} \cdot {30}^{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| - \frac{1}{5}\right) \]
      8. unpow-prod-downN/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + {\left(y \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| - \frac{1}{5}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{max}\left(\sqrt{\left(z \cdot 30\right) \cdot \left(z \cdot 30\right) + \left(y \cdot 30\right) \cdot \left(y \cdot 30\right)} - 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| - \frac{1}{5}\right) \]
      10. lower-hypot.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y \cdot 30}\right) - 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| - \frac{1}{5}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, \color{blue}{y} \cdot 30\right) - 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| - \frac{1}{5}\right) \]
      12. lift-*.f6499.9

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot \color{blue}{30}\right) - 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) \]
    5. Applied rewrites99.9%

      \[\leadsto \mathsf{max}\left(\color{blue}{\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right)} - 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) \]
    6. Taylor expanded in y around 0

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\color{blue}{\sin \left(30 \cdot x\right) + \cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\cos \left(30 \cdot x\right) \cdot \sin \left(30 \cdot z\right) + \color{blue}{\sin \left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot z\right) \cdot \cos \left(30 \cdot x\right) + \sin \color{blue}{\left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(30 \cdot z\right), \color{blue}{\cos \left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      5. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \color{blue}{\left(30 \cdot x\right)}, \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      6. lift-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(\color{blue}{30} \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      8. lift-cos.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(x \cdot 30\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      10. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      12. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(x \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      13. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - \frac{1}{5}\right) \]
      14. lower-*.f6494.6

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\mathsf{fma}\left(\sin \left(z \cdot 30\right), \cos \left(30 \cdot x\right), \sin \left(30 \cdot x\right)\right)\right| - 0.2\right) \]
    8. Applied rewrites94.6%

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

      \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
      2. lift-*.f6494.6

        \[\leadsto \mathsf{max}\left(\mathsf{hypot}\left(z \cdot 30, y \cdot 30\right) - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    11. Applied rewrites94.6%

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

      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lift-*.f6494.6

        \[\leadsto \mathsf{max}\left(-30 \cdot \color{blue}{x} - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    14. Applied rewrites94.6%

      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x} - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]

    if -0.10000000000000001 < (fmax.f64 (-.f64 (sqrt.f64 (+.f64 (+.f64 (pow.f64 (*.f64 x #s(literal 30 binary64)) #s(literal 2 binary64)) (pow.f64 (*.f64 y #s(literal 30 binary64)) #s(literal 2 binary64))) (pow.f64 (*.f64 z #s(literal 30 binary64)) #s(literal 2 binary64)))) #s(literal 25 binary64)) (-.f64 (fabs.f64 (+.f64 (+.f64 (*.f64 (sin.f64 (*.f64 x #s(literal 30 binary64))) (cos.f64 (*.f64 y #s(literal 30 binary64)))) (*.f64 (sin.f64 (*.f64 y #s(literal 30 binary64))) (cos.f64 (*.f64 z #s(literal 30 binary64))))) (*.f64 (sin.f64 (*.f64 z #s(literal 30 binary64))) (cos.f64 (*.f64 x #s(literal 30 binary64)))))) #s(literal 1/5 binary64)))

    1. Initial program 35.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 y around inf

      \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y}, \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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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| - \frac{1}{5}\right) \]
      2. lift-*.f6419.2

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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) \]
    5. Applied rewrites19.2%

      \[\leadsto \mathsf{max}\left(\color{blue}{y \cdot 30}, \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) \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\color{blue}{\sin \left(30 \cdot z\right) + \left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
      2. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    8. Applied rewrites41.0%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \color{blue}{\left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)}\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)}\right)\right| - \frac{1}{5}\right) \]
      2. lower-sin.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30} \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      7. lower-cos.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      8. lower-*.f6473.8

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right) \]
    11. Applied rewrites73.8%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot x + \left(30 \cdot y + \color{blue}{30 \cdot z}\right)\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot y + 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
      2. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
      3. lower-*.f6495.8

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right) \]
    14. Applied rewrites95.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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|\sin \left(z \cdot 30\right) \cdot \cos \left(x \cdot 30\right) + \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)\right| - 0.2\right) \leq -0.1:\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x - 25, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 60.2% accurate, 8.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;x \leq -3.15 \cdot 10^{+147} \lor \neg \left(x \leq 2 \cdot 10^{+149}\right):\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - 0.2\right)\\ \end{array} \end{array} \]
(FPCore (x y z)
 :precision binary64
 (if (or (<= x -3.15e+147) (not (<= x 2e+149)))
   (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2))
   (fmax (* y 30.0) (- (fabs (* 30.0 z)) 0.2))))
double code(double x, double y, double z) {
	double tmp;
	if ((x <= -3.15e+147) || !(x <= 2e+149)) {
		tmp = fmax((-30.0 * x), (fabs((30.0 * x)) - 0.2));
	} else {
		tmp = fmax((y * 30.0), (fabs((30.0 * z)) - 0.2));
	}
	return tmp;
}
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
    real(8) :: tmp
    if ((x <= (-3.15d+147)) .or. (.not. (x <= 2d+149))) then
        tmp = fmax(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
    else
        tmp = fmax((y * 30.0d0), (abs((30.0d0 * z)) - 0.2d0))
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if ((x <= -3.15e+147) || !(x <= 2e+149)) {
		tmp = fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
	} else {
		tmp = fmax((y * 30.0), (Math.abs((30.0 * z)) - 0.2));
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if (x <= -3.15e+147) or not (x <= 2e+149):
		tmp = fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2))
	else:
		tmp = fmax((y * 30.0), (math.fabs((30.0 * z)) - 0.2))
	return tmp
function code(x, y, z)
	tmp = 0.0
	if ((x <= -3.15e+147) || !(x <= 2e+149))
		tmp = fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2));
	else
		tmp = fmax(Float64(y * 30.0), Float64(abs(Float64(30.0 * z)) - 0.2));
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if ((x <= -3.15e+147) || ~((x <= 2e+149)))
		tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2));
	else
		tmp = max((y * 30.0), (abs((30.0 * z)) - 0.2));
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[Or[LessEqual[x, -3.15e+147], N[Not[LessEqual[x, 2e+149]], $MachinePrecision]], N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision], N[Max[N[(y * 30.0), $MachinePrecision], N[(N[Abs[N[(30.0 * z), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.15 \cdot 10^{+147} \lor \neg \left(x \leq 2 \cdot 10^{+149}\right):\\
\;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - 0.2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if x < -3.14999999999999991e147 or 2.0000000000000001e149 < x

    1. Initial program 9.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 -inf

      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x}, \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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. lower-*.f6436.0

        \[\leadsto \mathsf{max}\left(-30 \cdot \color{blue}{x}, \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) \]
    5. Applied rewrites36.0%

      \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x}, \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) \]
    6. Taylor expanded in z around 0

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\color{blue}{\sin \left(30 \cdot y\right) + \cos \left(30 \cdot y\right) \cdot \sin \left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\cos \left(30 \cdot y\right) \cdot \sin \left(30 \cdot x\right) + \color{blue}{\sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
      2. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right) \cdot \cos \left(30 \cdot y\right) + \sin \color{blue}{\left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
      3. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \color{blue}{\cos \left(30 \cdot y\right)}, \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(x \cdot 30\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      5. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(x \cdot 30\right), \cos \color{blue}{\left(30 \cdot y\right)}, \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      6. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      7. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      9. lift-cos.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      10. lift-*.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      12. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
      13. lift-*.f6436.0

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - 0.2\right) \]
    8. Applied rewrites36.0%

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

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
      2. lift-*.f6436.0

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    11. Applied rewrites36.0%

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
    12. Taylor expanded in x around 0

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lift-*.f6472.9

        \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right) \]
    14. Applied rewrites72.9%

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right) \]

    if -3.14999999999999991e147 < x < 2.0000000000000001e149

    1. Initial program 55.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 y around inf

      \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y}, \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| - \frac{1}{5}\right) \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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| - \frac{1}{5}\right) \]
      2. lift-*.f6422.9

        \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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) \]
    5. Applied rewrites22.9%

      \[\leadsto \mathsf{max}\left(\color{blue}{y \cdot 30}, \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) \]
    6. Taylor expanded in x around 0

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\color{blue}{\sin \left(30 \cdot z\right) + \left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)}\right| - \frac{1}{5}\right) \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
      2. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    8. Applied rewrites30.1%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \color{blue}{\left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)}\right| - \frac{1}{5}\right) \]
    10. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)}\right)\right| - \frac{1}{5}\right) \]
      2. lower-sin.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30} \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      3. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      5. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      6. lower-*.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      7. lower-cos.f64N/A

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
      8. lower-*.f6465.8

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right) \]
    11. Applied rewrites65.8%

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

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - \frac{1}{5}\right) \]
    13. Step-by-step derivation
      1. lower-*.f6458.2

        \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - 0.2\right) \]
    14. Applied rewrites58.2%

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - 0.2\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \leq -3.15 \cdot 10^{+147} \lor \neg \left(x \leq 2 \cdot 10^{+149}\right):\\ \;\;\;\;\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{max}\left(y \cdot 30, \left|30 \cdot z\right| - 0.2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 85.7% accurate, 8.5× speedup?

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

\\
\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right)
\end{array}
Derivation
  1. Initial program 41.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 y around inf

    \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y}, \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| - \frac{1}{5}\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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| - \frac{1}{5}\right) \]
    2. lift-*.f6417.8

      \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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) \]
  5. Applied rewrites17.8%

    \[\leadsto \mathsf{max}\left(\color{blue}{y \cdot 30}, \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) \]
  6. Taylor expanded in x around 0

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\color{blue}{\sin \left(30 \cdot z\right) + \left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)}\right| - \frac{1}{5}\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    2. lower-+.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
  8. Applied rewrites37.5%

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

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \color{blue}{\left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)}\right| - \frac{1}{5}\right) \]
  10. Step-by-step derivation
    1. lower-+.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)}\right)\right| - \frac{1}{5}\right) \]
    2. lower-sin.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30} \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    4. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    5. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    6. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    7. lower-cos.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    8. lower-*.f6467.2

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right) \]
  11. Applied rewrites67.2%

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

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot x + \left(30 \cdot y + \color{blue}{30 \cdot z}\right)\right| - \frac{1}{5}\right) \]
  13. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot y + 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
    2. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - \frac{1}{5}\right) \]
    3. lower-*.f6487.2

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, \mathsf{fma}\left(30, y, 30 \cdot z\right)\right)\right| - 0.2\right) \]
  14. Applied rewrites87.2%

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

Alternative 6: 73.0% accurate, 8.9× speedup?

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

\\
\mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot z\right)\right| - 0.2\right)
\end{array}
Derivation
  1. Initial program 41.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 y around inf

    \[\leadsto \mathsf{max}\left(\color{blue}{30 \cdot y}, \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| - \frac{1}{5}\right) \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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| - \frac{1}{5}\right) \]
    2. lift-*.f6417.8

      \[\leadsto \mathsf{max}\left(y \cdot \color{blue}{30}, \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) \]
  5. Applied rewrites17.8%

    \[\leadsto \mathsf{max}\left(\color{blue}{y \cdot 30}, \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) \]
  6. Taylor expanded in x around 0

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\color{blue}{\sin \left(30 \cdot z\right) + \left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right)}\right| - \frac{1}{5}\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
    2. lower-+.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\left(30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right) + \cos \left(30 \cdot z\right) \cdot \sin \left(30 \cdot y\right)\right) + \color{blue}{\sin \left(30 \cdot z\right)}\right| - \frac{1}{5}\right) \]
  8. Applied rewrites37.5%

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

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \color{blue}{\left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)}\right| - \frac{1}{5}\right) \]
  10. Step-by-step derivation
    1. lower-+.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)}\right)\right| - \frac{1}{5}\right) \]
    2. lower-sin.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + \color{blue}{30} \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    3. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \left(30 \cdot z + 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    4. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    5. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    6. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    7. lower-cos.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - \frac{1}{5}\right) \]
    8. lower-*.f6467.2

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\sin \left(30 \cdot y\right) + \mathsf{fma}\left(30, z, 30 \cdot \left(x \cdot \cos \left(30 \cdot y\right)\right)\right)\right| - 0.2\right) \]
  11. Applied rewrites67.2%

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

    \[\leadsto \mathsf{max}\left(y \cdot 30, \left|30 \cdot x + 30 \cdot \color{blue}{z}\right| - \frac{1}{5}\right) \]
  13. Step-by-step derivation
    1. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot z\right)\right| - \frac{1}{5}\right) \]
    2. lower-*.f6474.4

      \[\leadsto \mathsf{max}\left(y \cdot 30, \left|\mathsf{fma}\left(30, x, 30 \cdot z\right)\right| - 0.2\right) \]
  14. Applied rewrites74.4%

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

Alternative 7: 31.3% accurate, 9.4× speedup?

\[\begin{array}{l} \\ \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right) \end{array} \]
(FPCore (x y z)
 :precision binary64
 (fmax (* -30.0 x) (- (fabs (* 30.0 x)) 0.2)))
double code(double x, double y, double z) {
	return fmax((-30.0 * x), (fabs((30.0 * x)) - 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(((-30.0d0) * x), (abs((30.0d0 * x)) - 0.2d0))
end function
public static double code(double x, double y, double z) {
	return fmax((-30.0 * x), (Math.abs((30.0 * x)) - 0.2));
}
def code(x, y, z):
	return fmax((-30.0 * x), (math.fabs((30.0 * x)) - 0.2))
function code(x, y, z)
	return fmax(Float64(-30.0 * x), Float64(abs(Float64(30.0 * x)) - 0.2))
end
function tmp = code(x, y, z)
	tmp = max((-30.0 * x), (abs((30.0 * x)) - 0.2));
end
code[x_, y_, z_] := N[Max[N[(-30.0 * x), $MachinePrecision], N[(N[Abs[N[(30.0 * x), $MachinePrecision]], $MachinePrecision] - 0.2), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right)
\end{array}
Derivation
  1. Initial program 41.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 -inf

    \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x}, \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| - \frac{1}{5}\right) \]
  4. Step-by-step derivation
    1. lower-*.f6418.3

      \[\leadsto \mathsf{max}\left(-30 \cdot \color{blue}{x}, \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) \]
  5. Applied rewrites18.3%

    \[\leadsto \mathsf{max}\left(\color{blue}{-30 \cdot x}, \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) \]
  6. Taylor expanded in z around 0

    \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\color{blue}{\sin \left(30 \cdot y\right) + \cos \left(30 \cdot y\right) \cdot \sin \left(30 \cdot x\right)}\right| - \frac{1}{5}\right) \]
  7. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\cos \left(30 \cdot y\right) \cdot \sin \left(30 \cdot x\right) + \color{blue}{\sin \left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right) \cdot \cos \left(30 \cdot y\right) + \sin \color{blue}{\left(30 \cdot y\right)}\right| - \frac{1}{5}\right) \]
    3. lower-fma.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \color{blue}{\cos \left(30 \cdot y\right)}, \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(x \cdot 30\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    5. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(x \cdot 30\right), \cos \color{blue}{\left(30 \cdot y\right)}, \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    6. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    7. lower-*.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(\color{blue}{30} \cdot y\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    9. lift-cos.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    10. lift-*.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(30 \cdot y\right)\right)\right| - \frac{1}{5}\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
    12. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - \frac{1}{5}\right) \]
    13. lift-*.f6418.0

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\mathsf{fma}\left(\sin \left(30 \cdot x\right), \cos \left(y \cdot 30\right), \sin \left(y \cdot 30\right)\right)\right| - 0.2\right) \]
  8. Applied rewrites18.0%

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

    \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
  10. Step-by-step derivation
    1. lift-sin.f64N/A

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - \frac{1}{5}\right) \]
    2. lift-*.f6417.5

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
  11. Applied rewrites17.5%

    \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|\sin \left(30 \cdot x\right)\right| - 0.2\right) \]
  12. Taylor expanded in x around 0

    \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - \frac{1}{5}\right) \]
  13. Step-by-step derivation
    1. lift-*.f6431.0

      \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right) \]
  14. Applied rewrites31.0%

    \[\leadsto \mathsf{max}\left(-30 \cdot x, \left|30 \cdot x\right| - 0.2\right) \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2025064 
(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)))