Analog of C11 stdlib function nextafter?

I asked question on SO:

But because of asking about “what crate has suitable functionality” is not approapriate,
I am asking here,
is any crate around that provide functionality similar to nextafter function from stdlib:

I was gonna say you could just call the C stdlib functions themselves, but it looks like they’re not included in the libc crate :confused:.

So you could submit a PR to libc to add them, then call them (if you don’t mind using your own fork of libc while you wait for them to get merged/published).


Someone on SO linked you to (re-linking for those who may end up finding this thread when searching for a similar issue)

You could also temporarily keep a version of the function declaration in your project until it’s added to libc, here could be how:

1 Like

These are also relatively easy to implement yourself, using {to|from}_bits.

A starting demonstration:

this is not looks similar to real implementation:

many edge cases missed?

1 Like

It says “starting” for a reason. More obviously, the “demonstration” only has one parameter, not two.