printf error (not completely converted)

I'm encountering an issue in printf.. it works on other servers but not this one (SunOS - Kernel Generic_118558-33)

root@server # echo $x
2.340
root@server # printf "%.1f" $x
printf: 2.340 not completely converted
2,0root@server #

anyone has an idea? i was expecting an output of "2.3"

Printf is implemented in the shell, not the kernel. What shell are you using?

If this is a script, try replacing #!/bin/sh on the first line with #!/bin/bash or the equivalent with the right path for bash, if it's installed.

--------

Wait, I see the input value has a period and the output value has a comma.
Which one is correct for the country you are in?
There may be an environment variable set incorrectly. I'm not sure which one.

i used ksh..
bash doesnt seem to work.

this is what i get using bash.

+ MEM=22.830
++ printf %.1f 1.750
./healthcheck.ksh: printf: 1.750: invalid number

the example above uses "sh" by default on the commandline

root@server # echo $SHELL
/sbin/sh

Is LC_NUMERIC set?
If it's set, and set to something other than en_US or en_US.UTF, try this. (I'm not sure about ksh syntax.)

export LC_NUMERIC=en_US.UTF

i havent tried this.. yes i see something like that set in working server but not found in the "not working" server. i'll let you know thanks!

thanks Ken, your solution works!

root@server # printf %.1f 1.750
1.8
root@server #