Re: Stuck on whole numbers.

From: Stephane CHAZELAS (stephane_chazelas_at_yahoo.fr)
Date: 09/27/03


Date: 27 Sep 2003 09:29:47 GMT

Chris F.A. Johnson wrote:
[...]
> 1. Use ksh93; it handles real numbers, which most shells do not

zsh does.

> (note the dot after 4 to force floating point interpretation):

only in locales (LC_NUMERIC) where the decimal point is a dot.

>
> echo $(( 2 / 4. ))
[...]

In a french locale for instance, that would be

echo $(( 2 / 4, ))

~$ ksh93 -c 'echo $(( 2 / 4. ))'
ksh93: line 1: 2 / 4. : arithmetic syntax error

~$ locale -k LC_NUMERIC
decimal_point=","
thousands_sep=""
grouping=-1;-1
numeric-decimal-point-wc=44
numeric-thousands-sep-wc=0
numeric-codeset="ISO-8859-1"

-- 
Stéphane


Relevant Pages

  • Re: Locales
    ... locale from english to something else (more precisely, ... decimal separator to be a dot ). ... declare the DP variable so that it has the scope to be used ...
    (microsoft.public.vb.general.discussion)
  • Re: Simplified TimeZone
    ... Lew's response seemed informative: "Those changeover dates vary ... with locale." ... software vendor to offer updates, ... home dot woh dot rr dot com slash jbmatthews ...
    (comp.lang.java.programmer)
  • Re: Need to have a dot used as decimal symbol, regardless of locale
    ... by using the dot as decimal symbol. ... depending on the locale. ... I need 8.26 to be printed regardless of the locale. ...
    (microsoft.public.excel.programming)
  • Need to have a dot used as decimal symbol, regardless of locale
    ... by using the dot as decimal symbol. ... depending on the locale. ... I need 8.26 to be printed regardless of the locale. ...
    (microsoft.public.excel.programming)
  • Re: Stuck on whole numbers.
    ... zsh does. ... only in locales where the decimal point is a dot. ... In a french locale for instance, ...
    (comp.unix.shell)