uminus

Negate elements of fi object array

Syntax

uminus(a)

Description

uminus(a) is called for the syntax -a when a is an object. -a negates the elements of a.

uminus does not support fi objects of data type Boolean.

Examples

When wrap occurs, -(-1) = -1 :

fipref('NumericTypeDisplay','short', ...
       'fimathDisplay','none');
format short g
a = fi(-1,true,8,7,'OverflowAction','Wrap') 

a =
 
    -1
      s8,7
-a 

ans =
 
    -1
      s8,7
b = fi([-1-i -1-i],true,8,7,'OverflowAction','Wrap') 

b =
 
           -1 -          1i           -1 -          1i
      s8,7
-b 

ans =
 
           -1 -          1i           -1 -          1i
      s8,7
b' 

ans =
 
           -1 -          1i
           -1 -          1i
      s8,7

When saturation occurs, -(-1) = 0.99... :

c = fi(-1,true,8,7,'OverflowAction','Saturate') 

c =
 
    -1
      s8,7
-c 

ans =
 
      0.99219
      s8,7
d = fi([-1-i -1-i],true,8,7,'OverflowAction','Saturate') 

d =
 
           -1 -          1i           -1 -          1i
      s8,7
-d 

ans =
 
      0.99219 +    0.99219i      0.99219 +    0.99219i
      s8,7
d' 

ans =
 
           -1 +    0.99219i
           -1 +    0.99219i
      s8,7

See Also

| | |

Was this topic helpful?