[Bugzilla] [Bug 6729] Samuel GOUGEON has changed bug_file_loc, assigned_to

bugzilla.admin at scilab.org bugzilla.admin at scilab.org
Sat Mar 24 17:17:40 CET 2018


http://bugzilla.scilab.org/show_bug.cgi?id=6729
--------- Bug Summary -----------
An GOOD compatibility bug :~))) Should be mentioned in Help/Doc Matlab (code

---------- Changed by ------------
sgougeon at free.fr

---------- What changed ----------
bug_file_loc, assigned_to


Samuel GOUGEON <sgougeon at free.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|no error message            |
           Assignee|vincent.couvert at scilab-ente |bugzilla.admin at scilab.org
                   |rprises.com                 |

--- Comment #3 from Samuel GOUGEON <sgougeon at free.fr> ---
(In reply to Vincent COUVERT from comment #1)
> I'm not sure it is an associativity problem:
> - First example: (int16(1)+0.4)+0.4 is equivalent to (int16(1)+int16(0.4))+int16(0.4) ==> (int16(1) + 0) + 0 ==> 1
> - Second example:  int16(1)+(0.4+0.4) is equivalent to int16(1)+int16(0.4+0.4) ==> int16(1) + int16(0.8) ==> 2

Which version were you commenting: The Matlab or Scilab one?

In Octave 4.2.1, we still get:
>(int16(1)+0.4)+0.4 returns 1, but
>int16(1)+(0.4+0.4) returns 2 (In Matlab addition is not associative!)

The difference between Scilab and Octave is that Scilab int() decimal numbers when casting them into encoded integers:
--> int8(-1.2)
 ans  =
 -1

--> int8(1.2)
 ans  =
  1

While Octave rounds them:
>> int8(-1.6)
ans = -2
>> int8(-1.5)
ans = -2
>> int8(-1.4999)
ans = -1
>> int8(1.4999)
ans = 1
>> int8(1.6)
ans = 2

The status of Matlab versus Octave should be checked before fixing mtlb_int#() implementations

-- 
You are receiving this mail because:
You are watching all bug changes.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/bugzilla/attachments/20180324/9a1a5472/attachment.htm>


More information about the Bugzilla mailing list