#trunc(), #truncate()

DESCRIPTION
    returns a number as an integer with its fractional part (if any) chopped off
SYNOPSIS
    #trunc(n)
    #truncate(n)
ARGUMENTS
    n - a number, or numerical expression
EXAMPLES
# pikt +C 'output $text(#trunc(-3.75))'
-3

# pikt +C 'output $text(#trunc(-3.5))'
-3

# pikt +C 'output $text(#trunc(-3.25))'
-3

# pikt +C 'output $text(#trunc(3.25))'
3

# pikt +C 'output $text(#trunc(3.5))'
3

# pikt +C 'output $text(#trunc(3.75))'
3
isint(N)        // is (N) an integer?
                ( (N) == #trunc((N)) )
        rule    // if exceeds threshold, and at least one level higher
                // than before
                if    #la1 > 5.0
                   && #trunc(#la1) > #trunc(%la1)
                        output mail $trim($inline)
                        =toptop(20)
                endif
SEE ALSO
    #ceiling()
    #int(), #integer()
    #round()

    Numerical Functions
    String Functions
 
Home | FAQ | News | Intro | Samples | Tutorial | Reference | Software
Developer's Notes | Licensing | Authors | Pikt-Users | Pikt-Workers | Related Projects | Site Index | Privacy Policy | Contact Us
Page best viewed at 1024x768 or greater.   Page last updated 2008-09-06.   This site is PIKT® powered.
PIKT® is a registered trademark of the University of Chicago.   Copyright © 1998-2008 Robert Osterlund. All rights reserved.
Home FAQ News Intro Samples Tutorial Reference Software
PIKT Logo
PIKT Page Title
View sample
system files
disappear
Pikt script