Retorna o valor pelo fator de valor.

@param $fator
@param int $dec
@return float
160718
public static function valorPeloFator($fator, $dec = 2)
    {
        $div = pow(10, $dec);
        $base = intval(round($fator, 0));

        return $base / $div;
    }
691643
public static function valorExtenso($valor = 0, $maiusculas = false, $moeda = "R", $sexo = "M")
    {
        if ("R" === $moeda) {
            $decSing = "centavo";
            $decPlural = "centavos";
            $intSing = "real";
            $intPlural = "reais";
        } else {
            $decSing = "centésimo";
            $decPlural = "centésimos";
            $intSing = "";
            $intPlural = "";
        }

        $singular = array (
            $decSing,
            $intSing,
            "mil",
            "milhão",
            "bilhão",
            "trilhão",
            "quatrilhão"
        );
        $plural = array (
            $decPlural,
            $intPlural,
            "mil",
            "milhões",
            "bilhões",
            "trilhões",
            "quatrilhões"
        );

        $c = array (
            "",
            "cem",
            "duzentos",
            "trezentos",
            "quatrocentos",
            "quinhentos",
            "seiscentos",
            "setecentos",
            "oitocentos",
            "novecentos"
        );
        $d = array (
            "",
            "dez",
            "vinte",
            "trinta",
            "quarenta",
            "cinquenta",
            "sessenta",
            "setenta",
            "oitenta",
            "noventa");
        $d10 = array (
            "dez",
            "onze",
            "doze",
            "treze",
            "quatorze",
            "quinze",
            "dezesseis",
            "dezesete",
            "dezoito",
            "dezenove"
        );

        if ("M" === $sexo) {
            $u = array (
                "",
                "um",
                "dois",
                "três",
                "quatro",
                "cinco",
                "seis",
                "sete",
                "oito",
                "nove"
            );
        } else {
            $u = array (
                "",
                "uma",
                "duas",
                "três",
                "quatro",
                "cinco",
                "seis",
                "sete",
                "oito",
                "nove"
            );
        }

        $z = 0;
        $rt = "";

        $valor = number_format($valor, 2, ".", ".");
        $inteiro = explode(".", $valor);

        for ($i = 0; $i < count($inteiro); $i++) {
            for ($ii = strlen($inteiro[$i]); $ii < 3; $ii++) {
                $inteiro[$i] = "0".$inteiro[$i];
            }
        }

        $fim = count($inteiro) - ($inteiro[count($inteiro) -1] > 0 ? 1 : 2);
        for ($i = 0; $i < count($inteiro); $i++) {
            $valor = $inteiro[$i];
            $rc = (($valor > 100) && ($valor < 200)) ? "cento" : $c[$valor[0]];
            $rd = ($valor[1] < 2) ? "" : $d[$valor[1]];
            $ru = (0 < $valor) ? ((1 == $valor[1]) ? $d10[$valor[2]] : $u[$valor[2]]) : "";
            $r = $rc . (($rc && ($rd || $ru)) ? " e " : "") . $rd . (($rd && $ru) ? " e " : "") . $ru;
            $t = count($inteiro) -1 -$i;
            $r .= $r ? " " . ($valor > 1 ? $plural[$t] : $singular[$t]) : "";
            if ("000" == $valor) {
                $z++;
            } elseif ($z > 0) {
                $z--;
            }
            if ((1 == $t) && (0 < $z) && (0 < $inteiro[0])) $r .= ((1 < $z) ? " de " : "") . $plural[$t];
            if ($r) $rt = $rt . (((0 < $i) && ($i <= $fim) && (0 < $inteiro[0]) && (1 > $z)) ? ( ($i < $fim) ? ", " : " e ") : " ") . $r;
        }

        $rt = trim($rt);
        $rt = preg_replace('[  ]',' ', $rt);
        if (!$maiusculas) {
            return($rt ? $rt : "zero");
        } elseif ($rt) {
            $rt = preg_replace('[ E ]',' e ', ucwords($rt));
        }

        return (($rt) ? ($rt) : "Zero");
    }
742658
public function offsetCorrection($Value, $Mode)
    {
        $Value = round($Value, 1);

        if ($Value == 0 && $Mode != 1) {
            return 0;
        }

        if ($Mode == 1) {
            if ($Value == .5) {
                return .5;
            }
            if ($Value == .8) {
                return .6;
            }
            if (in_array($Value, [.4, .7])) {
                return .7;
            }
            if (in_array($Value, [.2, .3, .6])) {
                return .8;
            }
            if (in_array($Value, [0, 1, .1, .9])) {
                return .9;
            }
        }

        if ($Mode == 2) {
            if ($Value == .1) {
                return .1;
            }
            if ($Value == .2) {
                return .2;
            }
            if ($Value == .3) {
                return .3;
            }
            if ($Value == .4) {
                return .4;
            }
            if ($Value == .5) {
                return .5;
            }
            if ($Value == .7) {
                return .7;
            }
            if (in_array($Value, [.6, .8])) {
                return .8;
            }
            if (in_array($Value, [1, .9])) {
                return .9;
            }
        }

        if ($Mode == 3) {
            if (in_array($Value, [1, .1])) {
                return .1;
            }
            if ($Value == .2) {
                return .2;
            }
            if ($Value == .3) {
                return .3;
            }
            if (in_array($Value, [.4, .8])) {
                return .4;
            }
            if ($Value == .5) {
                return .9;
            }
            if ($Value == .6) {
                return .6;
            }
            if ($Value == .7) {
                return .7;
            }
            if ($Value == .9) {
                return .5;
            }
        }

        if ($Mode == 4) {
            if ($Value == 1) {
                return -1;
            }
            if (in_array($Value, [.1, .4, .7, .8, .9])) {
                return .1;
            }
            if ($Value == .2) {
                return .2;
            }
            if ($Value == .3) {
                return .3;
            }
            if ($Value == .5) {
                return -.1;
            }
            if ($Value == .6) {
                return .8;
            }
        }
    }
7729
public static function dec($key, $dec = 1) {
		return self::set ( $key, self::get ( $key, 0 ) - $dec );
	}
139988
final static function f($op) {return dfcf(function(OP $op) {
		$c = df_con_hier($m = df_ar(dfpm($op), M::class), __CLASS__); /** @var string $c */ /** @var M $m */
		return new $c($m);
	}, [dfp($op)]);}
1075349
public function Mul( $val )
	{
		$value = $val instanceof DecimalValue ? $val : Convert::ToDecimal( $val );
		return new DecimalValue( bcmul( $this->_value, $value->getValue(), $this->getScale() + $this->scale( $value ) ) );
	}
223013
public function GetDiscountValue()
    {
        $dValue = 0;
        $iTmpPointer = $this->getItemPointer();
        $this->GoToStart();
        while ($oDiscount = $this->Next()) {
            $dValue += $oDiscount->GetValue();
        }

        $this->setItemPointer($iTmpPointer);

        return $dValue;
    }
1136516
public function toDecimal($value, int $precision = 12): float
    {
        if (is_numeric($value) === false) {
            return 0.0;
        }

        return round((float) $value, $precision);
    }
813054
function(dec) {
         var r = parseInt(dec,10).toString(16);
         if (r.length == 1) r = "0"+r;
         return r;
      }
374534
public static function getRangeTime( $start, $end, $dec = 6 )
	{
		if( !isset( self::$info[$end] ) ){
			self::$info[$end] = microtime( true );
		}
		return number_format( (self::$info[$end] - self::$info[$start]), $dec );
	}
615967
protected function getComponent(float $value, float $scale): float
    {
        return ($scale < 0) ? ((1 - $value) * -$scale) : ($value * $scale);
    }
829331
public function dec($key) {
        $v = new DecimalValidator($this->shell->_unsafeVar[$key] ?? null, $this->shell);
        $v->_isUndefined = !array_key_exists($key, $this->shell->_unsafeVar);
        $this->shell->subValidators[$key] = $v;
        return $v;
    }
658041
public static function modulo11(
        $number,
        $ifTen = '0',
        $ifZero = '0',
        $returnFull = false,
        $maxFactor = 9,
        $separator = '-'
    ) {
        $numLen = strlen($number) - 1;
        $sum = 0;
        $factor = 2;

        for ($i = $numLen; $i >= 0; $i--) {
            $sum += substr($number, $i, 1) * $factor;
            $factor = $factor >= $maxFactor ? 2 : $factor + 1;
        }
        #Resto da divisão
        $rest = ($sum * 10) % 11;
        #ifTen
        $rest = $rest == 10 ? $ifTen : $rest;
        #ifZero
        $rest = $rest === 0 ? $ifZero : $rest;
        #Verificando se é 0, 10
        switch ($rest) {
            case 10:
                $ifTen;
                break;
            case 0:
                $ifZero;
                break;
            default:
                $rest;
                break;
        }

        if ($returnFull === false) {
            return $rest;
        } else {
            return $number . $separator . $rest;
        }
    }
158250
public static function converterBytes($valor)
    {
        $capacidade = (float) $valor;
        
        if ($capacidade >= 1099511627776) {
            $capacidade = sprintf('%.2f TB', $capacidade / 1099511627776);
        } elseif ($capacidade >= 1073741824) {
            $capacidade = sprintf('%.2f GB', $capacidade / 1073741824);
        } elseif ($capacidade >= 1048576) {
            $capacidade = sprintf('%.2f MB', $capacidade / 1048576);
        } elseif ($capacidade >= 1024) {
            $capacidade = sprintf('%.2f KB', $capacidade / 1024);
        } else {
            $capacidade = sprintf('%.2f B', $capacidade);
        }

        return $capacidade;
    }
1078746
public function format($decimals = 2, $decPoint = '.', $thousandSep = ',')
    {
        return number_format($this->value, $decimals, $decPoint, $thousandSep);
    }
1331105
public function divide($divisor, $roundingMode = self::ROUND_HALF_UP, $precision = self::PRECISION_GAAP)
    {
        $this->assertRoundingMode($roundingMode);
        $divisor = $this->castOperand($divisor);
        $precision = $this->castPrecision($precision);

        $innerPrecision = $this->getInnerPrecision();
        if ($divisor->isZero($innerPrecision)) {
            throw new Exception\InvalidArgumentException('Division by zero');
        }

        $amount = $this->amount->div($divisor, $innerPrecision + 1);

        if (null === $roundingMode) {
            $amount = $amount->round($precision);
        } else {
            $amount = Math::bcround($amount, $precision, $roundingMode);
        }

        return $this->newInstance($amount);
    }
1206244
public static function float($value=0, bool $flatten=false) {
		ref\cast::float($value, $flatten);
		return $value;
	}