octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59899] colon operator returns incompatible cl


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #59899] colon operator returns incompatible class for integer inputs
Date: Mon, 18 Jan 2021 13:32:41 -0500 (EST)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36 Edg/87.0.664.75

Follow-up Comment #4, bug #59899 (project octave):

In Matlab R2020b:

>> uint8(10):-1:uint8(1)

ans =

  1×10 uint8 row vector

   10    9    8    7    6    5    4    3    2    1

>> x = uint8(1) : 0.4 : uint8(5)
Error using  : 
Double operands interacting with uint8 operands must have integer values.

>> x = uint8 (1 : 0.4 : 5)

x =

  1×11 uint8 row vector

   1   1   2   2   3   3   3   4   4   5   5

>> x = uint8(1):int32(5);
Error using  : 
Colon operands must be all the same type, or mixed with real scalar doubles.

>> x = uint8(5) : -1 : -5
Error using  : 
Colon operands must be in the range of the data type.
 
>> x = single(0):pi:100*pi;
>> sprintf ('%.17f\n', x(2))

ans =

    '3.14159274101257324
     '

>> sprintf ('%.17f\n', pi('single'))
Error using pi
Too many input arguments.

>> sprintf ('%.17f\n', single(pi))

ans =

    '3.14159274101257324
     '

>> sprintf ('%.17f\n', double(pi))

ans =

    '3.14159265358979312
     '



    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59899>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]