PrevUpHomeNext

utx::sqrt


utx::sqrt

utx::sqrt calculates the square root of a real value. The parameter passed to utx::sqrt can be any real type (utx::real_meric), but the returned result is always floating type. If the parameter is negative, it returns NaN value (utx::nan_v result).

Calling Sig :

constexpr auto result = utx::sqrt(value);
constexpr auto result = utx::sqrt.fn<return_type>(value);

utx::sqrt(value) :

utx::sqrt.fn<return_type>(value) :

Header

#include <utxcpp/math.hpp>

c++ example

#include <utxcpp/core.hpp>
#include <utxcpp/math.hpp>

int main()
{
	constexpr auto a = utx::sqrt(3);
	constexpr auto b = utx::sqrt(3.4);
	constexpr auto c = utx::sqrt(utx::ix32{2});
	constexpr auto d = utx::sqrt(utx::fx32{2.8});
	constexpr auto e = utx::sqrt(-7);

	utx::print(a,b,c,d,e);
/*output:
1.732051 1.843909 1.414214 1.673320 nan
*/

	static_assert(utx::is_nan(e));
}

See Also

utx::print

utx::i32

utx::ix32


PrevUpHomeNext

E

U