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

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

[Octave-bug-tracker] [bug #64538] 1/x calculates wrong when mapped on an


From: Markus Mützel
Subject: [Octave-bug-tracker] [bug #64538] 1/x calculates wrong when mapped on an array of floats
Date: Thu, 10 Aug 2023 02:42:40 -0400 (EDT)

Update of bug #64538 (project octave):

                  Status:                    None => Need Info              

    _______________________________________________________

Follow-up Comment #1:

The `/` is a matrix division operator (shorthand for `mrdivide`). For a matrix
division to be possible the respective dimension of the two operands must
match.

I don't know if I understood correctly which result you consider to be wrong.
But maybe you intended to use an element-wise division? For that, you could
use the `./` operator (shorthand for `rdivide`):

>> 1./[1.0,0.1]
ans =

    1   10

>> 1./[0.1,0.2,0.3]
ans =

   10.0000    5.0000    3.3333

>> 1./[0.1,0.2,0.3]'
ans =

   10.0000
    5.0000
    3.3333

>> 1.0./[0.1,0.2,0.3]'
ans =

   10.0000
    5.0000
    3.3333

>> 1.0./([0.1,0.2,0.3]')
ans =

   10.0000
    5.0000
    3.3333




    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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