SetDigit Function (DWord) | |
Return and optionally change the setting that determines the number of digits that will be shown to the left of the decimal point when a number is displayed.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION SetDigit(
nNewSetting AS DWORD
) AS DWORD
public static uint SetDigit(
uint nNewSetting
)
Request Example
View SourceParameters
- nNewSetting
- Type: DWord
The number of digits to show.
The initial default is 10.
A negative value indicates that only the significant whole digits to the left of the decimal point (the mantissa) are returned.
Any right padding is also suppressed.
Return Value
Type:
DWord
If
nNewSetting is not specified, SetDigit() returns the current setting.
If
nNewSetting is specified, the previous setting is returned.
Remarks
SetDigit() and SetDigitFixed() can be used together to control the way digits are displayed:
When SetDigitFixed() is TRUE, display of numeric output is fixed according to the SetDigit() value.
When SetDigitFixed() is FALSE, numeric output displays according to the default rules for numeric display.
To provide finer control of numeric display, you can use the PICTURE clause of @...SAY, @...GET, and the Transform() function.
A -1 for
nNewSetting implies that only significant whole digits to the left of the decimal are to be displayed (any leading zeros will be suppressed.)
Tip |
---|
SetDigit() affects only the display format of numbers, not the actual numeric precision of calculations.
|
Examples
This example shows typical uses of SetDigit():
1FUNCTION Start()
2 LOCAL nSaveDigit AS SHORTINT
3 ? 1234
4
5
6
7 nSaveDigit := SetDigit(5)
8 ? 1234
9 ? 1234.567
10 ? 123456
11 SetDigit(nSaveDigit)
12 ? 1234
13 RETURN TRUE
See Also