Sponsored Content
Top Forums Programming C programming - Urgent help required Post 19209 by AtleRamsli on Monday 8th of April 2002 07:36:38 AM
Old 04-08-2002
If you suspect that your variable may overflow, then I suggest you assume it will.
In programming, Murphy's law is a law of nature :-)
In this case, it would state that 'if a variable _can_ overflow, then there is a 100% chance that it _will_ overflow'

I do not know the actual implementation of floating point under Solaris or other 64 bit OSes, but it would make sense to assume that they are 64 bits in length. This is quite easy to find out, so I assume you will if you don't already know.

Before reading any of this, look for a bignum library, that may have what you need.


If a double is stored in 64 bits, then you could overcome the problem by creating your own 128bit bigfloat

struct bigfloat {
long m; // Mantissa
long e; // Exponent
};

and define the operations you need on bigfloat:

bigfloat bigfloat_add(bigfloat a, bigfloat b)

etc.

This is only one of several approaches, another is to not use float at all, but BCD or even arbitrary length strings.

I don't know what it is that you want to do, if it is some scientific experiment, then just disregard the rest of this.

But in certain applications the use of floating point is illegal!

If I am not mistaken these include safety-critical applications and accounting systems.
 

10 More Discussions You Might Find Interesting

1. Programming

Urgent help required with uname()

Hello, I am doing a program in C on UNIX Platform. I am required to make it display the Machine Name, OS name and OS Release version using uname. Now I went through the man pages and found out that uname can be implemented using - #include <sys/utsname.h> int uname (name) struct... (2 Replies)
Discussion started by: rm1
2 Replies

2. Shell Programming and Scripting

Very Urgent help required in Shell Program

How do I Ftp, and rename multiple files in one unix script. I have to send it with .tmp extension , then rename it to .txt after FTP is done . I need to do a Mass rename of more than 1 file in a shell script , Urgent help required. (1 Reply)
Discussion started by: Suppandi
1 Replies

3. UNIX for Dummies Questions & Answers

Urgent Help required

Hi UNIX Gurus, I have got the following requirement and totally :confused: how to proceed. A file is dummy.lst is there in the following format:-- ID NAME TYPE_ID -------- --------- ----------- 1947 Asia ... (1 Reply)
Discussion started by: rahul26
1 Replies

4. Shell Programming and Scripting

Urgent help required

I have a text file, with a fixed format of certain data. I have to extract certain fields of data. Then store it in a structure. Is it possible to use shell commands by making a system call from a C PROGRAM and then store the extracted data in the structure (which has been declared in the C... (1 Reply)
Discussion started by: umanglalani
1 Replies

5. AIX

Urgent : Help required

Hi all, Could you please give me the command to know which is the default block size for a file on AIX ? Thank a lot ! :b: (2 Replies)
Discussion started by: V3l0
2 Replies

6. UNIX for Dummies Questions & Answers

Help required on Shell Programming!

I have a file named "file1" with contents as shown below: name(abc) age(123) empid(a123) degree(graduate) . . . . Now suppose I know that the format of my file is as above but I don't know the contents within () ie. as if the file to me is like this name(???),... (7 Replies)
Discussion started by: udiptya
7 Replies

7. Shell Programming and Scripting

URGENT SCRIPT LOGIC required

Hello friends, It will be great if we found some way to check this our: we have some databases (teradata and oracle). our applications(in java on weblogic) are using connection pools of these databases. we have a pair of userID and password for every pool. If we have any logic to test... (2 Replies)
Discussion started by: NIMISH AGARWAL
2 Replies

8. Shell Programming and Scripting

Interview Questions Required... Very urgent..

Hello everybody... I am a Faculty trainer in Unix working in a firm. Actually i needed around 800-1000 Linux related questions (Unix Commands,Shell Scripting,Unix Administration)... Can anyone help me... (1 Reply)
Discussion started by: mraghunandanan
1 Replies

9. UNIX for Dummies Questions & Answers

Urgent Help Required ! Please Help

HI All , Pardon me for asking some very basic questions, I would be grateful if someone can help. I am trying to execute a shell script which runs multiple processes in background. It includes various operations like copying , DB operations etc etc. Now problem is that the complete... (1 Reply)
Discussion started by: gpta_varun
1 Replies

10. UNIX for Advanced & Expert Users

Expertise advice required <<URGENT>>

:eek:i hav a shell script in my linux server, i want to execute it everyday once automatically without using cron tabs as i dont hav permission to create one. So wht sld i do??:confused: (1 Reply)
Discussion started by: Jay Thakkar
1 Replies
ilogbd64(3M)															      ilogbd64(3M)

NAME
ilogbd64(), ilogbd128(), ilogbd32() - decimal exponent functions SYNOPSIS
DESCRIPTION
The function computes the exponent of the floating point value x. Formally, the return value is the integral part of log base 10 of |x| as a signed integer value, for nonzero x. If x is subnormal, it is treated as though it were normalized, before the exponent is determined. is equivalent to for all values of x is a version of it takes a argument. is a version of it takes a argument. These math functions are supported for HP-UX 11i Version 3 September 2008 Update and forward. USAGE
To use any of these functions, compile with the option. Make sure your program defines and then includes Link in the math library by specifying or on the linking command line. For more information, see the at the following site: RETURN VALUE
If x returns and raises the invalid floating-point exception. If x is zero, returns and raises the invalid floating-point exception. If x is NaN, returns and raises the invalid floating-point exception. ERRORS
If x is NaN, sets to If x is zero or infinite, sets to SEE ALSO
frexpd64(3M), logbd64(3M), scalbnd64(3M), scalblnd64(3M), math(5). STANDARDS CONFORMANCE
These functions conform to ISO/IEC TR 24732, "Extension for the programming language C to support decimal floating-point arithmetic". HP Integrity Server Only ilogbd64(3M)
All times are GMT -4. The time now is 05:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy