Data.Histogram.Bin.BinF:$cfromIndex from histogram-fill-0.8.4.1

Percentage Accurate: 100.0% → 100.0%
Time: 13.7s
Alternatives: 7
Speedup: 1.4×

Specification

?
\[\left(\frac{x}{2} + y \cdot x\right) + z \]
(FPCore (x y z)
  :precision binary64
  (+ (+ (/ x 2) (* y x)) z))
double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z):
	return ((x / 2.0) + (y * x)) + z
function code(x, y, z)
	return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z)
end
function tmp = code(x, y, z)
	tmp = ((x / 2.0) + (y * x)) + z;
end
code[x_, y_, z_] := N[(N[(N[(x / 2), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\left(\frac{x}{2} + y \cdot x\right) + z

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

\[\left(\frac{x}{2} + y \cdot x\right) + z \]
(FPCore (x y z)
  :precision binary64
  (+ (+ (/ x 2) (* y x)) z))
double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(x, y, z)
use fmin_fmax_functions
    real(8), intent (in) :: x
    real(8), intent (in) :: y
    real(8), intent (in) :: z
    code = ((x / 2.0d0) + (y * x)) + z
end function
public static double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
def code(x, y, z):
	return ((x / 2.0) + (y * x)) + z
function code(x, y, z)
	return Float64(Float64(Float64(x / 2.0) + Float64(y * x)) + z)
end
function tmp = code(x, y, z)
	tmp = ((x / 2.0) + (y * x)) + z;
end
code[x_, y_, z_] := N[(N[(N[(x / 2), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
\left(\frac{x}{2} + y \cdot x\right) + z

Alternative 1: 100.0% accurate, 1.4× speedup?

\[\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x \]
(FPCore (x y z)
  :precision binary64
  (- (+ z (* y x)) (* -1/2 x)))
double code(double x, double y, double z) {
	return (z + (y * x)) - (-0.5 * x);
}
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 = (z + (y * x)) - ((-0.5d0) * x)
end function
public static double code(double x, double y, double z) {
	return (z + (y * x)) - (-0.5 * x);
}
def code(x, y, z):
	return (z + (y * x)) - (-0.5 * x)
function code(x, y, z)
	return Float64(Float64(z + Float64(y * x)) - Float64(-0.5 * x))
end
function tmp = code(x, y, z)
	tmp = (z + (y * x)) - (-0.5 * x);
end
code[x_, y_, z_] := N[(N[(z + N[(y * x), $MachinePrecision]), $MachinePrecision] - N[(-1/2 * x), $MachinePrecision]), $MachinePrecision]
\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x
Derivation
  1. Initial program 100.0%

    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
    2. +-commutativeN/A

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

      \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
    4. +-commutativeN/A

      \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
    5. associate-+r+N/A

      \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
    6. +-commutativeN/A

      \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
    7. lift-/.f64N/A

      \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
    8. mult-flipN/A

      \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
    9. fp-cancel-sign-sub-invN/A

      \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
    10. lower--.f64N/A

      \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
    11. +-commutativeN/A

      \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
    12. lower-+.f64N/A

      \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
    13. mult-flip-revN/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
    14. distribute-neg-fracN/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
    15. distribute-neg-frac2N/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
    16. mult-flipN/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
    17. *-commutativeN/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
    18. lower-*.f64N/A

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
    19. metadata-evalN/A

      \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
    20. metadata-eval100.0%

      \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
  3. Applied rewrites100.0%

    \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
  4. Add Preprocessing

Alternative 2: 100.0% accurate, 1.9× speedup?

\[z - \left(\frac{-1}{2} - y\right) \cdot x \]
(FPCore (x y z)
  :precision binary64
  (- z (* (- -1/2 y) x)))
double code(double x, double y, double z) {
	return z - ((-0.5 - y) * x);
}
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 = z - (((-0.5d0) - y) * x)
end function
public static double code(double x, double y, double z) {
	return z - ((-0.5 - y) * x);
}
def code(x, y, z):
	return z - ((-0.5 - y) * x)
function code(x, y, z)
	return Float64(z - Float64(Float64(-0.5 - y) * x))
end
function tmp = code(x, y, z)
	tmp = z - ((-0.5 - y) * x);
end
code[x_, y_, z_] := N[(z - N[(N[(-1/2 - y), $MachinePrecision] * x), $MachinePrecision]), $MachinePrecision]
z - \left(\frac{-1}{2} - y\right) \cdot x
Derivation
  1. Initial program 100.0%

    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
  2. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
    2. +-commutativeN/A

      \[\leadsto \color{blue}{z + \left(\frac{x}{2} + y \cdot x\right)} \]
    3. add-flipN/A

      \[\leadsto \color{blue}{z - \left(\mathsf{neg}\left(\left(\frac{x}{2} + y \cdot x\right)\right)\right)} \]
    4. lower--.f64N/A

      \[\leadsto \color{blue}{z - \left(\mathsf{neg}\left(\left(\frac{x}{2} + y \cdot x\right)\right)\right)} \]
    5. lift-+.f64N/A

      \[\leadsto z - \left(\mathsf{neg}\left(\color{blue}{\left(\frac{x}{2} + y \cdot x\right)}\right)\right) \]
    6. lift-*.f64N/A

      \[\leadsto z - \left(\mathsf{neg}\left(\left(\frac{x}{2} + \color{blue}{y \cdot x}\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto z - \left(\mathsf{neg}\left(\left(\frac{x}{2} + \color{blue}{x \cdot y}\right)\right)\right) \]
    8. fp-cancel-sign-sub-invN/A

      \[\leadsto z - \left(\mathsf{neg}\left(\color{blue}{\left(\frac{x}{2} - \left(\mathsf{neg}\left(x\right)\right) \cdot y\right)}\right)\right) \]
    9. lift-/.f64N/A

      \[\leadsto z - \left(\mathsf{neg}\left(\left(\color{blue}{\frac{x}{2}} - \left(\mathsf{neg}\left(x\right)\right) \cdot y\right)\right)\right) \]
    10. frac-2negN/A

      \[\leadsto z - \left(\mathsf{neg}\left(\left(\color{blue}{\frac{\mathsf{neg}\left(x\right)}{\mathsf{neg}\left(2\right)}} - \left(\mathsf{neg}\left(x\right)\right) \cdot y\right)\right)\right) \]
    11. mult-flipN/A

      \[\leadsto z - \left(\mathsf{neg}\left(\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{\mathsf{neg}\left(2\right)}} - \left(\mathsf{neg}\left(x\right)\right) \cdot y\right)\right)\right) \]
    12. distribute-lft-out--N/A

      \[\leadsto z - \left(\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(x\right)\right) \cdot \left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right)}\right)\right) \]
    13. distribute-lft-neg-outN/A

      \[\leadsto z - \color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x\right)\right)\right)\right) \cdot \left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right)} \]
    14. remove-double-negN/A

      \[\leadsto z - \color{blue}{x} \cdot \left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right) \]
    15. *-commutativeN/A

      \[\leadsto z - \color{blue}{\left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right) \cdot x} \]
    16. lower-*.f64N/A

      \[\leadsto z - \color{blue}{\left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right) \cdot x} \]
    17. lower--.f64N/A

      \[\leadsto z - \color{blue}{\left(\frac{1}{\mathsf{neg}\left(2\right)} - y\right)} \cdot x \]
    18. metadata-evalN/A

      \[\leadsto z - \left(\frac{1}{\color{blue}{-2}} - y\right) \cdot x \]
    19. metadata-eval100.0%

      \[\leadsto z - \left(\color{blue}{\frac{-1}{2}} - y\right) \cdot x \]
  3. Applied rewrites100.0%

    \[\leadsto \color{blue}{z - \left(\frac{-1}{2} - y\right) \cdot x} \]
  4. Add Preprocessing

Alternative 3: 84.6% accurate, 0.4× speedup?

\[\begin{array}{l} t_0 := \frac{x}{2} + y \cdot x\\ t_1 := x \cdot \left(\frac{1}{2} + y\right)\\ \mathbf{if}\;t\_0 \leq -49999999999999997640261112569083403345625645676430849265210811744256:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 10000000000000000000000:\\ \;\;\;\;z + \frac{1}{2} \cdot x\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (let* ((t_0 (+ (/ x 2) (* y x))) (t_1 (* x (+ 1/2 y))))
  (if (<=
       t_0
       -49999999999999997640261112569083403345625645676430849265210811744256)
    t_1
    (if (<= t_0 10000000000000000000000) (+ z (* 1/2 x)) t_1))))
double code(double x, double y, double z) {
	double t_0 = (x / 2.0) + (y * x);
	double t_1 = x * (0.5 + y);
	double tmp;
	if (t_0 <= -5e+67) {
		tmp = t_1;
	} else if (t_0 <= 1e+22) {
		tmp = z + (0.5 * x);
	} else {
		tmp = t_1;
	}
	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) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = (x / 2.0d0) + (y * x)
    t_1 = x * (0.5d0 + y)
    if (t_0 <= (-5d+67)) then
        tmp = t_1
    else if (t_0 <= 1d+22) then
        tmp = z + (0.5d0 * x)
    else
        tmp = t_1
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double t_0 = (x / 2.0) + (y * x);
	double t_1 = x * (0.5 + y);
	double tmp;
	if (t_0 <= -5e+67) {
		tmp = t_1;
	} else if (t_0 <= 1e+22) {
		tmp = z + (0.5 * x);
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(x, y, z):
	t_0 = (x / 2.0) + (y * x)
	t_1 = x * (0.5 + y)
	tmp = 0
	if t_0 <= -5e+67:
		tmp = t_1
	elif t_0 <= 1e+22:
		tmp = z + (0.5 * x)
	else:
		tmp = t_1
	return tmp
function code(x, y, z)
	t_0 = Float64(Float64(x / 2.0) + Float64(y * x))
	t_1 = Float64(x * Float64(0.5 + y))
	tmp = 0.0
	if (t_0 <= -5e+67)
		tmp = t_1;
	elseif (t_0 <= 1e+22)
		tmp = Float64(z + Float64(0.5 * x));
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	t_0 = (x / 2.0) + (y * x);
	t_1 = x * (0.5 + y);
	tmp = 0.0;
	if (t_0 <= -5e+67)
		tmp = t_1;
	elseif (t_0 <= 1e+22)
		tmp = z + (0.5 * x);
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / 2), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(1/2 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -49999999999999997640261112569083403345625645676430849265210811744256], t$95$1, If[LessEqual[t$95$0, 10000000000000000000000], N[(z + N[(1/2 * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
t_0 := \frac{x}{2} + y \cdot x\\
t_1 := x \cdot \left(\frac{1}{2} + y\right)\\
\mathbf{if}\;t\_0 \leq -49999999999999997640261112569083403345625645676430849265210811744256:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 10000000000000000000000:\\
\;\;\;\;z + \frac{1}{2} \cdot x\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < -4.9999999999999998e67 or 1e22 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x))

    1. Initial program 100.0%

      \[\left(\frac{x}{2} + y \cdot x\right) + z \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
      4. +-commutativeN/A

        \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
      5. associate-+r+N/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
      7. lift-/.f64N/A

        \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
      8. mult-flipN/A

        \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
      9. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
      10. lower--.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
      11. +-commutativeN/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
      12. lower-+.f64N/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
      13. mult-flip-revN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
      14. distribute-neg-fracN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
      15. distribute-neg-frac2N/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
      16. mult-flipN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
      17. *-commutativeN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
      18. lower-*.f64N/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
      19. metadata-evalN/A

        \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
      20. metadata-eval100.0%

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
    3. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
      2. lower-+.f6461.2%

        \[\leadsto x \cdot \left(\frac{1}{2} + \color{blue}{y}\right) \]
    6. Applied rewrites61.2%

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]

    if -4.9999999999999998e67 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 1e22

    1. Initial program 100.0%

      \[\left(\frac{x}{2} + y \cdot x\right) + z \]
    2. Taylor expanded in y around 0

      \[\leadsto \color{blue}{z + \frac{1}{2} \cdot x} \]
    3. Step-by-step derivation
      1. lower-+.f64N/A

        \[\leadsto z + \color{blue}{\frac{1}{2} \cdot x} \]
      2. lower-*.f6464.9%

        \[\leadsto z + \frac{1}{2} \cdot \color{blue}{x} \]
    4. Applied rewrites64.9%

      \[\leadsto \color{blue}{z + \frac{1}{2} \cdot x} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 84.3% accurate, 1.1× speedup?

\[\begin{array}{l} \mathbf{if}\;y \leq -16000000000000001252664646473539901476885764798177869824:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 6800000000000000100663296:\\ \;\;\;\;z + \frac{1}{2} \cdot x\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
(FPCore (x y z)
  :precision binary64
  (if (<= y -16000000000000001252664646473539901476885764798177869824)
  (* x y)
  (if (<= y 6800000000000000100663296) (+ z (* 1/2 x)) (* x y))))
double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.6e+55) {
		tmp = x * y;
	} else if (y <= 6.8e+24) {
		tmp = z + (0.5 * x);
	} else {
		tmp = x * y;
	}
	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 (y <= (-1.6d+55)) then
        tmp = x * y
    else if (y <= 6.8d+24) then
        tmp = z + (0.5d0 * x)
    else
        tmp = x * y
    end if
    code = tmp
end function
public static double code(double x, double y, double z) {
	double tmp;
	if (y <= -1.6e+55) {
		tmp = x * y;
	} else if (y <= 6.8e+24) {
		tmp = z + (0.5 * x);
	} else {
		tmp = x * y;
	}
	return tmp;
}
def code(x, y, z):
	tmp = 0
	if y <= -1.6e+55:
		tmp = x * y
	elif y <= 6.8e+24:
		tmp = z + (0.5 * x)
	else:
		tmp = x * y
	return tmp
function code(x, y, z)
	tmp = 0.0
	if (y <= -1.6e+55)
		tmp = Float64(x * y);
	elseif (y <= 6.8e+24)
		tmp = Float64(z + Float64(0.5 * x));
	else
		tmp = Float64(x * y);
	end
	return tmp
end
function tmp_2 = code(x, y, z)
	tmp = 0.0;
	if (y <= -1.6e+55)
		tmp = x * y;
	elseif (y <= 6.8e+24)
		tmp = z + (0.5 * x);
	else
		tmp = x * y;
	end
	tmp_2 = tmp;
end
code[x_, y_, z_] := If[LessEqual[y, -16000000000000001252664646473539901476885764798177869824], N[(x * y), $MachinePrecision], If[LessEqual[y, 6800000000000000100663296], N[(z + N[(1/2 * x), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\mathbf{if}\;y \leq -16000000000000001252664646473539901476885764798177869824:\\
\;\;\;\;x \cdot y\\

\mathbf{elif}\;y \leq 6800000000000000100663296:\\
\;\;\;\;z + \frac{1}{2} \cdot x\\

\mathbf{else}:\\
\;\;\;\;x \cdot y\\


\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y < -1.6000000000000001e55 or 6.8000000000000001e24 < y

    1. Initial program 100.0%

      \[\left(\frac{x}{2} + y \cdot x\right) + z \]
    2. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
      2. +-commutativeN/A

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

        \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
      4. +-commutativeN/A

        \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
      5. associate-+r+N/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
      6. +-commutativeN/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
      7. lift-/.f64N/A

        \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
      8. mult-flipN/A

        \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
      9. fp-cancel-sign-sub-invN/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
      10. lower--.f64N/A

        \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
      11. +-commutativeN/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
      12. lower-+.f64N/A

        \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
      13. mult-flip-revN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
      14. distribute-neg-fracN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
      15. distribute-neg-frac2N/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
      16. mult-flipN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
      17. *-commutativeN/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
      18. lower-*.f64N/A

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
      19. metadata-evalN/A

        \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
      20. metadata-eval100.0%

        \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
    3. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
    4. Taylor expanded in x around inf

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
    5. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto x \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
      2. lower-+.f6461.2%

        \[\leadsto x \cdot \left(\frac{1}{2} + \color{blue}{y}\right) \]
    6. Applied rewrites61.2%

      \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
    7. Taylor expanded in y around 0

      \[\leadsto x \cdot \frac{1}{2} \]
    8. Step-by-step derivation
      1. Applied rewrites26.8%

        \[\leadsto x \cdot \frac{1}{2} \]
      2. Taylor expanded in y around inf

        \[\leadsto x \cdot y \]
      3. Step-by-step derivation
        1. Applied rewrites36.6%

          \[\leadsto x \cdot y \]

        if -1.6000000000000001e55 < y < 6.8000000000000001e24

        1. Initial program 100.0%

          \[\left(\frac{x}{2} + y \cdot x\right) + z \]
        2. Taylor expanded in y around 0

          \[\leadsto \color{blue}{z + \frac{1}{2} \cdot x} \]
        3. Step-by-step derivation
          1. lower-+.f64N/A

            \[\leadsto z + \color{blue}{\frac{1}{2} \cdot x} \]
          2. lower-*.f6464.9%

            \[\leadsto z + \frac{1}{2} \cdot \color{blue}{x} \]
        4. Applied rewrites64.9%

          \[\leadsto \color{blue}{z + \frac{1}{2} \cdot x} \]
      4. Recombined 2 regimes into one program.
      5. Add Preprocessing

      Alternative 5: 59.8% accurate, 0.3× speedup?

      \[\begin{array}{l} t_0 := \frac{x}{2} + y \cdot x\\ \mathbf{if}\;t\_0 \leq -49999999999999997640261112569083403345625645676430849265210811744256:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;t\_0 \leq 199999999999999995497619646912068059136:\\ \;\;\;\;z\\ \mathbf{elif}\;t\_0 \leq 5000000000000000262523801276022101243522342905540795774579270577559012289944540978931856875402239320218522219164419390884712616176802152878223960923933534914241936004632879018689151168973940450296844766174853999725405595194838204400373263713900712472896293944100284214190578347360981934327297002700800:\\ \;\;\;\;x \cdot \frac{1}{2}\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
      (FPCore (x y z)
        :precision binary64
        (let* ((t_0 (+ (/ x 2) (* y x))))
        (if (<=
             t_0
             -49999999999999997640261112569083403345625645676430849265210811744256)
          (* x y)
          (if (<= t_0 199999999999999995497619646912068059136)
            z
            (if (<=
                 t_0
                 5000000000000000262523801276022101243522342905540795774579270577559012289944540978931856875402239320218522219164419390884712616176802152878223960923933534914241936004632879018689151168973940450296844766174853999725405595194838204400373263713900712472896293944100284214190578347360981934327297002700800)
              (* x 1/2)
              (* x y))))))
      double code(double x, double y, double z) {
      	double t_0 = (x / 2.0) + (y * x);
      	double tmp;
      	if (t_0 <= -5e+67) {
      		tmp = x * y;
      	} else if (t_0 <= 2e+38) {
      		tmp = z;
      	} else if (t_0 <= 5e+300) {
      		tmp = x * 0.5;
      	} else {
      		tmp = x * y;
      	}
      	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) :: t_0
          real(8) :: tmp
          t_0 = (x / 2.0d0) + (y * x)
          if (t_0 <= (-5d+67)) then
              tmp = x * y
          else if (t_0 <= 2d+38) then
              tmp = z
          else if (t_0 <= 5d+300) then
              tmp = x * 0.5d0
          else
              tmp = x * y
          end if
          code = tmp
      end function
      
      public static double code(double x, double y, double z) {
      	double t_0 = (x / 2.0) + (y * x);
      	double tmp;
      	if (t_0 <= -5e+67) {
      		tmp = x * y;
      	} else if (t_0 <= 2e+38) {
      		tmp = z;
      	} else if (t_0 <= 5e+300) {
      		tmp = x * 0.5;
      	} else {
      		tmp = x * y;
      	}
      	return tmp;
      }
      
      def code(x, y, z):
      	t_0 = (x / 2.0) + (y * x)
      	tmp = 0
      	if t_0 <= -5e+67:
      		tmp = x * y
      	elif t_0 <= 2e+38:
      		tmp = z
      	elif t_0 <= 5e+300:
      		tmp = x * 0.5
      	else:
      		tmp = x * y
      	return tmp
      
      function code(x, y, z)
      	t_0 = Float64(Float64(x / 2.0) + Float64(y * x))
      	tmp = 0.0
      	if (t_0 <= -5e+67)
      		tmp = Float64(x * y);
      	elseif (t_0 <= 2e+38)
      		tmp = z;
      	elseif (t_0 <= 5e+300)
      		tmp = Float64(x * 0.5);
      	else
      		tmp = Float64(x * y);
      	end
      	return tmp
      end
      
      function tmp_2 = code(x, y, z)
      	t_0 = (x / 2.0) + (y * x);
      	tmp = 0.0;
      	if (t_0 <= -5e+67)
      		tmp = x * y;
      	elseif (t_0 <= 2e+38)
      		tmp = z;
      	elseif (t_0 <= 5e+300)
      		tmp = x * 0.5;
      	else
      		tmp = x * y;
      	end
      	tmp_2 = tmp;
      end
      
      code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / 2), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -49999999999999997640261112569083403345625645676430849265210811744256], N[(x * y), $MachinePrecision], If[LessEqual[t$95$0, 199999999999999995497619646912068059136], z, If[LessEqual[t$95$0, 5000000000000000262523801276022101243522342905540795774579270577559012289944540978931856875402239320218522219164419390884712616176802152878223960923933534914241936004632879018689151168973940450296844766174853999725405595194838204400373263713900712472896293944100284214190578347360981934327297002700800], N[(x * 1/2), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]
      
      \begin{array}{l}
      t_0 := \frac{x}{2} + y \cdot x\\
      \mathbf{if}\;t\_0 \leq -49999999999999997640261112569083403345625645676430849265210811744256:\\
      \;\;\;\;x \cdot y\\
      
      \mathbf{elif}\;t\_0 \leq 199999999999999995497619646912068059136:\\
      \;\;\;\;z\\
      
      \mathbf{elif}\;t\_0 \leq 5000000000000000262523801276022101243522342905540795774579270577559012289944540978931856875402239320218522219164419390884712616176802152878223960923933534914241936004632879018689151168973940450296844766174853999725405595194838204400373263713900712472896293944100284214190578347360981934327297002700800:\\
      \;\;\;\;x \cdot \frac{1}{2}\\
      
      \mathbf{else}:\\
      \;\;\;\;x \cdot y\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < -4.9999999999999998e67 or 5.0000000000000003e300 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x))

        1. Initial program 100.0%

          \[\left(\frac{x}{2} + y \cdot x\right) + z \]
        2. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
          2. +-commutativeN/A

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

            \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
          4. +-commutativeN/A

            \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
          5. associate-+r+N/A

            \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
          6. +-commutativeN/A

            \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
          7. lift-/.f64N/A

            \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
          8. mult-flipN/A

            \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
          9. fp-cancel-sign-sub-invN/A

            \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
          10. lower--.f64N/A

            \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
          11. +-commutativeN/A

            \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
          12. lower-+.f64N/A

            \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
          13. mult-flip-revN/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
          14. distribute-neg-fracN/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
          15. distribute-neg-frac2N/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
          16. mult-flipN/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
          17. *-commutativeN/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
          18. lower-*.f64N/A

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
          19. metadata-evalN/A

            \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
          20. metadata-eval100.0%

            \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
        3. Applied rewrites100.0%

          \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
        4. Taylor expanded in x around inf

          \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
        5. Step-by-step derivation
          1. lower-*.f64N/A

            \[\leadsto x \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
          2. lower-+.f6461.2%

            \[\leadsto x \cdot \left(\frac{1}{2} + \color{blue}{y}\right) \]
        6. Applied rewrites61.2%

          \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
        7. Taylor expanded in y around 0

          \[\leadsto x \cdot \frac{1}{2} \]
        8. Step-by-step derivation
          1. Applied rewrites26.8%

            \[\leadsto x \cdot \frac{1}{2} \]
          2. Taylor expanded in y around inf

            \[\leadsto x \cdot y \]
          3. Step-by-step derivation
            1. Applied rewrites36.6%

              \[\leadsto x \cdot y \]

            if -4.9999999999999998e67 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 2e38

            1. Initial program 100.0%

              \[\left(\frac{x}{2} + y \cdot x\right) + z \]
            2. Taylor expanded in x around 0

              \[\leadsto \color{blue}{z} \]
            3. Step-by-step derivation
              1. Applied rewrites40.2%

                \[\leadsto \color{blue}{z} \]

              if 2e38 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 5.0000000000000003e300

              1. Initial program 100.0%

                \[\left(\frac{x}{2} + y \cdot x\right) + z \]
              2. Step-by-step derivation
                1. lift-+.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
                2. +-commutativeN/A

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

                  \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
                4. +-commutativeN/A

                  \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
                5. associate-+r+N/A

                  \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
                6. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
                7. lift-/.f64N/A

                  \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
                8. mult-flipN/A

                  \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
                9. fp-cancel-sign-sub-invN/A

                  \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
                10. lower--.f64N/A

                  \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
                11. +-commutativeN/A

                  \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
                12. lower-+.f64N/A

                  \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
                13. mult-flip-revN/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
                14. distribute-neg-fracN/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
                15. distribute-neg-frac2N/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
                16. mult-flipN/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
                17. *-commutativeN/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
                18. lower-*.f64N/A

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
                19. metadata-evalN/A

                  \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
                20. metadata-eval100.0%

                  \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
              3. Applied rewrites100.0%

                \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
              4. Taylor expanded in x around inf

                \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
              5. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto x \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
                2. lower-+.f6461.2%

                  \[\leadsto x \cdot \left(\frac{1}{2} + \color{blue}{y}\right) \]
              6. Applied rewrites61.2%

                \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
              7. Taylor expanded in y around 0

                \[\leadsto x \cdot \frac{1}{2} \]
              8. Step-by-step derivation
                1. Applied rewrites26.8%

                  \[\leadsto x \cdot \frac{1}{2} \]
              9. Recombined 3 regimes into one program.
              10. Add Preprocessing

              Alternative 6: 50.4% accurate, 1.3× speedup?

              \[\begin{array}{l} \mathbf{if}\;x \leq -339999999999999990744261413686282949153855044567478797263246375049027131228789615831797219808308176004137591354633276357074691968990303803880243200:\\ \;\;\;\;x \cdot \frac{1}{2}\\ \mathbf{elif}\;x \leq 16000000000000000718171402849214668568788992:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x \cdot \frac{1}{2}\\ \end{array} \]
              (FPCore (x y z)
                :precision binary64
                (if (<=
                   x
                   -339999999999999990744261413686282949153855044567478797263246375049027131228789615831797219808308176004137591354633276357074691968990303803880243200)
                (* x 1/2)
                (if (<= x 16000000000000000718171402849214668568788992)
                  z
                  (* x 1/2))))
              double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -3.4e+146) {
              		tmp = x * 0.5;
              	} else if (x <= 1.6e+43) {
              		tmp = z;
              	} else {
              		tmp = x * 0.5;
              	}
              	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.4d+146)) then
                      tmp = x * 0.5d0
                  else if (x <= 1.6d+43) then
                      tmp = z
                  else
                      tmp = x * 0.5d0
                  end if
                  code = tmp
              end function
              
              public static double code(double x, double y, double z) {
              	double tmp;
              	if (x <= -3.4e+146) {
              		tmp = x * 0.5;
              	} else if (x <= 1.6e+43) {
              		tmp = z;
              	} else {
              		tmp = x * 0.5;
              	}
              	return tmp;
              }
              
              def code(x, y, z):
              	tmp = 0
              	if x <= -3.4e+146:
              		tmp = x * 0.5
              	elif x <= 1.6e+43:
              		tmp = z
              	else:
              		tmp = x * 0.5
              	return tmp
              
              function code(x, y, z)
              	tmp = 0.0
              	if (x <= -3.4e+146)
              		tmp = Float64(x * 0.5);
              	elseif (x <= 1.6e+43)
              		tmp = z;
              	else
              		tmp = Float64(x * 0.5);
              	end
              	return tmp
              end
              
              function tmp_2 = code(x, y, z)
              	tmp = 0.0;
              	if (x <= -3.4e+146)
              		tmp = x * 0.5;
              	elseif (x <= 1.6e+43)
              		tmp = z;
              	else
              		tmp = x * 0.5;
              	end
              	tmp_2 = tmp;
              end
              
              code[x_, y_, z_] := If[LessEqual[x, -339999999999999990744261413686282949153855044567478797263246375049027131228789615831797219808308176004137591354633276357074691968990303803880243200], N[(x * 1/2), $MachinePrecision], If[LessEqual[x, 16000000000000000718171402849214668568788992], z, N[(x * 1/2), $MachinePrecision]]]
              
              \begin{array}{l}
              \mathbf{if}\;x \leq -339999999999999990744261413686282949153855044567478797263246375049027131228789615831797219808308176004137591354633276357074691968990303803880243200:\\
              \;\;\;\;x \cdot \frac{1}{2}\\
              
              \mathbf{elif}\;x \leq 16000000000000000718171402849214668568788992:\\
              \;\;\;\;z\\
              
              \mathbf{else}:\\
              \;\;\;\;x \cdot \frac{1}{2}\\
              
              
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if x < -3.3999999999999999e146 or 1.6000000000000001e43 < x

                1. Initial program 100.0%

                  \[\left(\frac{x}{2} + y \cdot x\right) + z \]
                2. Step-by-step derivation
                  1. lift-+.f64N/A

                    \[\leadsto \color{blue}{\left(\frac{x}{2} + y \cdot x\right) + z} \]
                  2. +-commutativeN/A

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

                    \[\leadsto z + \color{blue}{\left(\frac{x}{2} + y \cdot x\right)} \]
                  4. +-commutativeN/A

                    \[\leadsto z + \color{blue}{\left(y \cdot x + \frac{x}{2}\right)} \]
                  5. associate-+r+N/A

                    \[\leadsto \color{blue}{\left(z + y \cdot x\right) + \frac{x}{2}} \]
                  6. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(y \cdot x + z\right)} + \frac{x}{2} \]
                  7. lift-/.f64N/A

                    \[\leadsto \left(y \cdot x + z\right) + \color{blue}{\frac{x}{2}} \]
                  8. mult-flipN/A

                    \[\leadsto \left(y \cdot x + z\right) + \color{blue}{x \cdot \frac{1}{2}} \]
                  9. fp-cancel-sign-sub-invN/A

                    \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
                  10. lower--.f64N/A

                    \[\leadsto \color{blue}{\left(y \cdot x + z\right) - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2}} \]
                  11. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
                  12. lower-+.f64N/A

                    \[\leadsto \color{blue}{\left(z + y \cdot x\right)} - \left(\mathsf{neg}\left(x\right)\right) \cdot \frac{1}{2} \]
                  13. mult-flip-revN/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{\mathsf{neg}\left(x\right)}{2}} \]
                  14. distribute-neg-fracN/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{x}{2}\right)\right)} \]
                  15. distribute-neg-frac2N/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{x}{\mathsf{neg}\left(2\right)}} \]
                  16. mult-flipN/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{x \cdot \frac{1}{\mathsf{neg}\left(2\right)}} \]
                  17. *-commutativeN/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
                  18. lower-*.f64N/A

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{1}{\mathsf{neg}\left(2\right)} \cdot x} \]
                  19. metadata-evalN/A

                    \[\leadsto \left(z + y \cdot x\right) - \frac{1}{\color{blue}{-2}} \cdot x \]
                  20. metadata-eval100.0%

                    \[\leadsto \left(z + y \cdot x\right) - \color{blue}{\frac{-1}{2}} \cdot x \]
                3. Applied rewrites100.0%

                  \[\leadsto \color{blue}{\left(z + y \cdot x\right) - \frac{-1}{2} \cdot x} \]
                4. Taylor expanded in x around inf

                  \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
                5. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto x \cdot \color{blue}{\left(\frac{1}{2} + y\right)} \]
                  2. lower-+.f6461.2%

                    \[\leadsto x \cdot \left(\frac{1}{2} + \color{blue}{y}\right) \]
                6. Applied rewrites61.2%

                  \[\leadsto \color{blue}{x \cdot \left(\frac{1}{2} + y\right)} \]
                7. Taylor expanded in y around 0

                  \[\leadsto x \cdot \frac{1}{2} \]
                8. Step-by-step derivation
                  1. Applied rewrites26.8%

                    \[\leadsto x \cdot \frac{1}{2} \]

                  if -3.3999999999999999e146 < x < 1.6000000000000001e43

                  1. Initial program 100.0%

                    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{z} \]
                  3. Step-by-step derivation
                    1. Applied rewrites40.2%

                      \[\leadsto \color{blue}{z} \]
                  4. Recombined 2 regimes into one program.
                  5. Add Preprocessing

                  Alternative 7: 40.2% accurate, 23.0× speedup?

                  \[z \]
                  (FPCore (x y z)
                    :precision binary64
                    z)
                  double code(double x, double y, double z) {
                  	return z;
                  }
                  
                  module fmin_fmax_functions
                      implicit none
                      private
                      public fmax
                      public fmin
                  
                      interface fmax
                          module procedure fmax88
                          module procedure fmax44
                          module procedure fmax84
                          module procedure fmax48
                      end interface
                      interface fmin
                          module procedure fmin88
                          module procedure fmin44
                          module procedure fmin84
                          module procedure fmin48
                      end interface
                  contains
                      real(8) function fmax88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmax44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmax84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmax48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                      end function
                      real(8) function fmin88(x, y) result (res)
                          real(8), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(4) function fmin44(x, y) result (res)
                          real(4), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                      end function
                      real(8) function fmin84(x, y) result(res)
                          real(8), intent (in) :: x
                          real(4), intent (in) :: y
                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                      end function
                      real(8) function fmin48(x, y) result(res)
                          real(4), intent (in) :: x
                          real(8), intent (in) :: y
                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                      end function
                  end module
                  
                  real(8) function code(x, y, z)
                  use fmin_fmax_functions
                      real(8), intent (in) :: x
                      real(8), intent (in) :: y
                      real(8), intent (in) :: z
                      code = z
                  end function
                  
                  public static double code(double x, double y, double z) {
                  	return z;
                  }
                  
                  def code(x, y, z):
                  	return z
                  
                  function code(x, y, z)
                  	return z
                  end
                  
                  function tmp = code(x, y, z)
                  	tmp = z;
                  end
                  
                  code[x_, y_, z_] := z
                  
                  z
                  
                  Derivation
                  1. Initial program 100.0%

                    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
                  2. Taylor expanded in x around 0

                    \[\leadsto \color{blue}{z} \]
                  3. Step-by-step derivation
                    1. Applied rewrites40.2%

                      \[\leadsto \color{blue}{z} \]
                    2. Add Preprocessing

                    Reproduce

                    ?
                    herbie shell --seed 2025271 -o generate:evaluate
                    (FPCore (x y z)
                      :name "Data.Histogram.Bin.BinF:$cfromIndex from histogram-fill-0.8.4.1"
                      :precision binary64
                      (+ (+ (/ x 2) (* y x)) z))