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

Percentage Accurate: 100.0% → 100.0%
Time: 1.4s
Alternatives: 6
Speedup: 1.5×

Specification

?
\[\left(\frac{x}{2} + y \cdot x\right) + z \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
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.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	((x / (2)) + (y * x)) + z
END code
\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 6 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\left(\frac{x}{2} + y \cdot x\right) + z \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (+ (+ (/ x 2.0) (* y x)) z))
double code(double x, double y, double z) {
	return ((x / 2.0) + (y * x)) + z;
}
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.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	((x / (2)) + (y * x)) + z
END code
\left(\frac{x}{2} + y \cdot x\right) + z

Alternative 1: 100.0% accurate, 1.5× speedup?

\[\mathsf{fma}\left(x, y - -0.5, z\right) \]
(FPCore (x y z)
  :precision binary64
  :pre TRUE
  (fma x (- y -0.5) z))
double code(double x, double y, double z) {
	return fma(x, (y - -0.5), z);
}
function code(x, y, z)
	return fma(x, Float64(y - -0.5), z)
end
code[x_, y_, z_] := N[(x * N[(y - -0.5), $MachinePrecision] + z), $MachinePrecision]
f(x, y, z):
	x in [-inf, +inf],
	y in [-inf, +inf],
	z in [-inf, +inf]
code: THEORY
BEGIN
f(x, y, z: real): real =
	(x * (y - (-5e-1))) + z
END code
\mathsf{fma}\left(x, y - -0.5, z\right)
Derivation
  1. Initial program 100.0%

    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
  2. Step-by-step derivation
    1. Applied rewrites100.0%

      \[\leadsto \mathsf{fma}\left(x, y - -0.5, z\right) \]
    2. Add Preprocessing

    Alternative 2: 84.9% accurate, 0.4× speedup?

    \[\begin{array}{l} t_0 := \frac{x}{2} + y \cdot x\\ t_1 := x \cdot \left(0.5 + y\right)\\ \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+119}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+23}:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5, z\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \]
    (FPCore (x y z)
      :precision binary64
      :pre TRUE
      (let* ((t_0 (+ (/ x 2.0) (* y x))) (t_1 (* x (+ 0.5 y))))
      (if (<= t_0 -4e+119) t_1 (if (<= t_0 2e+23) (fma x 0.5 z) 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 <= -4e+119) {
    		tmp = t_1;
    	} else if (t_0 <= 2e+23) {
    		tmp = fma(x, 0.5, z);
    	} 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 <= -4e+119)
    		tmp = t_1;
    	elseif (t_0 <= 2e+23)
    		tmp = fma(x, 0.5, z);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[x_, y_, z_] := Block[{t$95$0 = N[(N[(x / 2.0), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x * N[(0.5 + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e+119], t$95$1, If[LessEqual[t$95$0, 2e+23], N[(x * 0.5 + z), $MachinePrecision], t$95$1]]]]
    
    f(x, y, z):
    	x in [-inf, +inf],
    	y in [-inf, +inf],
    	z in [-inf, +inf]
    code: THEORY
    BEGIN
    f(x, y, z: real): real =
    	LET t_0 = ((x / (2)) + (y * x)) IN
    		LET t_1 = (x * ((5e-1) + y)) IN
    			LET tmp_1 = IF (t_0 <= (199999999999999983222784)) THEN ((x * (5e-1)) + z) ELSE t_1 ENDIF IN
    			LET tmp = IF (t_0 <= (-399999999999999977667020989019733525099891481520760027296928142430551942491041244017647798418966925464294473134145273856)) THEN t_1 ELSE tmp_1 ENDIF IN
    	tmp
    END code
    \begin{array}{l}
    t_0 := \frac{x}{2} + y \cdot x\\
    t_1 := x \cdot \left(0.5 + y\right)\\
    \mathbf{if}\;t\_0 \leq -4 \cdot 10^{+119}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{+23}:\\
    \;\;\;\;\mathsf{fma}\left(x, 0.5, z\right)\\
    
    \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)) < -3.9999999999999998e119 or 1.9999999999999998e23 < (+.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. Taylor expanded in x around 0

        \[\leadsto z \]
      3. Step-by-step derivation
        1. Applied rewrites40.9%

          \[\leadsto z \]
        2. Taylor expanded in x around inf

          \[\leadsto x \cdot \left(\frac{1}{2} + y\right) \]
        3. Step-by-step derivation
          1. Applied rewrites60.6%

            \[\leadsto x \cdot \left(0.5 + y\right) \]

          if -3.9999999999999998e119 < (+.f64 (/.f64 x #s(literal 2 binary64)) (*.f64 y x)) < 1.9999999999999998e23

          1. Initial program 100.0%

            \[\left(\frac{x}{2} + y \cdot x\right) + z \]
          2. Step-by-step derivation
            1. Applied rewrites100.0%

              \[\leadsto \mathsf{fma}\left(x, y - -0.5, z\right) \]
            2. Taylor expanded in y around 0

              \[\leadsto \mathsf{fma}\left(x, \frac{1}{2}, z\right) \]
            3. Step-by-step derivation
              1. Applied rewrites65.6%

                \[\leadsto \mathsf{fma}\left(x, 0.5, z\right) \]
            4. Recombined 2 regimes into one program.
            5. Add Preprocessing

            Alternative 3: 83.4% accurate, 1.0× speedup?

            \[\begin{array}{l} \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.4127853169820853 \cdot 10^{+29}:\\ \;\;\;\;\mathsf{fma}\left(x, 0.5, z\right)\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
            (FPCore (x y z)
              :precision binary64
              :pre TRUE
              (if (<= y -3.5300867311555345e+109)
              (* x y)
              (if (<= y 1.4127853169820853e+29) (fma x 0.5 z) (* x y))))
            double code(double x, double y, double z) {
            	double tmp;
            	if (y <= -3.5300867311555345e+109) {
            		tmp = x * y;
            	} else if (y <= 1.4127853169820853e+29) {
            		tmp = fma(x, 0.5, z);
            	} else {
            		tmp = x * y;
            	}
            	return tmp;
            }
            
            function code(x, y, z)
            	tmp = 0.0
            	if (y <= -3.5300867311555345e+109)
            		tmp = Float64(x * y);
            	elseif (y <= 1.4127853169820853e+29)
            		tmp = fma(x, 0.5, z);
            	else
            		tmp = Float64(x * y);
            	end
            	return tmp
            end
            
            code[x_, y_, z_] := If[LessEqual[y, -3.5300867311555345e+109], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.4127853169820853e+29], N[(x * 0.5 + z), $MachinePrecision], N[(x * y), $MachinePrecision]]]
            
            f(x, y, z):
            	x in [-inf, +inf],
            	y in [-inf, +inf],
            	z in [-inf, +inf]
            code: THEORY
            BEGIN
            f(x, y, z: real): real =
            	LET tmp_1 = IF (y <= (141278531698208534630351503360)) THEN ((x * (5e-1)) + z) ELSE (x * y) ENDIF IN
            	LET tmp = IF (y <= (-35300867311555344830665068023857833157161671139535389123793087910756862404967427090762155520113868502187638784)) THEN (x * y) ELSE tmp_1 ENDIF IN
            	tmp
            END code
            \begin{array}{l}
            \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\
            \;\;\;\;x \cdot y\\
            
            \mathbf{elif}\;y \leq 1.4127853169820853 \cdot 10^{+29}:\\
            \;\;\;\;\mathsf{fma}\left(x, 0.5, z\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;x \cdot y\\
            
            
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if y < -3.5300867311555345e109 or 1.4127853169820853e29 < y

              1. Initial program 100.0%

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

                \[\leadsto z \]
              3. Step-by-step derivation
                1. Applied rewrites40.9%

                  \[\leadsto z \]
                2. Taylor expanded in y around inf

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

                    \[\leadsto x \cdot y \]

                  if -3.5300867311555345e109 < y < 1.4127853169820853e29

                  1. Initial program 100.0%

                    \[\left(\frac{x}{2} + y \cdot x\right) + z \]
                  2. Step-by-step derivation
                    1. Applied rewrites100.0%

                      \[\leadsto \mathsf{fma}\left(x, y - -0.5, z\right) \]
                    2. Taylor expanded in y around 0

                      \[\leadsto \mathsf{fma}\left(x, \frac{1}{2}, z\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites65.6%

                        \[\leadsto \mathsf{fma}\left(x, 0.5, z\right) \]
                    4. Recombined 2 regimes into one program.
                    5. Add Preprocessing

                    Alternative 4: 59.2% accurate, 0.6× speedup?

                    \[\begin{array}{l} \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq -8.591462877770483 \cdot 10^{-122}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq -1.0131019801578072 \cdot 10^{-252}:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{elif}\;y \leq 5.854905830256108 \cdot 10^{-157}:\\ \;\;\;\;z\\ \mathbf{elif}\;y \leq 0.0036597640836557375:\\ \;\;\;\;x \cdot 0.5\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                    (FPCore (x y z)
                      :precision binary64
                      :pre TRUE
                      (if (<= y -3.5300867311555345e+109)
                      (* x y)
                      (if (<= y -8.591462877770483e-122)
                        z
                        (if (<= y -1.0131019801578072e-252)
                          (* x 0.5)
                          (if (<= y 5.854905830256108e-157)
                            z
                            (if (<= y 0.0036597640836557375) (* x 0.5) (* x y)))))))
                    double code(double x, double y, double z) {
                    	double tmp;
                    	if (y <= -3.5300867311555345e+109) {
                    		tmp = x * y;
                    	} else if (y <= -8.591462877770483e-122) {
                    		tmp = z;
                    	} else if (y <= -1.0131019801578072e-252) {
                    		tmp = x * 0.5;
                    	} else if (y <= 5.854905830256108e-157) {
                    		tmp = z;
                    	} else if (y <= 0.0036597640836557375) {
                    		tmp = x * 0.5;
                    	} else {
                    		tmp = x * y;
                    	}
                    	return tmp;
                    }
                    
                    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 <= (-3.5300867311555345d+109)) then
                            tmp = x * y
                        else if (y <= (-8.591462877770483d-122)) then
                            tmp = z
                        else if (y <= (-1.0131019801578072d-252)) then
                            tmp = x * 0.5d0
                        else if (y <= 5.854905830256108d-157) then
                            tmp = z
                        else if (y <= 0.0036597640836557375d0) 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 tmp;
                    	if (y <= -3.5300867311555345e+109) {
                    		tmp = x * y;
                    	} else if (y <= -8.591462877770483e-122) {
                    		tmp = z;
                    	} else if (y <= -1.0131019801578072e-252) {
                    		tmp = x * 0.5;
                    	} else if (y <= 5.854905830256108e-157) {
                    		tmp = z;
                    	} else if (y <= 0.0036597640836557375) {
                    		tmp = x * 0.5;
                    	} else {
                    		tmp = x * y;
                    	}
                    	return tmp;
                    }
                    
                    def code(x, y, z):
                    	tmp = 0
                    	if y <= -3.5300867311555345e+109:
                    		tmp = x * y
                    	elif y <= -8.591462877770483e-122:
                    		tmp = z
                    	elif y <= -1.0131019801578072e-252:
                    		tmp = x * 0.5
                    	elif y <= 5.854905830256108e-157:
                    		tmp = z
                    	elif y <= 0.0036597640836557375:
                    		tmp = x * 0.5
                    	else:
                    		tmp = x * y
                    	return tmp
                    
                    function code(x, y, z)
                    	tmp = 0.0
                    	if (y <= -3.5300867311555345e+109)
                    		tmp = Float64(x * y);
                    	elseif (y <= -8.591462877770483e-122)
                    		tmp = z;
                    	elseif (y <= -1.0131019801578072e-252)
                    		tmp = Float64(x * 0.5);
                    	elseif (y <= 5.854905830256108e-157)
                    		tmp = z;
                    	elseif (y <= 0.0036597640836557375)
                    		tmp = Float64(x * 0.5);
                    	else
                    		tmp = Float64(x * y);
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(x, y, z)
                    	tmp = 0.0;
                    	if (y <= -3.5300867311555345e+109)
                    		tmp = x * y;
                    	elseif (y <= -8.591462877770483e-122)
                    		tmp = z;
                    	elseif (y <= -1.0131019801578072e-252)
                    		tmp = x * 0.5;
                    	elseif (y <= 5.854905830256108e-157)
                    		tmp = z;
                    	elseif (y <= 0.0036597640836557375)
                    		tmp = x * 0.5;
                    	else
                    		tmp = x * y;
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[x_, y_, z_] := If[LessEqual[y, -3.5300867311555345e+109], N[(x * y), $MachinePrecision], If[LessEqual[y, -8.591462877770483e-122], z, If[LessEqual[y, -1.0131019801578072e-252], N[(x * 0.5), $MachinePrecision], If[LessEqual[y, 5.854905830256108e-157], z, If[LessEqual[y, 0.0036597640836557375], N[(x * 0.5), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]
                    
                    f(x, y, z):
                    	x in [-inf, +inf],
                    	y in [-inf, +inf],
                    	z in [-inf, +inf]
                    code: THEORY
                    BEGIN
                    f(x, y, z: real): real =
                    	LET tmp_4 = IF (y <= (36597640836557375314253004461306773009710013866424560546875e-61)) THEN (x * (5e-1)) ELSE (x * y) ENDIF IN
                    	LET tmp_3 = IF (y <= (5854905830256108246105031966975206028902240162968830564863871817115320458127974035594385847861816939788388249342939317313942201143234810568255488518657786512026600288212725289117319850056321299344427106757627934746602926563050955116168081493415366065699306741582853714553836000394100965350088707959181031885227668579907828039778429594062050058813042289453360276751483053385601007523320049585890956223011016845703125e-571)) THEN z ELSE tmp_4 ENDIF IN
                    	LET tmp_2 = IF (y <= (-10131019801578072483999419388991174124929683998082310092561254117135722638516164413288462068965603455769619805042274309652878448308047788512071805803533054479299435455168639156551648014984423587975538499866136156799647077637476592374870733619169553001950537021413992193299615937549769707621261247924686815951001787190287134767202571896597596829939262500323243649093746274860773576713025325883947432635428263992787408863312825294927057717315306628031884001081763121693592467454764163489052160063838546750472814854691332289050688117990717961283562830365137269708138862000208414175481138893283045566799660530676874259370379149913787841796875e-889)) THEN (x * (5e-1)) ELSE tmp_3 ENDIF IN
                    	LET tmp_1 = IF (y <= (-8591462877770483362664538187182055214769563314387953294740472793305830999901139275756077660958867662314773683196011561231011796862943171039545987845927986731020846577247945899682272971425755113659472812708898861771403454142009803431362611926963426601088826365607746500260412504668440607428592063754546614973151008598506450653076171875e-455)) THEN z ELSE tmp_2 ENDIF IN
                    	LET tmp = IF (y <= (-35300867311555344830665068023857833157161671139535389123793087910756862404967427090762155520113868502187638784)) THEN (x * y) ELSE tmp_1 ENDIF IN
                    	tmp
                    END code
                    \begin{array}{l}
                    \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\
                    \;\;\;\;x \cdot y\\
                    
                    \mathbf{elif}\;y \leq -8.591462877770483 \cdot 10^{-122}:\\
                    \;\;\;\;z\\
                    
                    \mathbf{elif}\;y \leq -1.0131019801578072 \cdot 10^{-252}:\\
                    \;\;\;\;x \cdot 0.5\\
                    
                    \mathbf{elif}\;y \leq 5.854905830256108 \cdot 10^{-157}:\\
                    \;\;\;\;z\\
                    
                    \mathbf{elif}\;y \leq 0.0036597640836557375:\\
                    \;\;\;\;x \cdot 0.5\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;x \cdot y\\
                    
                    
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if y < -3.5300867311555345e109 or 0.0036597640836557375 < y

                      1. Initial program 100.0%

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

                        \[\leadsto z \]
                      3. Step-by-step derivation
                        1. Applied rewrites40.9%

                          \[\leadsto z \]
                        2. Taylor expanded in y around inf

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

                            \[\leadsto x \cdot y \]

                          if -3.5300867311555345e109 < y < -8.5914628777704834e-122 or -1.0131019801578072e-252 < y < 5.8549058302561082e-157

                          1. Initial program 100.0%

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

                            \[\leadsto z \]
                          3. Step-by-step derivation
                            1. Applied rewrites40.9%

                              \[\leadsto z \]

                            if -8.5914628777704834e-122 < y < -1.0131019801578072e-252 or 5.8549058302561082e-157 < y < 0.0036597640836557375

                            1. Initial program 100.0%

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

                              \[\leadsto z \]
                            3. Step-by-step derivation
                              1. Applied rewrites40.9%

                                \[\leadsto z \]
                              2. Taylor expanded in x around inf

                                \[\leadsto x \cdot \left(\frac{1}{2} + y\right) \]
                              3. Step-by-step derivation
                                1. Applied rewrites60.6%

                                  \[\leadsto x \cdot \left(0.5 + y\right) \]
                                2. Taylor expanded in y around 0

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

                                    \[\leadsto x \cdot 0.5 \]
                                4. Recombined 3 regimes into one program.
                                5. Add Preprocessing

                                Alternative 5: 59.0% accurate, 1.1× speedup?

                                \[\begin{array}{l} \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\ \;\;\;\;x \cdot y\\ \mathbf{elif}\;y \leq 1.4127853169820853 \cdot 10^{+29}:\\ \;\;\;\;z\\ \mathbf{else}:\\ \;\;\;\;x \cdot y\\ \end{array} \]
                                (FPCore (x y z)
                                  :precision binary64
                                  :pre TRUE
                                  (if (<= y -3.5300867311555345e+109)
                                  (* x y)
                                  (if (<= y 1.4127853169820853e+29) z (* x y))))
                                double code(double x, double y, double z) {
                                	double tmp;
                                	if (y <= -3.5300867311555345e+109) {
                                		tmp = x * y;
                                	} else if (y <= 1.4127853169820853e+29) {
                                		tmp = z;
                                	} else {
                                		tmp = x * y;
                                	}
                                	return tmp;
                                }
                                
                                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 <= (-3.5300867311555345d+109)) then
                                        tmp = x * y
                                    else if (y <= 1.4127853169820853d+29) then
                                        tmp = z
                                    else
                                        tmp = x * y
                                    end if
                                    code = tmp
                                end function
                                
                                public static double code(double x, double y, double z) {
                                	double tmp;
                                	if (y <= -3.5300867311555345e+109) {
                                		tmp = x * y;
                                	} else if (y <= 1.4127853169820853e+29) {
                                		tmp = z;
                                	} else {
                                		tmp = x * y;
                                	}
                                	return tmp;
                                }
                                
                                def code(x, y, z):
                                	tmp = 0
                                	if y <= -3.5300867311555345e+109:
                                		tmp = x * y
                                	elif y <= 1.4127853169820853e+29:
                                		tmp = z
                                	else:
                                		tmp = x * y
                                	return tmp
                                
                                function code(x, y, z)
                                	tmp = 0.0
                                	if (y <= -3.5300867311555345e+109)
                                		tmp = Float64(x * y);
                                	elseif (y <= 1.4127853169820853e+29)
                                		tmp = z;
                                	else
                                		tmp = Float64(x * y);
                                	end
                                	return tmp
                                end
                                
                                function tmp_2 = code(x, y, z)
                                	tmp = 0.0;
                                	if (y <= -3.5300867311555345e+109)
                                		tmp = x * y;
                                	elseif (y <= 1.4127853169820853e+29)
                                		tmp = z;
                                	else
                                		tmp = x * y;
                                	end
                                	tmp_2 = tmp;
                                end
                                
                                code[x_, y_, z_] := If[LessEqual[y, -3.5300867311555345e+109], N[(x * y), $MachinePrecision], If[LessEqual[y, 1.4127853169820853e+29], z, N[(x * y), $MachinePrecision]]]
                                
                                f(x, y, z):
                                	x in [-inf, +inf],
                                	y in [-inf, +inf],
                                	z in [-inf, +inf]
                                code: THEORY
                                BEGIN
                                f(x, y, z: real): real =
                                	LET tmp_1 = IF (y <= (141278531698208534630351503360)) THEN z ELSE (x * y) ENDIF IN
                                	LET tmp = IF (y <= (-35300867311555344830665068023857833157161671139535389123793087910756862404967427090762155520113868502187638784)) THEN (x * y) ELSE tmp_1 ENDIF IN
                                	tmp
                                END code
                                \begin{array}{l}
                                \mathbf{if}\;y \leq -3.5300867311555345 \cdot 10^{+109}:\\
                                \;\;\;\;x \cdot y\\
                                
                                \mathbf{elif}\;y \leq 1.4127853169820853 \cdot 10^{+29}:\\
                                \;\;\;\;z\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;x \cdot y\\
                                
                                
                                \end{array}
                                
                                Derivation
                                1. Split input into 2 regimes
                                2. if y < -3.5300867311555345e109 or 1.4127853169820853e29 < y

                                  1. Initial program 100.0%

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

                                    \[\leadsto z \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites40.9%

                                      \[\leadsto z \]
                                    2. Taylor expanded in y around inf

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

                                        \[\leadsto x \cdot y \]

                                      if -3.5300867311555345e109 < y < 1.4127853169820853e29

                                      1. Initial program 100.0%

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

                                        \[\leadsto z \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites40.9%

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

                                      Alternative 6: 40.9% accurate, 13.0× speedup?

                                      \[z \]
                                      (FPCore (x y z)
                                        :precision binary64
                                        :pre TRUE
                                        z)
                                      double code(double x, double y, double z) {
                                      	return z;
                                      }
                                      
                                      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
                                      
                                      f(x, y, z):
                                      	x in [-inf, +inf],
                                      	y in [-inf, +inf],
                                      	z in [-inf, +inf]
                                      code: THEORY
                                      BEGIN
                                      f(x, y, z: real): real =
                                      	z
                                      END code
                                      z
                                      
                                      Derivation
                                      1. Initial program 100.0%

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

                                        \[\leadsto z \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites40.9%

                                          \[\leadsto z \]
                                        2. Add Preprocessing

                                        Reproduce

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