#include "tensorstore/util/rational.h"
static Rational tensorstore::Rational<I>::FromDouble(double value);

Converts a floating-point number to a rational representation.

Non-finite and out-of-range values are converted to nan().

Values that cannot be represented exactly are rounded.

To obtain an approximation with a smaller denominator, call Approximate on the result of this function.