LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-26-2002, 05:57 AM   #1
daztheladd
LQ Newbie
 
Registered: Nov 2002
Posts: 3

Rep: Reputation: 0
Unhappy length of integer variables


hi guys (newbie here).

can anyone tell me the largest numerical value you can safely have in a variable declared as an integer:

declare -i sumname

help appreciated

Daz
 
Old 11-26-2002, 06:32 AM   #2
vladkrack
Member
 
Registered: Oct 2002
Location: Curitiba - Brazil
Distribution: Conectiva
Posts: 334

Rep: Reputation: 30
Hi,

Int have a 32 bits number, then that should be -2147483648 to 2147483648

If you need more than that you could use long that is a 64 bits number ....
 
Old 11-26-2002, 06:37 AM   #3
daztheladd
LQ Newbie
 
Registered: Nov 2002
Posts: 3

Original Poster
Rep: Reputation: 0
how do I use long?
 
Old 11-26-2002, 06:51 AM   #4
vladkrack
Member
 
Registered: Oct 2002
Location: Curitiba - Brazil
Distribution: Conectiva
Posts: 334

Rep: Reputation: 30
Sorry, I forgot to ask, but what language are we talking about?
 
Old 11-26-2002, 06:56 AM   #5
daztheladd
LQ Newbie
 
Registered: Nov 2002
Posts: 3

Original Poster
Rep: Reputation: 0
in bash.
 
Old 11-26-2002, 07:29 AM   #6
vladkrack
Member
 
Registered: Oct 2002
Location: Curitiba - Brazil
Distribution: Conectiva
Posts: 334

Rep: Reputation: 30
In bash is not necessary to declare a variable as int or long, it already knows how to handle ...
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Integer Numbers in C Mercurius Programming 24 10-20-2005 09:54 AM
Integer To a String in C Bean101 Programming 2 05-27-2004 04:46 AM
binding an integer to variables... xconspirisist Programming 4 11-05-2003 11:48 AM
64 bit integer fahad153 Programming 9 08-26-2003 02:03 AM
Shel scripting: variables pointing to variables and case Dark_Helmet Programming 5 06-08-2003 11:07 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:30 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration