Closed dougc333 closed 6 years ago
The FPCore(x) functions are different from the video. Using herbgrind 2.0 from github
Quick clarification: in the code you pasted, you have solve_quadratic(2,b,c)
, but in the video it's solve_quadratic(2,b,3)
. Is that just a typo?
In any case, the two influenced-by expressions look equivalent to me: one uses 8.0 where the other uses (* 4.0 2.0)
.
Typo.. thanks!!
I talked with @pavpanchekha (who is traveling and can't post on github right now) and he said that using a different compiler can cause trivial differences like (* 4.0 2.0)
vs 8.0
.
I don't see any other differences in the output. Am I missing something or can we close this?
I'm going to close this issue since it seems like @wilcoxjay cleared some stuff up. Feel free to re-open if there's something unresolved!
https://www.youtube.com/watch?v=oYtnXEZC0jk&t=1822s
include
include
include
double solve_quadratic(double a, double b, double c){ //there are 2, a plus and minus; we only take the plus return (-b + sqrt(bb - 4ac))/(2a); }
int main(int argc, char* argv) { double b = 1e-10; for (int i =0; i<20; i++){ b=10; printf("%e\n", solve_quadratic(2,b,c));
}
above saved as main.c gcc ./main.cpp -O0 -g -lm -o main
/home/dc/herbgrind/valgrind/herbgrind-install/bin/valgrind --tool=herbgrind --no-ranges ./main
main.gh Result @ main.cpp:21 in main (addr 400730) 47.750810 bits average error 64.000000 bits max error Aggregated over 20 instances Influenced by erroneous expression:
main.cpp:9 in solve_quartic(double, double, double) (addr 400678) 47.750810 bits average error 64.000000 bits max error 32.000000 bits average local error 64.000000 bits max local error Aggregated over 20 instances