Rather than using isequal on floating points which is bad practice and forcing the function to round its output to two decimals, you should test that the result is within a certain tolerance of the true value, like so: assert(abs(y_correct-crcl_area(x)) <= 0.01)
Good advice! Floating point math and isequal don't mix well.
why don't you claim "pi"?really hate it.
"pi" works, but currently, solution needs to be rounded off to 2 decimal places.
Would be better to increase the result tolerance.
The numbers are wrong.
Please fix the test suite.
You need to specify that the answer must be rounded to 2 decimal places.
You need to specify that the answer must be rounded to 2 decimal places.
1887 Solvers
Back to basics 19 - character types
226 Solvers
Generate a vector like 1,2,2,3,3,3,4,4,4,4
3884 Solvers
540 Solvers
Matlab Basics - Assigning Variables
148 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!