help-octave
[Top][All Lists]
Advanced

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

Bug?


From: Dr.-Ing. Dieter Jurzitza
Subject: Bug?
Date: Tue, 21 Jun 2016 21:10:33 +0200
User-agent: KMail/4.14.10 (Linux/4.1.21-15.2-default; KDE/4.14.18; x86_64; ; )

Dear listmembers,
when printing with printf I stumbled across something strange (to me ...):

>> A=linspace(0,10,10);
>> printf("%d\n", A);
0
1.11111
2.22222
3.33333
4.44444
5.55556
6.66667
7.77778
8.88889
10
>>

I intentionally forced linspace to create a list of floats.

I say strange because I didn't expect this. The format specifier "%d" says an 
integer is going to be printed. And what is the outcome? floats!

Matlab does apparently the same - so, is this (in my understanding erratic 
...) behaviour a compatibility - feature?

Thank you very much for clarifying,
take care




Dieter Jurzitza



-- 
-----------------------------------------------------------

                               |
                                \
                 /\_/\           |
                | ~x~ |/-----\   /
                 \   /-       \_/
  ^^__   _        /  _  ____   /
 <°°__ \- \_/     |  |/    |  |
  ||  ||         _| _|    _| _|

if you really want to see the pictures above - use some font
with constant spacing like courier! :-)
-----------------------------------------------------------




reply via email to

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