Mega Code Archive

 
Categories / C / Code Snippets
 

Returns the next value after from that is closer to towards

//Declaration: float nexttowardf(float from, long double towards); double nexttoward(double from, long double towards); long double nexttowardl(long double from, long double towards); #include <math.h> #include <stdio.h> int main(void) { double f; f = nexttoward (4.3,3.2); printf("%f " , f); }