[Scilab-users] printf bug?

Stefan Du Rietz sdr at durietz.se
Tue Jul 29 22:41:46 CEST 2014


Leon, Can you please try it with Scilab 5.4.1 under openSUSE? And can 
you show its Bash output from
$ locale

When I was running Scilab 5.4.1 under Xubuntu 12.04, printf worked OK, 
but also in Bash. So the question is: Why do you now get different 
results in Scilab and Bash?

And *the important point*: Why should a mathematics program handle 
inputs differently from outputs?

If one should handle decimal separators differently depending on the 
local language, it should be done consistently (as in Bash, even if I 
don't like it)!

One could of course have special functions or arguments to present 
numbers in specific local formats.

Stefan


On 2014-07-29 19:41, Leon Bevc wrote:
> Strange...
>
> In this case I got the same result as you on Xubuntu and openSUSE:
>
> [ xUbuntu 14.04.1 - 32bit / Scilab 5.5.0 / LANG=sl_SI.UTF-8 ]
> lebevc at book-PC:~$ printf "%0.2f\n" 3.1416
> bash: printf: 3.1416: neveljavno število
> 0,00
> lebevc at book-PC:~$ printf "%0.2f\n" 3,1416
> 3,14
>
> ----------------------------------------------------------------------
> [ openSUSE 13.1-64bit ; Scilab 5.4.1]
> lebevc at linux-xkf0:~> printf "%0.2f\n" 3.1416
> bash: printf: 3.1416: invalid number
> 0,00
> lebevc at linux-xkf0:~> printf "%0.2f\n" 3,1416
> 3,14
>
> -->x = 0.6231166;
> -->xstr = msprintf("%0.2f", x)
>   xstr  =
>   0.62
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>





More information about the users mailing list