[go: up one dir, main page]

0% found this document useful (0 votes)
529 views2 pages

Delphi Basics - Trunc Command

The Trunc function returns the integer part of a floating point number as an Integer value. It provides an example of using Trunc with other related functions like Round, Int, and Frac on a number and displays the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
529 views2 pages

Delphi Basics - Trunc Command

The Trunc function returns the integer part of a floating point number as an Integer value. It provides an example of using Trunc with other related functions like Round, Int, and Frac on a number and displays the results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

2/10/2015 DelphiBasics:Trunccommand

DelphiBasics ContactNeiltoadvertisehere

Trunc Theintegerpartofafloatingpointnumber Systemunit


Function

functionTrunc(constNumber:Extended):Integer


Description Examplecode:Asimpleexample

TheTruncfunctionreturnstheintegerpartofafloatingpoint begin
number. ShowMessage('Round(12.75)='+IntToStr(Round(12.75)))
ShowMessage('Trunc(12.75)='+IntToStr(Trunc(12.75)))
ItreturnsthispartasanIntegervalue.
ShowMessage('Int(12.75)='+FloatToStr(Int(12.75)))
ShowMessage('Frac(12.75)='+FloatToStr(Frac(12.75)))
Notes end
Showfullunitcode
TheIntfunctiondoesthesame,butreturnstheintegerina
floatingpointvalue.
Round(12.75)=13
Trunc(12.75)=12
Relatedcommands Int(12.75)=12
Frac(12.75)=0.75
Frac Thefractionalpartofafloatingpointnumber
Int Theintegerpartofafloatingpointnumberasafloat
Round Roundsafloatingpointnumbertoaninteger

DownloadthiswebsiteasaWindowsprogram.

http://www.delphibasics.co.uk/RTL.asp?Name=Trunc 1/2
2/10/2015 DelphiBasics:Trunccommand

DelphiProgrammingNeilMoffatt20022015.Allrightsreserved.|Contacttheauthor|HomePage

http://www.delphibasics.co.uk/RTL.asp?Name=Trunc 2/2

You might also like