34 views (last 30 days)

I know that Mathworks pays a lot of attention to this stuff, so I am wondering why the expression

>> min(0,NaN)

is 0. Returning a NaN here seems more logical to me.

Sean de Wolski
on 21 May 2012

Jan
on 22 May 2012

Walter Roberson
on 21 May 2012

Daniel Shub
on 22 May 2012

Given the behavior of MIN, I find it odd that there is a NANMIN function.

Jonathan Sullivan
on 21 Jun 2012

That is really interesting. If you look inside nanmin, it has one line.:

[varargout{1:nargout}] = min(varargin{:});

per isakson
on 21 Jun 2012

M Sohrabinia
on 21 Jun 2012

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
## 4 Comments

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_834951

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_834951

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_834963

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_834963

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_835078

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_835078

## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_835131

⋮## Direct link to this comment

https://in.mathworks.com/matlabcentral/answers/38999-what-is-the-reasoning-behind-the-fact-that-min-0-nan-is-0#comment_835131

Sign in to comment.