bc arbitrary precision cal lang


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers bc arbitrary precision cal lang
# 1  
Old 04-11-2003
bc arbitrary precision cal lang

Hello all,

I don't know ksh that well but when I try to run a simple script using the bc command I get "unexpected '.' ", has any one encouter this or help me. I'm running under redaht 7.2. Here is a simple example:
Code:
#!/bin/ksh
#
kilo=`echo "2495 * .25"|bc`
if [ $kilo -lt 3000 ]
then
   echo "LESS THEN"
else
   echo "GREATER THEN"
fi

I get 1[9]: 623.75: unexpected '.'
GREATER THEN

THANKS

added code tags for readability --oombera

Last edited by oombera; 02-17-2004 at 03:31 PM..
# 2  
Old 04-11-2003
larry,
When I ran it in Solaris 8, I got:

LESS THEN

Pretty strange. Anyone have any ideas?
# 3  
Old 04-11-2003
Most versions of ksh only support integer arithmetic. If you try to operate on a number like 623.75 the results will be unpredictable.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Precision in print

I have a shell script which prints a variable to a text file (sorry if this is the wrong terminology, I'm new to this): awk `{sumdiffsqt+=$1;stdevt=sqrt(sumdiffsqt/('${n}'-1));errt=stdevt/sqrt('${n}')} END {print '$period',stdevt,errt}' diffsqt.txt >> ${xstation1}_${xstation2}_tt.err I need... (4 Replies)
Discussion started by: claire.a
4 Replies

2. Shell Programming and Scripting

Get timestamp with millisecond precision

Hi All, could any body let me know. how to get timestamp with millisecond precision in unix bash shell. example -->2005-12-06- 4-22-35-195 please help me. Thanks, Krupa:wall: (3 Replies)
Discussion started by: krupasindhu18
3 Replies

3. HP-UX

install arabic lang

hi how to install arabic language and set it as default in hpux. also there is any website provide vm for hpunix for testing. (2 Replies)
Discussion started by: drpix
2 Replies

4. Programming

How to do 'export LANG=en" Using C

Hi Could you please help me How to program Linux shell commands using C. I want set Language environment before start a particular application. Example:- export LANG=hi_IN.UTF-8 gedit This will start Localized Hindi( Indian Language) version of the 'gedit', if the Hindi language... (2 Replies)
Discussion started by: Ram Das
2 Replies

5. Ubuntu

LANG=C not English?

On Ubuntu 7.04, why would the "C" LANG parameter not be English: $ LANG=C locale LANG=C LANGUAGE=he_IL:he:en_GB:en LC_CTYPE="he_IL.utf8" LC_NUMERIC="he_IL.utf8" LC_TIME="he_IL.utf8" LC_COLLATE="he_IL.utf8" LC_MONETARY="he_IL.utf8" LC_MESSAGES="he_IL.utf8" LC_PAPER="he_IL.utf8"... (4 Replies)
Discussion started by: dotancohen
4 Replies

6. UNIX for Dummies Questions & Answers

Setting the $LANG info needed

Hello (Very New to UNIX -Solaris 10) I'm trying to set the LANG variable to C but not sure if it's getting set, need some help on this. Currently I have it set to en_GB.UTF-8 I need to set it to C for an install. but when I run set LANG=C and then run echo $LANG its still set to... (2 Replies)
Discussion started by: deedaz
2 Replies

7. Programming

max precision in float

Hi, As all of us know that size of int is machine as well as compiler dependent we can get the range and size of an int , float and char etc in /usr/include/limits.h header file of a compiler but could any one tell me how to get info of precision of float and ... (6 Replies)
Discussion started by: useless79
6 Replies

8. UNIX for Dummies Questions & Answers

Where to set the LANG variable

When I login to my AIX server, the LANG variable is automatically being set to En_US. This is causing locale warning messages when I run emacs or perl. The reason seems to be that En_US is not a valid locale (seen by running locale -a). I can change the variable from the command line (export... (3 Replies)
Discussion started by: wvdeijk
3 Replies

9. UNIX for Dummies Questions & Answers

Lang

Hi, I have LANG set to C.iso88591 what does this value mean and what other options do I have? The problem is that I am using mailx to send out reports. When the report arrives the email has a lot of details about a charecter set not being supported. I don't want to have a null value... (0 Replies)
Discussion started by: nhatch
0 Replies

10. UNIX for Dummies Questions & Answers

precision getting?

I need to find out the precision on a solaris machine using the unix terminal. How do I find this out? Specifics needed: How are single precision numbers represented (8 or 16 bit) How are double precision numbers represented (16 or 32 bit) How are they stored. ( some computers store numbers... (1 Reply)
Discussion started by: Townsfolk
1 Replies
Login or Register to Ask a Question