seq uses both comma and dot as a decimal separator

nistel

Coming from this answer I'm trying to output a sequence of numbers using a dot as a decimal separator.

This works:

$ LANG=en_US seq 0.1 0.1 0.8
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8

$ LANG=en_US seq 0.1 0.1 1.0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1.0

But this doesn't:

$ LANG=en_US seq 0.1 0.1 0.9
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0,9

Why? How can I fix it?

Charles Duffy

To prevent any locale settings (such as LC_NUMERIC, a likely culprit here) from influencing behavior:

LC_ALL=C seq 0.1 0.1 0.9

That said, I don't advise using seq at all. It's a nonstandard command, not guaranteed to be available on all UNIX platforms or to have any specific behavior when it is available. An a floating-point-capable alternative, consider awk:

LC_ALL=C awk -v min=0.1 -v max=0.9 -v inc=0.1 \
  'BEGIN { cur=min; while (cur <= max) { print cur; cur += inc; }; exit; }'

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Best way to parseDouble with comma as decimal separator?

How to change the decimal separator of DecimalFormat from comma to dot/point?

Convert String with Dot or Comma as decimal separator to number in JavaScript

DecimalFormat uses comma separator even when the pattern specified is a dot

Thousand separator while typing and decimal (with comma)

How to accept both dot and comma as a decimal separator with WTForms?

Format a decimal with comma as decimal separator and without thousands separator

How to convert floating point decimal separator from dot to comma in Javascript

How to write a csv with a comma as the decimal separator?

Replace comma with decimal separator from TextField

Xamarin Forms Entry: Use comma as decimal separator

Change the timespan millisecond separator; comma(,) instead of dot(.)

regex expression to match decimal numbers with comma as a separator

decimal separator in woocommerce to be a comma

AngularJS: Change decimal separator to comma

Azure Data Factory: Reading doubles with a comma as decimal separator instead of a dot

Angular uses comma instead of dot as decimal separator after changing culture

Replace point decimal separator with comma

Parsing numbers with a comma decimal separator in JavaScript

Only add thousand separator before decimal comma

dot instead of comma as thousand separator

NumericUpDown: accept both comma and dot as decimal separator

seq decimal separator

Show comma instead of point as decimal separator

Decimal dot and thousands separator used both in input type number

JavaScript regex to accept numbers with comma separator (thousands) and dot separator (decimals)

Add comma separator to a numbers with 2 decimal points

How to replace decimal separator dot by decimal separator comma in formattable() package R?

How to make that f"..." string formatting uses comma instead of dot as decimal separator?

TOP Ranking

  1. 1

    Failed to listen on localhost:8000 (reason: Cannot assign requested address)

  2. 2

    Loopback Error: connect ECONNREFUSED 127.0.0.1:3306 (MAMP)

  3. 3

    How to import an asset in swift using Bundle.main.path() in a react-native native module

  4. 4

    pump.io port in URL

  5. 5

    Spring Boot JPA PostgreSQL Web App - Internal Authentication Error

  6. 6

    Can't pre-populate phone number and message body in SMS link on iPhones when SMS app is not running in the background

  7. 7

    Do Idle Snowflake Connections Use Cloud Services Credits?

  8. 8

    maven-jaxb2-plugin cannot generate classes due to two declarations cause a collision in ObjectFactory class

  9. 9

    Binding element 'string' implicitly has an 'any' type

  10. 10

    BigQuery - concatenate ignoring NULL

  11. 11

    Compiler error CS0246 (type or namespace not found) on using Ninject in ASP.NET vNext

  12. 12

    In Skype, how to block "User requests your details"?

  13. 13

    Jquery different data trapped from direct mousedown event and simulation via $(this).trigger('mousedown');

  14. 14

    Pandas - check if dataframe has negative value in any column

  15. 15

    flutter: dropdown item programmatically unselect problem

  16. 16

    Generate random UUIDv4 with Elm

  17. 17

    Is it possible to Redo commits removed by GitHub Desktop's Undo on a Mac?

  18. 18

    ngClass error (Can't bind ngClass since it isn't a known property of div) in Angular 11.0.3

  19. 19

    Change dd-mm-yyyy date format of dataframe date column to yyyy-mm-dd

  20. 20

    EXCEL: Find sum of values in one column with criteria from other column

  21. 21

    How to use merge windows unallocated space into Ubuntu using GParted?

HotTag

Archive