Connection Information

To perform the requested action, WordPress needs to access your web server. Please enter your FTP credentials to proceed. If you do not remember your credentials, you should contact your web host.

Connection Type

Truncate – PB Docs 125 – PowerBuilder Library

Truncate – PB Docs 125

Truncate PowerScript function

Description

Truncates a number to the specified number of decimal places.

Syntax

Argument

Description

x

The number you want to truncate.

n

The number of decimal places to which
you want to truncate x. Valid values are 0
through 28.

Return Values

Decimal. Returns the result of the truncation
if it succeeds and null if it fails or if any
argument is null.

note.png Using Truncate on a computed field

A real number loaded into a floating point register (used
for calculation) is represented as precisely as the binary storage
will permit. For example, the real number displayed as 2.07 is actually
stored as 2.06999999999999999999999997.

Truncating such a number may not give the expected result.
To avoid this problem, you can change the initial real datatype
to long, integer, or decimal, or you can append a constant in the
truncate argument: Truncate (x + 0.0000001, n )

Examples

This statement returns 9.2:

This statement returns 9.2:

This statement returns 9:

This statement returns –9.2:

See Also

  • Ceiling

  • Int

  • Round

  • Truncate method for
    DataWindows in the DataWindow Reference or online Help


Document get from Powerbuilder help
Thank you for watching.
Was this article helpful?
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x