[Solved] Errors about too few arguments


Just what the error says! You haven’t passed enough arguments:

This prototype:

fp(double a, double b, double c, double x) {

means you need to pass four arguments, like:

fp(x1, what, about, these);

The same goes for newton.

Also, regarding if (fp(x1)==0.0) – While floating point zero values can be compared with each other (zero is excatly zero), remember that floating-point on computers is not exact. For that reason, you should always compare against some epsilon value:

#define EPSILON           0.0001     // salt to taste
#define ABS(x)            ( ((x)<0) ? -(x) : x )
#define FP_EQUALS(x,y)    (ABS(x-y) < EPSILON)

//if (d == 0.0) {
if (FP_EQUALS(d, 0.0)) {
    // d is "zero"
}

//if (a == b) {
if (FP_EQUALS(a, b) {

2

solved Errors about too few arguments