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

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

[Octave-bug-tracker] [bug #61290] Unexpected rounding of min and max wit


From: Rik
Subject: [Octave-bug-tracker] [bug #61290] Unexpected rounding of min and max with integer types
Date: Tue, 5 Oct 2021 16:44:43 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36

Follow-up Comment #5, bug #61290 (project octave):

For comment #4, Matlab returns 255 of class uint8.

This is normal behavior for Matlab and Octave.  When mixing integers and
floating point values the result is an integer.

For example,


octave:1> x = uint8 (1) + double (1.0)
x = 2
octave:2> class (x)
ans = uint8


In the test case


max (uint8(250), sqrt(flintmax))


the value "sqrt(flintmax)" is ~9.5E7 and


uint8 (9.5E7) = 255



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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