[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Preserving signbit for range operator
From: |
Daniel J Sebald |
Subject: |
Re: Preserving signbit for range operator |
Date: |
Wed, 27 Feb 2013 20:51:12 -0600 |
User-agent: |
Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111108 Fedora/3.1.16-1.fc14 Thunderbird/3.1.16 |
On 02/27/2013 08:06 PM, Rik wrote:
On 02/27/2013 05:55 PM, Daniel J Sebald wrote:
I will have to check, but I don't think we are using the integer format
code '%d' when we print integers. Instead, I think we are printing them as
floats with the width of the decimal portion set to zero.
For example,
x = [-0 2 4];
sprintf ("%4.0f ", x)
ans = -0 2 4
Well, then this case is in error:
octave:55> [-0:3:6]
ans =
0 3 6
This is the original error all over again [-0:3:6] produces the actual
sequence [0 3 6] which is correctly displayed as [0 3 6].
Sure, depending upon how we feel it should be treated. But we know
there are at least two errors. One which I think at least a couple of
us agree should be happening internally; a second which we are so sure
about.
The problem might be that Octave is not displaying/casting integers the
way Matlab is, i.e., this statements from your last post might be how
Octave does things but might not be (as in I don't know) consistent with
Matlab.
I will have to check, but I don't think we are using the integer format
code '%d' when we print integers. Instead, I think we are printing them as
floats with the width of the decimal portion set to zero.
By the way, from "help format",
By default, Octave displays 5 significant digits in a human
readable form (option `short' paired with `loose' format for
matrices). If `format' is invoked without any options, this
default format is restored.
Shouldn't that be "5 significant fractional digits", or "5 significant
digits past the decimal point"? E.g.,
octave:44> y = [-0 2 345.00001]
y =
-0.00000 2.00000 345.00001
Dan
- Re: Preserving signbit for range operator, (continued)
- Message not available
- Re: Preserving signbit for range operator, Daniel J Sebald, 2013/02/25
- Re: Preserving signbit for range operator, Michael D. Godfrey, 2013/02/25
- Re: Preserving signbit for range operator, Daniel J Sebald, 2013/02/25
- Re: Preserving signbit for range operator, Daniel J Sebald, 2013/02/27
- Re: Preserving signbit for range operator, Rik, 2013/02/27
- Re: Preserving signbit for range operator, Daniel J Sebald, 2013/02/27
- Re: Preserving signbit for range operator, Rik, 2013/02/27
- Re: Preserving signbit for range operator,
Daniel J Sebald <=
- Re: Preserving signbit for range operator, Michael D. Godfrey, 2013/02/27
- Re: Preserving signbit for range operator, Daniel J Sebald, 2013/02/28
- Re: Preserving signbit for range operator, Michael D. Godfrey, 2013/02/28
- Re: Preserving signbit for range operator, Michael D. Godfrey, 2013/02/28
- Re: Preserving signbit for range operator, Rik, 2013/02/28
- Re: Preserving signbit for range operator, Michael D. Godfrey, 2013/02/28