help mata floatround()
-------------------------------------------------------------------------------
Title
[M-5] floatround() -- Round to float precision
Syntax
real matrix floatround(real matrix x)
Description
floatround(x) returns x rounded to IEEE 4-byte real (float) precision.
floatround() is the element-by-element equivalent of Stata's float()
function. The Mata function could not be named float() because the word
float is reserved in Mata.
Remarks
: printf(" %21x\n", .1)
+1.999999999999aX-004
: printf(" %21x\n", floatround(.1))
+1.99999a0000000X-004
Conformability
floatround(x):
x: r x c
result: r x c
Diagnostics
floatround(x) returns missing (.) if x < -1.fffffeX+7e (approximately
-1.70141173319e+38) or x > 1.fffffeX+7e (approximately
1.70141173319e+38).
By contrast with most functions, floatround(x) returns the same kind of
missing value if x contains missing; . if x==., .a if x==.a, .b if x==.b,
..., and .z if x==.z.
Source code
Function is built in.
Also see
Manual: [M-5] floatround()
Help: [M-4] utility