octave-maintainers
[Top][All Lists]
Advanced

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

Re: symbolic true


From: Colin Macdonald
Subject: Re: symbolic true
Date: Thu, 11 Jun 2015 09:19:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0

On 11/06/15 04:05, Doug Stewart wrote:
using this code:


clear
syms p a b
digits(47);

  b=vpa("1.00000")
  a=vpa("3.90000")
  b<a
  a<b

   if ( b<a)
    p="100"
   else
    p="400"
   endif

After running this p should be 100 but it isn't.

The if statement always goes to the false condition!!

How can I make the if statement work with a
(sym) True

Currently, you need `if (logical (b < a))`

This is a bug in Octave: https://savannah.gnu.org/bugs/?43097

(also noted here: https://github.com/cbm755/octsympy/issues/191)

FWIW, the decision to have symbolic True/False values in Symbolic pkg could be revisited which would be a workaround. But I think I did that to avoid corner cases like
`[x true x]`.

Colin




reply via email to

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