////
/// @author Takeru Suzuki
////

/// Returns a two-element list containing the normalized fraction and exponent of number.
/// @since 1.12.0 - The Sith
/// @param {Number} $x
/// @return {List} fraction, exponent
@function frexp($x) {
	$exp: 0;

	@if $x < 0 {
		$x: $x * -1;
	}
	@if $x < .5 {
		@while $x < .5 {
			$x: $x * 2;
			$exp: $exp - 1;
		}
	} @else if $x >= 1 {
		@while $x >= 1 {
			$x: $x / 2;
			$exp: $exp + 1;
		}
	}

	@return $x, $exp;
}
