std::hexfloat and std::defaultfloat not found

How come std::hexfloat and std::defaultfloat cannot be found. I get the error that no member can be found with both clang and g++. My g++ is on version 4.9.2 and clang is on 3.5.0. And I tried with both c++11 and c++1y.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <cmath>

int main()
{
	std::cout << "default format: " << 100 * std::sqrt(2.0) << '\n'
		<< "scientific " << std::scientific << 100 * std::sqrt(2.0) << '\n'
		<< "fixed_decimal " << std::fixed << 100 * std::sqrt(2.0) << '\n'
		<< "hexadecimal " << std::hexfloat << 100 * std::sqrt(2.0) << '\n'
		<< "use default: " << std::defaultfloat << 100 * std::sqrt(2.0) << std::endl;

	return 0;
}


Did the compilers drop support for these functions?
Last edited on
Well it seems like my version of the compiler doesn't support it. Will have to upgrade to 5.2.0

Coliru is using gcc version 5.2.0
> My g++ is on version 4.9.2 and clang is on 3.5.0

Update to g++ 5.1 or above, clang++ 3.6.0 or above.
http://coliru.stacked-crooked.com/a/4120c2a4fbd8f16c

std::hexfloat and std::defaultfloat are declared in header <ios>
Typically use: #include <iostream> The standard specifies that <iostream> must include <ios>
@JLBorges

Cheers for the reply buddy. I will update both clang and g++.
Topic archived. No new replies allowed.