Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various FLOAT->STRING problems with SetFixed(TRUE) and SetDigitFixed(TRUE) #321

Open
cpyrgas opened this issue Feb 6, 2020 · 3 comments
Assignees

Comments

@cpyrgas
Copy link

cpyrgas commented Feb 6, 2020

All following are old incompatibilities with VO:

FUNCTION Start() AS VOID
	SetDecimalSep(Asc(".")) 
	SetThousandSep(Asc(",")) 
	SetDecimal(3)
	SetDigit(12)
	SetFixed(TRUE)
	SetDigitFixed(TRUE)
	
	? Transform(12.34, "9.99") // "1..3", "*.**" in VO
	? Val("1234567890")  // "1234567890.000", "1234567890" in VO
	? Val("- 123456789") // "-123456789.000", "-123456789" in VO
	? AsString(Val(" - 123.4567")) // "-123.457", "-123.4567" in VO
	? Str(Val("12345678901234567890"),22,-1)  // "12345678901234567000.0", "  12345678901234567000" in VO
	? Str(Val("-12345678901234567890"),22,-1) // "-12345678901234567000.", " -12345678901234567000" in VO
	? AsString(Val(" 0X80000000")) // "2147483648.000", "2147483648" in VO
RETURN
@cpyrgas
Copy link
Author

cpyrgas commented Apr 18, 2020

Fix breaks other areas of num to string conversions, so will be temporarily rolled back. Note from Robert:

I remember from the VO runtime source that Ntrim disables the SetFixed for the duration of the Ntrim function. That is why I did that too and it solved most of the problems.
I also remember that there is code in the VO runtime that handles "significant" decimals which removed the trailing zero's from decimals in a number including the decimal dot if that is the last character in the string.

@cpyrgas cpyrgas reopened this Apr 18, 2020
cpyrgas pushed a commit that referenced this issue Apr 18, 2020
@RobertvanderHulst
Copy link
Member

Unit test METHOD ValTests_fixed() AS VOID fails when activated. So there is still something wrong. Most likely in the TransForm function and not in the Val() functions

@cpyrgas
Copy link
Author

cpyrgas commented Aug 6, 2020

Robert, yeah, I had reverted the fix for this, because it was causing other problems. I will look into a proper fix. Btw, those issues were found by myself while testing stuff, not reported by a user.

@RobertvanderHulst RobertvanderHulst removed this from the March 2020 milestone Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants