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

Add documentation for UNCHANGED_ and ZERO_ #588

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jodavies
Copy link
Collaborator

This resolves #585

@jodavies
Copy link
Collaborator Author

I would like to add a test-case for this, but I don't think everything works quite as expected. Here, test3 becomes 0 in the 5th module, but the 6th module's print has test3 as both zero and unchanged, which is not correct.

#-

#procedure exprinfo
	#message Module `CMODULE_':
	#do e = {`activeexprnames_'}
		#if `ZERO_`e''
			#message zero `e': `ZERO_`e''
		#endif
		#if `UNCHANGED_`e''
			#message unchanged `e': `UNCHANGED_`e''
		#endif
	#enddo
	#if `ZERO_'
		#message All zero: `ZERO_'
	#endif
	#if `UNCHANGED_'
		#message All unchanged: `UNCHANGED_'
	#endif
	#message
#endprocedure


Off stats;

Symbol x,y;

Local test1 = x;
Local test2 = y;
Local test3 = 1;
.sort

#call exprinfo
Identify x = 0;
.sort

#call exprinfo
Identify y = 0;
.sort

#call exprinfo
.sort

#call exprinfo
Multiply 0;
.sort

#call exprinfo
Print;
.end

@coveralls
Copy link

Coverage Status

coverage: 50.338% (-0.02%) from 50.356%
when pulling 974c773 on jodavies:zero-unchanged
into fc829af on vermaseren:master.

@jodavies jodavies added this to the v4.3.2 milestone Dec 4, 2024
@jodavies
Copy link
Collaborator Author

Maybe it is OK that UNCHANGED_test3 is not correct in this instance. In general UNCHANGED is not hugely "reliable" anyway; Identify f(x?) = f(x); or Multiply 1;, etc etc all count as "changes" in this context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Checking that a local expression is zero
2 participants