Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
2øªjÛ ã @ sp d Z ddlZddlZddlZejeƒZddddgZdd„ Zdd„ Z e fd d„Z
e fd
d„Zeee
dœdd
„ZdS )z#
Various round-to-integer helpers.
é NÚnoRoundÚotRoundÚ
maybeRoundÚ roundFuncc C s | S )N© )Úvaluer r ú>/tmp/pip-build-_d5lkt3n/fonttools/fontTools/misc/roundTools.pyr s c C s t tj| d ƒƒS )aÝ Round float value to nearest integer towards ``+Infinity``.
The OpenType spec (in the section on `"normalization" of OpenType Font Variations `_)
defines the required method for converting floating point values to
fixed-point. In particular it specifies the following rounding strategy:
for fractional values of 0.5 and higher, take the next higher integer;
for other fractional values, truncate.
This function rounds the floating-point value according to this strategy
in preparation for conversion to fixed-point.
Args:
value (float): The input floating-point value.
Returns
float: The rounded value.
g à?)ÚintÚmathÚfloor)r r r r r s c C s || ƒ}t || ƒ|kr|S | S )N)Úabs)ÚvÚ toleranceÚroundZroundedr r r r , s c C s8 | dk rt dƒ‚| dkrtS | dkr(|S tjt| |d�S )Nr z#Rounding tolerance must be positiveg à?)r r )Ú
ValueErrorr Ú functoolsÚpartialr )r r r r r r 0 s )r ÚfactorÚreturnc C sÒ | sdS t | | ƒ| } d| }| | }| | }t|ƒt|ƒkrPttt| ƒƒƒS d}|| }|| }t|ƒt|ƒkr|||ks€t‚x&tt|ƒƒD ]}|| || krŽP qŽW |jdƒ}||k s¾t‚d|| }|| S )a" Round to nearest multiple of factor and return shortest decimal representation.
This chooses the float that is closer to a multiple of the given factor while
having the shortest decimal representation (the least number of fractional decimal
digits).
For example, given the following:
>>> nearestMultipleShortestRepr(-0.61883544921875, 1.0/(1<<14))
'-0.61884'
Useful when you need to serialize or print a fixed-point number (or multiples
thereof, such as F2Dot14 fractions of 180 degrees in COLRv1 PaintRotate) in
a human-readable form.
Args:
value (value): The value to be rounded and serialized.
factor (float): The value which the result is a close multiple of.
Returns:
str: A compact string representation of the value.
z0.0g à?z%.8fÚ.z%%.%df) r r ÚstrÚfloatr ÚlenÚAssertionErrorÚrangeÚfind)r r ÚepsÚloÚhiÚfmtÚiZperiodr r r ÚnearestMultipleShortestRepr= s&