Inconsistent STR() evaluation when decimal not specified

We encourage new members to introduce themselves here. Get to know one another and share your interests.
Post Reply
RolWil
Posts: 68
Joined: Mon Jul 18, 2022 3:16 am

Inconsistent STR() evaluation when decimal not specified

Post 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"
User avatar
Chris
Posts: 4665
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Inconsistent STR() evaluation when decimal not specified

Post 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)
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
RolWil
Posts: 68
Joined: Mon Jul 18, 2022 3:16 am

Inconsistent STR() evaluation when decimal not specified

Post 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.
Post Reply