[Bugzilla] [Bug 6729] Samuel GOUGEON has commented the bug

bugzilla.admin at scilab.org bugzilla.admin at scilab.org
Sun Mar 25 07:36:49 CEST 2018


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

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

---------- What changed ----------

--- Comment #6 from Samuel GOUGEON <sgougeon at free.fr> ---
All mtlb_int#() and mtlb_uint#() functions were almost always wrong:

A) They saturated (instead of wrapping) only for -inf and + inf. Otherwise they wrapped:
   -------------------------------------------------------------------------------------
--> mtlb_int8(-130)
 ans  =
  126              // wrapped, instead of saturating to -128

--> mtlb_int8(130)
 ans  =
 -126             // wrapped, instead of saturating to 127

--> mtlb_uint8(-1)
 ans  =
  255             // wrapped, instead of saturating to 0

--> mtlb_uint8(260)
 ans  =
  4              // wrapped, instead of saturating to 255

Same thing for  mtlb_int16, mtlb_uint16, mtlb_int32, and mtlb_uint32

B) They truncated the decimal part instead of rounding to the nearest integer
   --------------------------------------------------------------------------
--> mtlb_int8(-23.7)
 ans  =
 -23            // -24 expected

--> mtlb_int8(-23.5)
 ans  =
 -23            // -24 expected

--> mtlb_int8(23.5)
 ans  =
  23             // 24 expected

--> mtlb_int8(23.7)
 ans  =
  23             // 24 expected

Same thing for mtlb_uint8, mtlb_int16, mtlb_uint16, mtlb_int32, and mtlb_uint32.

C) mtlb_int64() and mtlb_uint64() were not available
   -------------------------------------------------
--> mtlb_int64(2^38)

Undefined variable: mtlb_int64

--> mtlb_uint64(2^38)

Undefined variable: mtlb_uint64

I am going to commit a fix.

-- 
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/20180325/6688d80b/attachment.htm>


More information about the Bugzilla mailing list