---
name: "nexttowardf"
section: "3"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["linux", "freebsd"]
url: "https://new.carta.tech/nextafter"
---

# nexttowardf(3)

next representable value

Part of [nextafter(3)](/nextafter/3.md).

## NAME

**nextafter**, **nextafterf**, **nextafterl**, **nexttoward**, **nexttowardf**, **nexttowardl** – next representable value

## LIBRARY

Math Library (libm, -lm)

## 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

These functions return the next machine representable number from *x* in direction *y*.

## SEE ALSO

[ieee(3)](/ieee/3.md), [math(3)](/math/3.md)

## STANDARDS

The **nextafter**(), **nextafterf**(), **nextafterl**(), **nexttoward**(), **nexttowardf**(), and **nexttowardl**() routines conform to ISO/IEC 9899:1999 (“ISO C99”). They implement the Nextafter function recommended by IEEE Std 754-1985, with the extension that **nextafter**(*+0.0*, *-0.0*) returns -0.0, and **nextafter**(*-0.0*, *+0.0*) returns +0.0.

## HISTORY

The **nextafter**() function appeared in 4.3BSD, and **nextafterf**() appeared in FreeBSD 2.0.
