xsharp.eu • Inconsistent STR() evaluation when decimal not specified
Page 1 of 1

Inconsistent STR() evaluation when decimal not specified

Posted: Sat May 06, 2023 12:32 am
by RolWil
Hello everyone;
I believe the STR() function in XSharp yields different results from Clipper when the decimal is not coded (which, although legit is certainly lazy
coding ...) and SET DECIMAL and / or SET FIXED have not been specified:



Harbour Clipper:

Code: Select all

Str(123.456,10)    -> "       123"
Str(123.456,10,0)  -> "       123"
XSharp – Harbour)

Code: Select all

Str(123.456,10)    -> "    123.46"
Str(123.456,10,0)  -> "       123"

Inconsistent STR() evaluation when decimal not specified

Posted: Sat May 06, 2023 6:39 am
by Chris
Hi Roland,

So, if you set in the beginning of the app

SetDecimal(0)

does it now yield the expected results for Harbour? If yes, I think we can make it automatically execute this setting for the Harbour dialect (the current behavior is compatible to Visual Objects)

Inconsistent STR() evaluation when decimal not specified

Posted: Sat May 06, 2023 11:21 am
by RolWil
Hi Chris,

yes, when I had added SetDecimal(0), all worked fine.

Interesting that the default behavior between Clipper and VO was different.

Cheers.