0
votes
if(maxmesafe[2]>0.0000001){
        d=(maxx[0]*(maxy[1]-maxy[2])+maxx[1]*(maxy[2]-maxy[0])+maxx[2]*(maxy[0]-maxy[1]))/2;
        int x0=maxx[0]*maxx[0],x1=maxx[1]*maxx[1],x2=maxx[2]*maxx[2],y1=maxy[0]*maxy[0],y2=maxy[1]*maxy[1],y3=maxy[2]*maxy[2];
        newx+=((x0+y0)*(maxy[1]-maxy[2])+(x1+y1)*([maxy[2]-maxy[0]))/d;
        newy+=((x0+y0))*(maxx[2]-maxx[1])+(x1+y1)*([maxx[0]-maxx[2])+(x2+y2)*([maxx[1]-maxx[0]))/d;
        ycap=(maxmesafe[0]*maxmesafe[1]*maxmesafe[2])/sqrt((maxmesafe[0]+maxmesafe[1]+maxmesafe[2])*(-maxmesafe[0]+maxmesafe[1]+maxmesafe[2])*(maxmesafe[0]-maxmesafe[1]+maxmesafe[2])*(maxmesafe[0]+maxmesafe[1]-maxmesafe[2]));
    }

I have invalid operands of types 'double' (Attribute((cdecl)) )(double)' and 'int' to library 'operator' error.

newx, newy, d and ycap values are float variables

1

1 Answers

0
votes

sqrt definition from the manual pages :

#include <math.h>
double sqrt(double x);
float sqrtf(float x);
long double sqrtl(long double x);

So you should cast the sqrt arguments to double or use double variables :

sqrt((double)((maxmesafe[0]+maxmesafe[1]+maxmesafe[2])*(-maxmesafe[0]+maxmesafe[1]+maxmesafe[2])*(maxmesafe[0]-maxmesafe[1]+maxmesafe[2])*(maxmesafe[0]+maxmesafe[1]-maxmesafe[2])))

PS: try to indent your code even inline instruction to be more readable. The best is to not exceed 80 characters per line.