BG MVC Model View Controller eğitim serisi yayında...

Ana sayfa > Programlama > C Programlama > C standart kütüphanesi > <math.h> > nextafter

nextafter() fonksiyonu

Bildirim

double nextafter(double x, double y); (C99)

float nextafterf(float x, float y); (C99)

long double nextafterl(long double x, long double y); (C99)

double nexttoward(double x, double y); (C99)

float nexttowardf(float x, float y); (C99)

long double nexttowardl(long double x, long double y); (C99)

Açıklama

Kendisine geçirilen x parametre değerinden y parametre değerine doğru ilk float değeri geri döndürür.

Parametreler

x: Float bir değerdir.

y: Float bir değerdir.

Dönüş değeri

Eğer bir hata meydana gelmezse, x parametre değerinden y parametre değerine doğru ilk float değer geri döndürülür.

Örnek


#include <stdio.h>
#include <fenv.h>

int main(void)
{
    double x=42.21, y=51.63;

    printf("%.2f ile %.2f değerleri arasındaki ilk float değer: %.20f", x, y, nextafter(x, y));

    return 0;
}

Yukarıdaki örnekte, program aşağıdaki satırı ekrana yazar:

42.21 ile 51.63 değerleri arasındaki ilk float değer: 42.21000000000000800000

Yukarıdaki program, nextafter() fonksiyonu ile elde edilen işlem sonuçlarını ekrana yazar.