I am doing high precision scientific computations. In looking for the best representation of various effects, I keep coming up with reasons to want to get the next higher (
There are functions available for doing exactly that, but they can depend on what language you use. Two examples:
if you have access to a decent C99 math library, you can use nextafter (and its float and long double variants, nextafterf
and nextafterl
); or the nexttoward
family (which take a long double as second argument).
if you write Fortran, you have the nearest intrinsic available
If you can't access these directly from your language, you can also look at how they're implemented in freely available, such as this one.