Skip to content

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

coveralls commented Nov 25, 2024

Coverage Status

coverage: 48.455% (-0.03%) from 48.483%
when pulling 4c8d47e on jodavies:zero-unchanged
into 1e8e3da 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.

jodavies added 2 commits May 23, 2025 16:35
Currently, UNCHANGED_ is not always "correct", for example when an expression
becomes zero due to Multiply 0;
@jodavies jodavies merged commit 0de812d into form-dev:master May 23, 2025
58 checks passed
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