Start Info Community Spielen
 
 

Morgengrauner Dokumentation

Dateipfad: /home/mud/mudlib/doc//efun/to_int

SYNOPSIS
        int to_int(string)
        int to_int(float)
        int to_int(int)
        int to_int(closure)

        (int)

DESCRIPTION
        Floats are truncated to integer values, strings with leadings
        digits are converted to integers up to the first non-digit.
        lfun-closures are converted into their function index (not adjusted
        for inheritance), variable closure are converted into their variable
        index.
        Integers are just returned.

        Regarding floats, it is important to keep rounding effects
        in mind: to_int(3.1*10.0) does not return 31, but instead 30,
        because internally the result of the multiplication is 30.999999.

        The function supports the '0x', '0o' and '0b' base prefixes.

BUGS
        The cast notation only works if the precise type of 
        is known at compile-time. This will not be fixed - use the
        function form instead.

HISTORY
        Introduced in 3.2.1@2.
        LDMud 3.2.11/3.3.611 added support for the base prefixes.

SEE ALSO
        to_string(E), sscanf(E)


zurück zur Übersicht

YOUTUBE | FACEBOOK | TWITTER | DISCORD | FEEDBACK | IMPRESSUM | DATENSCHUTZ 1992–2023 © MorgenGrauen.