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

division problem in macro #1641

Open
jbertram1957 opened this issue Nov 25, 2024 · 5 comments
Open

division problem in macro #1641

jbertram1957 opened this issue Nov 25, 2024 · 5 comments

Comments

@jbertram1957
Copy link

if executed in a macro, this results in 1, not in 1,67

?&("10/6")

@cpyrgas
Copy link

cpyrgas commented Nov 25, 2024

Confirmed, I think we need to enable compatible integer divisions in the macro compiler, at lest by default. VO always gives a floating point result, no matter of the setting for the application.

@jbertram1957
Copy link
Author

jbertram1957 commented Nov 25, 2024 via email

@RobertvanderHulst
Copy link
Member

JB,
To support this we need to persist the compiler option in the compiled app. We are doing that already at this moment for the compiler options /VO11 and /VO13. However, we are not doing that for /VO12 (Clipper compatible integer divisions).
Btw if you code does not use literals:

PRIVATE Var1, Var2
Var1 := 10
Var2 := 6

Then the expression
?&("Var1/Var2")
will be a division of 2 usual variables and that already automatically returns a floating point result.
This will also happen when one of the 2 values is a literal and the other is a usual.

@jbertram1957
Copy link
Author

jbertram1957 commented Nov 25, 2024 via email

@cpyrgas
Copy link

cpyrgas commented Nov 28, 2024

Similar problem exists also with the = operator, as discussed in the online meeting today:

#pragma options (allowoldstyleassignments, on)
GLOBAL ggg AS INT

FUNCTION Start() AS VOID
Evaluate(" ggg := 1")
? ggg // 1, OK
ggg = 2
? ggg // 2, OK
Evaluate(" ggg = 3")
? ggg //  2, wrong

I will review also other compiler options for similar problems

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

4 participants