LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 03-06-2007, 06:18 PM   #1
vijraj
LQ Newbie
 
Registered: Oct 2006
Posts: 14

Rep: Reputation: 0
floating point number


Hi all!
I have a question about floating point numbers.
How should I find out the smallest float >0.I was suggested to use a loop until I reach the smallest possible float(representable float)>0.
How should I find the infinity for float.Can anyone give suggestions?
I know that the representation for infinity internally is
0/1 11111111 0000000000000000000000
1bit 8bits 23 bits
Thanks in advance
 
Old 03-07-2007, 09:30 AM   #2
kaz2100
Senior Member
 
Registered: Apr 2005
Location: Penguin land, with apple, no gates
Distribution: SlackWare > Debian testing woody(32) sarge etch lenny squeeze(+64) wheezy .. bullseye bookworm
Posts: 1,832

Rep: Reputation: 108Reputation: 108
Hya,

You did not post what system your penguin is, (hardware and software) neither language (BASIC, Pascal, PL/1, PL/I, fortran, BCPL, CPL, B, Modula, Algol, prolog, LISP, COBOL, Ada, Forth...) The answer varies depending...

If you are using C, these values are defined in float.h
If you are using LISP, usually precision is infinite.
In some languages, there is not such a thing like float.

Happy Penguins!

Last edited by kaz2100; 03-09-2007 at 11:34 AM.
 
Old 03-07-2007, 04:17 PM   #3
Quigi
Member
 
Registered: Mar 2003
Location: Cambridge, MA, USA
Distribution: Ubuntu (Dapper and Heron)
Posts: 377

Rep: Reputation: 31
This sounds like a homework assignment.
Maybe look at /usr/include/ieee754.h
You can probably do it by hand. Hint: 0.1 = 1/2 * 3/15
 
  


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
floating-point in script mitsos Programming 6 08-31-2006 07:14 AM
Floating Point in kernel 2.4.28 lucs Slackware 1 10-19-2005 08:33 AM
Floating point exception hemk76 Linux - Software 1 05-06-2005 11:49 PM
floating point multiplication irfanhab Programming 0 12-23-2004 10:13 PM
managing floating point vince_2x Linux - General 2 09-21-2004 09:05 PM

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

All times are GMT -5. The time now is 08:36 AM.

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