[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
%u format is broken in *printf functions in octave-4.2.2
From: |
Sergei Steshenko |
Subject: |
%u format is broken in *printf functions in octave-4.2.2 |
Date: |
Tue, 16 Apr 2019 11:57:35 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 |
Hello All,
after for several years using my self-built octave-3.6.4 I finally
switched to octave-4.4.2 distributed with Ubuntu-18.04.
And I've noticed that *printf functions work wrongly with %u format:
"
octave:3> printf("%u\n", 1234567.890123456)
1.23457e+06
octave:4> sprintf("%u\n", 1234567.890123456)
ans = 1.23457e+06
octave:5> version
ans = 4.2.2
".
%u format is supposed to output without decimal period and exponent. In
this particular case I expect output like this (the same machine and OS) :
"
address@hidden:~$ perl -e 'printf("%07u\n", 1234567.890123456)'
1234567
".
Am I missing something or it's a bug ? And if it's a bug, will using
'floor', like here:
"
octave:8> sprintf("%u\n", floor(1234567.890123456))
ans = 1234567
"
be a reliable workaround ?
Thanks,
Sergei.
- %u format is broken in *printf functions in octave-4.2.2,
Sergei Steshenko <=