Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct quad {
- int a;
- int b;
- int c;
- }
- int f(const int a, const int b, const int c, const int x){
- const int l = a*x*x + b*x + c;
- return l;
- }
- int safe_quad_eval(const struct quad q, const int x){
- (f(q.a,q.b,q.c,x)>INT_MAX)||(f(q.a,q.b,q.c,x)<(-INT_MAX)) ? INT_MIN : f(q.a,q.b,q.c,x);
- }
- int safe_quad_eval(const struct quad q, const int x){
- return (f(q.a,q.b,q.c,x)>INT_MAX)||(f(q.a,q.b,q.c,x)<(-INT_MAX)) ? INT_MIN : f (q.a,q.b,q.c,x);
- }
- int safe_quad_eval(const struct quad q, const int x){
- return (f(q.a,q.b,q.c,x)>INT_MAX)||(f(q.a,q.b,q.c,x)<(-INT_MAX)) ? INT_MIN : f(q.a,q.b,q.c,x);
- }
- int safe_quad_eval(const struct quad q, const int x){
- return (f(q.a,q.b,q.c,x)>INT_MAX)||(f(q.a,q.b,q.c,x)<(-INT_MAX)) ? INT_MIN : f(q.a,q.b,q.c,x);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement