I need to remember that using 0.31830988618379067154 is less expensive (size 14) than using 1/pi (size 15) ;)
Yeah. But this is useful only within Cody. For real work it would be crazy to program it this way.
Only if you are writing for a low solution size. There's on penalty for writing for clarity, and it's preferred in the real world...
Test | Status | Code Input and Output |
---|---|---|
1 | Pass |
%%
x = 1;
y_correct = 1/pi;
assert(isequal(your_fcn_name(x),y_correct))
y =
0.3183
|
2 | Pass |
%%
x = pi;
y_correct = pi;
assert(isequal(your_fcn_name(x),y_correct))
y =
3.1416
|
3 | Pass |
%%
x = pi/2;
y_correct = pi/4;
assert(isequal(your_fcn_name(x),y_correct))
y =
0.7854
|
1882 Solvers
Create a vector whose elements depend on the previous element
391 Solvers
Determine the number of odd integers in a vector
435 Solvers
615 Solvers
465 Solvers
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!