Is the uplus function useful?

matlab

Solution

It is not necessary, a language without a unary plus does not allow to write `+1`. Obviously you could also write `1` but when importing data which always writes the `+` or `-` it's very nice to have.

Searching some source codes, I found a curious use of `+`

A=+A

which replaced the code:

if ~isnumeric(A)
    A=double(A);
end

It casts chars and logicals to double, but all numeric data types remain untouched.

Problem

This is a rhetorical question about the `uplus` function in MATLAB, or its corresponding operator, the unary plus `+`. Is there a case where this operator is useful? Even better, is there a case where this operator is necessary?

Original source

Related problems