Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int verify_first_5 (double coefficients [], double x_endpoints [])
- {
- int low_val = evaluate_f_x(coefficients, x_endpoints[0]);
- int high_val = evaluate_f_x(coefficients, x_endpoints[1]);
- int x_switch = 0;
- if (x_endpoints[0] >= x_endpoints[1])
- {
- printf("Data warning: switching x endpoints!");
- x_switch = x_endpoints[0];
- x_endpoints[0] = x_endpoints[1];
- x_endpoints [1] = x_switch;
- }
- else if((low_val*high_val) > 0)
- {
- printf("Data error: function does not ");
- printf("have opposite signs on endpoints");
- return 0;
- }
- else if (low_val && high_val == 0)
- {
- return 1;
- }
- else
- {
- return 1;
- }
- }
- /**************************************************************
- * Function verify_tolerance verifies tolerance inputs
- * Input:
- * Accepts an array of tolerances
- *
- * Output:
- * returns 1 if data provided is valid; otherwise returns 0
- *
- *
- ***************************************************************/
- double verify_tolerance (double tolerances[])
- {
- if (tolerances[0] <0 || tolerances[1] < 0)
- {
- return 0;
- }
- else
- {
- return 1;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement