从流Hex Float中读取

Ard*_*sen 5 c++ floating-point hex istream

我正在尝试通过读取十六进制浮点值std::cin。但是,它只是读入0。到目前为止,这是我的代码:

#include <iomanip>
#include <iostream>

int main() {
  double f = 0.0;
  std::cout << ">";
  std::cin >> std::hexfloat >> f;
  std::cout << "Entered: " << f << std::endl;
  return 0;
}
Run Code Online (Sandbox Code Playgroud)

这将导致:

>0x1.921fb5p+1
Entered:0.0
Run Code Online (Sandbox Code Playgroud)

或者,如果我排除了0x

>1.921fb5p+1
Entered:1.921
Run Code Online (Sandbox Code Playgroud)

我正在使用g ++ 7.0.1并-std=c++11在Ubuntu 17上添加编译器标志。