Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

seq uses comma as decimal separator

I have noticed a strange seq behavior on one of my computers (Ubuntu LTS 14.04): instead of using points as decimal separator it is using commas:

seq 0. 0.1 0.2
0,0
0,1
0,2

The same version of seq (8.21) on my other PC gives the normal points (also same Ubuntu version). The strangest thing is that I am observing the same ill behavior on a remote machine when I ssh into it from the first machine. Even a bash script submitted from the conflictive machine to a job scheduler (slurm) on the remote machine is having this problem. I am very confused. Why (and how!) is this happening?

like image 871
Miguel Avatar asked May 27 '14 08:05

Miguel


People also ask

What is used as a separator of decimal number?

Great Britain and the United States are two of the few places in the world that use a period to indicate the decimal place. Many other countries use a comma instead. The decimal separator is also called the radix character.

How do you change a decimal separator to a dot?

Click File > Options. On the Advanced tab, under Editing options, clear the Use system separators check box.

Can you use a comma as a decimal in C++?

If you want to allow user to input comma as decimal separator, you will need to apply locale to input stream too: std::cin. imbue(std::locale( "se-SE" ));


1 Answers

It's likely the LANG variable or some other locale-specific variable. On a computer where seq behaves "normally" try:

$ LANG=fr_FR seq 0. 0.1 0.2
0,0
0,1
0,2
$ LANG=en_US seq 0. 0.1 0.2
0.0
0.1
0.2
like image 132
cnicutar Avatar answered Oct 02 '22 15:10

cnicutar