absl::HighPrecision

Converts a float to a string which, if passed to absl::SimpleAtof, would produce the exact same original floating point value (except in case of NaN; all NaNs are considered the same value).

Synopsis

Declared in <absl/strings/str_cat.h>

/* implementation-defined */
HighPrecision(float f);

Description

Tries to keep the string short but it's not guaranteed to be as short as possible. HighPrecision is considerably slower than the default formatting, so only use it if you need the string to convert back to the same floating-point value.

Return Value

A buffer holding the round-trippable string representation.

Parameters

NameDescription
fThe floating point value to convert.