DaemonForums  

Go Back   DaemonForums > Miscellaneous > Programming

Programming C, bash, Python, Perl, PHP, Java, you name it.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 1st April 2010
PatrickBaer PatrickBaer is offline
Fdisk Soldier
 
Join Date: May 2008
Posts: 81
Thanked 1 Time in 1 Post
Default Bash, long integer

Good morning,

can someone tell me how to declare a variable as long integer? I have a small script parsing logfiles and it bails out from bc because of a division by zero
Reply With Quote
  #2   (View Single Post)  
Old 1st April 2010
Carpetsmoker's Avatar
Carpetsmoker Carpetsmoker is offline
Real Name: Martin
Old man from scene 24
 
Join Date: Apr 2008
Location: Eindhoven, Netherlands
Posts: 2,075
Thanked 198 Times in 156 Posts
Default

Division by zero is always wrong, no matter how long/large your integer is.

Post your script and the error you get, that might shed some light on what's going. Your current question is vague at best.
__________________
UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things.
Reply With Quote
  #3   (View Single Post)  
Old 2nd April 2010
Oko's Avatar
Oko Oko is offline
Fsck Surgeon
 
Join Date: May 2008
Location: Kosovo, Serbia
Posts: 779
Thanked 36 Times in 32 Posts
Default

Quote:
Originally Posted by Carpetsmoker View Post
Division by zero is always wrong, no matter how long/large your integer is.
He is probably not dividing with a real zero. In 99.9% cases people run into
the problem of small divisors. If he can estimate a lower bound on his divisors increasing precision could help. I am just little bit puzzled that he claims to use only integer values. In that case divisor might be a honest zero and he will be screwed up.
Reply With Quote
Reply

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox/thunderbird take very long time (~45s) to start caesius FreeBSD Ports and Packages 4 28th November 2008 12:04 AM
Changing shell to bash rex FreeBSD General 13 29th August 2008 03:20 AM
pf tables how long values stored ijk FreeBSD Security 3 12th August 2008 11:45 AM
Is bash included in OpenBSD? bsdnewbie999 OpenBSD General 21 2nd August 2008 02:57 AM
Can't use bash on chroot'd openssh environment jploh FreeBSD General 2 18th June 2008 02:12 AM


All times are GMT. The time now is 02:28 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick