Sponsored Content
Top Forums UNIX for Advanced & Expert Users byte swapping 32-bit float and weird od results Post 302317759 by fpmurphy on Wednesday 20th of May 2009 12:55:07 AM
Old 05-20-2009
On the 64-bit platform, what format are the floating point numbers? Double precision (64-bit) IEEE 754 binary floating-point numbers? Single precision (32-bit) binary IEEE 754 floating-point numbers? Are they in standard IEEE 754 interchange format or some form of custom arithmetic format? Binary or decimal format?

In other words, first you need to figure out exactly what format was used to represent the floating points numbers.

If you provide more information we can probably help you.
 

8 More Discussions You Might Find Interesting

1. Programming

math.h: float ceilf(float x)

Good morning, I'm testing the use of ceilf: /*Filename: str.c*/ #include <stdio.h> #include <math.h> int main (void) { float ceilf(float x); int dev=3, result=0; float tmp = 3.444f; printf("Result: %f\n",ceilf(tmp)); return 0; } (1 Reply)
Discussion started by: jonas.gabriel
1 Replies

2. Shell Programming and Scripting

Check if 2 files are identical byte-to-byte?

In my server migration requirement, I need to compare if one file on old server is exactly the same as the corresponding file on the new server. For diff and comm, the inputs need to be sorted. But I do not want to disturb the content of the file and need to find byte-to-byte match. Please... (4 Replies)
Discussion started by: krishmaths
4 Replies

3. Shell Programming and Scripting

Remove a byte(Last byte from the last line)

Hi All Can anyone please suggest me how to remove the last byte from a falt file .This is from the last line's last BYTE. Please suggest me something. Thank's and regards Vinay (1 Reply)
Discussion started by: vinayrao
1 Replies

4. Programming

Weird timing results in C

I was running some timings in my code to see which of several functions was the best and I've been getting some odd results. Here's the code I'm using: static double time_loop(int (*foo)(int)) { clock_t start, end; int n = 0, i = 0; start = clock(); for (; i <= MAXN; i++) if... (6 Replies)
Discussion started by: CRGreathouse
6 Replies

5. UNIX for Dummies Questions & Answers

Byte to BIT conversion

I have a varchar column which contains the data at ‘bit' level.the data needs to be extract / transform at bit level and this will contain a Boolean value - 0/1. How can we handle using shell scripts At source level(DB2 Database) we have a column of length 250 char ie varchar(250) so each char... (2 Replies)
Discussion started by: Codesearcher
2 Replies

6. Shell Programming and Scripting

Converting String To Integer/Float (weird case)

Hi guys, I'm new here. I have a problem at work. One of our scripts was eventually having a bug and only detected recently. Here's the issue and background: Bash Script which calls AWK script Awk script returns a string as per below (example):var1='00000-123'So, when we convert it, the... (18 Replies)
Discussion started by: sekfarok
18 Replies

7. UNIX for Beginners Questions & Answers

Weird 'find' results

Hello and thanks in advance for any help anyone can offer me I'm trying to learn the find command and thought I was understanding it... Apparently I was wrong. I was doing compound searches and I started getting weird results with the -size test. I was trying to do a search on a 1G file owned by... (14 Replies)
Discussion started by: bodisha
14 Replies

8. Windows & DOS: Issues & Discussions

Which version of Windows Vista to install with a product key? 32-bit or 64-bit?

Hello everyone. I bought a dell laptop (XPS M1330) online which came without a hard drive. There is a Windows Vista Ultimate OEMAct sticker with product key at the bottom case. I checked dell website (here) for this model and it says this model supports both 32 and 64-bit version of Windows... (4 Replies)
Discussion started by: milhan
4 Replies
ieee(3m)																  ieee(3m)

Name
       copysign, drem, finite, logb, scalb - copysign, remainder, exponent manipulations

Syntax
       #include <math.h>

       double copysign(x,y)
       double x,y;

       double drem(x,y)
       double x,y;

       int finite(x)
       double x;

       double logb(x)
       double x;

       double scalb(x,n)
       double x;
       int n;

Description
       These functions are required, or recommended by the IEEE standard 754 for floating-point arithmetic.

       The function returns x with its sign changed to y's.

       The function returns the remainder r := x - n*y where n is the integer nearest the exact value of x/y.  Additionally if |n-x/y|=1/2, then n
       is even.  Consequently the remainder is computed exactly and |r| <= |y|/2.  Note that is the exception (see Diagnostics).

       Finite(x) = 1 just when -infinity < x < +infinity,
		 = 0 otherwise (when |x| = infinity or x is NaN)

       The a signed integer converted to double-precision floating-point and so chosen that 1 <= |x|/2**n < 2 unless x = 0 or |x| = infinity or  x
       lies between 0 and the Underflow Threshold.

       Scalb(x,n) = x*(2**n) computed, for integer n, without first computing 2**N.

Diagnostics
       IEEE 754 defines drem(x,0) and drem(infinity,y) to be invalid operations that produce a NaN.

       IEEE 754 defines logb(+-infinity) = +infinity and logb(0) = -infinity, requires the latter to signal Division-by-Zero.

Restrictions
       IEEE 754 currently specifies that logb(denormalized no.) = logb(tiniest normalized no. > 0) but the consensus has changed to the specifica-
       tion in the new proposed IEEE standard p854, namely that logb(x) satisfy
	      1 <= scalb(|x|,-logb(x)) < Radix	 ... = 2 for IEEE 754
       for every x except 0, infinity and NaN.	Almost every program that assumes 754's specification will work correctly if  logb  follows  854's
       specification instead.

       IEEE 754 requires copysign(x,NaN) = +-x	but says nothing else about the sign of a NaN.

See Also
       floor(3M), fp_class(3), math(3M)

								       RISC								  ieee(3m)
All times are GMT -4. The time now is 11:57 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy