sum

Percentage Accurate: 100.0% → 100.0%
Time: 583.0ms
Alternatives: 1
Speedup: 1.0×

Specification

?
\[1 \leq sum \land sum \leq 10\]
\[\begin{array}{l} \\ sum \end{array} \]
(FPCore (sum) :precision binary64 sum)
double code(double sum) {
	return sum;
}
real(8) function code(sum)
    real(8), intent (in) :: sum
    code = sum
end function
public static double code(double sum) {
	return sum;
}
def code(sum):
	return sum
function code(sum)
	return sum
end
function tmp = code(sum)
	tmp = sum;
end
code[sum_] := sum
\begin{array}{l}

\\
sum
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 1 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?

\[\begin{array}{l} \\ sum \end{array} \]
(FPCore (sum) :precision binary64 sum)
double code(double sum) {
	return sum;
}
real(8) function code(sum)
    real(8), intent (in) :: sum
    code = sum
end function
public static double code(double sum) {
	return sum;
}
def code(sum):
	return sum
function code(sum)
	return sum
end
function tmp = code(sum)
	tmp = sum;
end
code[sum_] := sum
\begin{array}{l}

\\
sum
\end{array}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ sum \end{array} \]
(FPCore (sum) :precision binary64 sum)
double code(double sum) {
	return sum;
}
real(8) function code(sum)
    real(8), intent (in) :: sum
    code = sum
end function
public static double code(double sum) {
	return sum;
}
def code(sum):
	return sum
function code(sum)
	return sum
end
function tmp = code(sum)
	tmp = sum;
end
code[sum_] := sum
\begin{array}{l}

\\
sum
\end{array}
Derivation
  1. Initial program 100.0%

    \[sum \]
  2. Add Preprocessing
  3. Add Preprocessing

Reproduce

?
herbie shell --seed 1 
(FPCore (sum)
  :name "sum"
  :precision binary64
  :pre (and (<= 1.0 sum) (<= sum 10.0))
  sum)