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

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

[Octave-bug-tracker] [bug #62283] max (a, b) produces unintuitive result


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #62283] max (a, b) produces unintuitive results when mixing integers and floating point values
Date: Sat, 4 Jun 2022 17:30:23 -0400 (EDT)

Follow-up Comment #6, bug #62283 (project octave):

I note that in the course of writing this documentation, I found the following
weird inconsistent behavior.


>> a = max (int8 (100), int16 (200)), class (a)
a = 200
ans = int16

>> a = max (int8 (100), double (200)), class (a)
a = 127
ans = int8


So: integers of differing widths are promoted to the wider width, but integer
and floating point is demoted to the most binding constraint. Is this done for
Matlab compatibility?


    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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