Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

nextafter(3) [redhat man page]

NEXTAFTER(3)							libc math functions						      NEXTAFTER(3)

NAME
nextafter, nexttoward - floating point number manipulation SYNOPSIS
#include <math.h> double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y); double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); DESCRIPTION
The nextafter() functions return the next representable neighbor of x in the direction towards y. The size of the step between x and the result depends on the type of the result. If x = y the function simply returns y. If either value is NaN, then NaN is returned. Other- wise a value corresponding to the value of the least significant bit in the mantissa is added or subtracted, depending on the direction. The nexttoward() functions do the same as the nextafter() functions, except that they have a long double second argument. These functions will signal overflow or underflow if the result goes outside of the range of normalized numbers. CONFORMING TO
C99. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854). SEE ALSO
nearbyint(3) GNU
2002-08-10 NEXTAFTER(3)

Check Out this Related Man Page

NEXTAFTER(3)							libc math functions						      NEXTAFTER(3)

NAME
nextafter, nexttoward - floating point number manipulation SYNOPSIS
#include <math.h> double nextafter(double x, double y); float nextafterf(float x, float y); long double nextafterl(long double x, long double y); double nexttoward(double x, long double y); float nexttowardf(float x, long double y); long double nexttowardl(long double x, long double y); DESCRIPTION
The nextafter() functions return the next representable neighbor of x in the direction towards y. The size of the step between x and the result depends on the type of the result. If x = y the function simply returns y. If either value is NaN, then NaN is returned. Other- wise a value corresponding to the value of the least significant bit in the mantissa is added or subtracted, depending on the direction. The nexttoward() functions do the same as the nextafter() functions, except that they have a long double second argument. These functions will signal overflow or underflow if the result goes outside of the range of normalized numbers. CONFORMING TO
C99. This function is defined in IEC 559 (and the appendix with recommended functions in IEEE 754/IEEE 854). SEE ALSO
nearbyint(3) GNU
2002-08-10 NEXTAFTER(3)
Man Page

14 More Discussions You Might Find Interesting

1. Programming

a simple fundamental

long double p; long double q; how could i find and store the sum of p & q ? where p and q might have their maximum value. i hope, i'd get a lot of solutions. :) -sham (4 Replies)
Discussion started by: shamal
4 Replies

2. Programming

long doubles

hey there, i've been trrying to calculate the first 10000 fibonacci numbers using a long double. weird thing is that from a certain value it returns Inf. i'm declaring the vars as long double var; and printing them to a file using: fprintf(filepointer, "%.0Ld\n", var); am i doing... (1 Reply)
Discussion started by: crashnburn
1 Replies

3. Programming

some math problems in C

I want to calculate secant method using C language That is a program----> #include<stdio.h> #include<math.h> #include<stdlib.h> main() { double fx(double x); double x0,x1,x2,f0,f1,f2,err; int n,i; printf("\n\n f(x) =x*x*x-5*x-7"); printf("\n\nEnter an interval in" ... (4 Replies)
Discussion started by: cdfd123
4 Replies

4. Programming

Pointer to a struct (with pointers) *** glibc detected *** double free

I am using a structure defined as follows struct gene_square { double *x; double *y; };I have class, with a member function which is a pointer of this type: gene_square* m_Genes;I am allocating memory in the constructors like this: m_Genes = new gene_square; for (ii=0;... (1 Reply)
Discussion started by: jatoo
1 Replies

5. Programming

getting double to be converted

got a problem. i have to get A to + 20.70 but i keep getting A + 20 in my logic below. anyone can guide me on where i go wrong? i understand it is a double, but i do not noe how to parse it to the function so that it can read in as 20.70 instead of just 20.. i highlighted the problem part... (1 Reply)
Discussion started by: xiaojesus
1 Replies

6. Programming

C: why decimals considered double by default ?

Can anybody tell me why any literal constant real numbers are double by default in C ? Why is the default not float ? (2 Replies)
Discussion started by: limmer
2 Replies

7. Programming

Internal representation of double

I came across a puzzle which I can not explain. The setup is SCO OpenServer 5.7 (32 bit OS) and native SCO compiler. double is 8 bytes long on this system. I am able to populate the double variable with two different sets of values that produces the same double value, please see below: #include... (7 Replies)
Discussion started by: migurus
7 Replies

8. Shell Programming and Scripting

Rules with using double parentheses in Bash

Hi.could you explain me what are the rules when we are using double parentesis in if statement,if I put ,the code is working ,with (( is not #!/bin/bash if (($# > 0)) then if ((! -d "$1")) then echo "Directory $1 not found" fi else echo Problem fi (8 Replies)
Discussion started by: lio123
8 Replies

9. Shell Programming and Scripting

Replace double double quotes using AWK/SED

Hi, I have data as "01/22/97-"aaaaaaaaaaaaaaaaa""aaa""aabbbbbbbbcccccc""zbcd""dddddddddeeeeeeeeefffffff" I want to remove only the Consequitive double quotes and not the one which occurs single. My O/P must be ... (2 Replies)
Discussion started by: Bhuvaneswari
2 Replies

10. Shell Programming and Scripting

How to convert a string into double in UNIX

I have a file where i have the start and end timings of jobs. (Odd line will have start and even will have end) Say File "X.txt" has two lines as below 1333553619.647 1333553620.859 I have used the following bit of code, to fetch the values from the file. even=`sed -n '2p' X.txt'`... (7 Replies)
Discussion started by: kalidass
7 Replies

11. Programming

double pointer allocation

hi guys how can I allocate a double char pointer? I want an array of pointers to char objects. the objects the double pointer points to are : char b; (1 Reply)
Discussion started by: vlm
1 Replies

12. Programming

Changing double to character string in C++

I want to convert an double to a character string. I done the integer and float ones using itoa and ftoa. How can I do a similar thing with doubles? String::String ( const float f ) { char *cdata = ftoa (f); strcpy (STR, cdata.c_str ()); } String::String ( const double ... (1 Reply)
Discussion started by: kristinu
1 Replies

13. Shell Programming and Scripting

Perl double splits

I have a perl script that I was cleaning up, it works very well, but I was wondering if anyone knows of a better way to double split. Sample file: Move_VALIDATE,020212191ABC01,SNSNT---01CAB101A-1-1-4-20 Move_VALIDATE,030323202ABC01,SNSNT01CAB101A-1-1-4-20 Section in script: foreach my... (1 Reply)
Discussion started by: numele
1 Replies

14. Shell Programming and Scripting

sed to add word if pattern exists

Hi, I have a file with data listed below: clm_id double, cnl_id double, cnl_amt double I want output to be clm_id string, cnl_id string, cnl_amt double So replace double by string if the field contains the word _id I tried sed -e 's/_id/& string/' filename The above will not... (2 Replies)
Discussion started by: wahi80
2 Replies