math.frexp

From GMod Wiki

Jump to: navigation, search
Function
Syntax math.frexp( Number value )
Where is this used?
Description:
The math.frexp() function is used to split the number value into a normalized fraction and an exponent. Two values are returned: the first is a fractional value always in the range 0.5 (inclusive) to 1 (exclusive) and the second is an exponent.
Returns: Number fractional, Number exponent
Part of Library: Math
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Math.frexp]Math.frexp [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionThis function returns two values, these make up the original number using the equation
local Original = fractional * (2 ^ exponent)
Used onNewerShared.png
Code
f, e = math.frexp(3.1415927)
print(f)
print(e)
Output0.785398175
2


Additional Notes

See Also

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox