!set methtit2=Divide an inequality by a non-zero number
!set methtit=Divide an inequality by a number
!set methenv=ZZ QQ RR
!set methparmtype=number,parm inequality
!set methhelp=This method transforms an inequality of type \(A > B)\
 into the equivalent inequality \(A/n > B/n) (or \(A/n < B/n)),\
 where \(n) is a non-zero number.

!if $wims_read_parm iswordof form check
  !goto $wims_read_parm
!endif

!exit
:form
 Divide the inequality
!read deduc/methparm.phtml 2
 by a number
!read deduc/methparm.phtml 1,10

!exit
:check
!distribute items $methparmobj2 into data,left,sign,right
!ifval $methparm1=0
  error=Division by zero!
  !advance penalty
  !exit
!endif
methexp=Divide \($left $sign $right) by \($methparm1)

!read deduc/sub/simplify ($left) / ($methparm1)\
	($right) / ($methparm1)
!distribute lines $out into newleft, newright
!if $newleft=$empty or $newright=$empty
  error=bad_data
  !exit
!endif
!if $methparm1<0
  newsign=!translate internal <> to >< in $sign
!else
  newsign=$sign
!endif
newobject2=$newleft $newsign $newright
oldobject=2

contextlist=$ct_Onlywhen the divisor is non-zero,\
	$ct_Onlywhen the divisor is positive,\
	$ct_Always,\
	$ct_Onlywhen the two sides are positive,\
	$ct_Onlywhen the two sides are of the same sign,\
	$ct_Onlywhen the inequality is strict

badsign=!translate internal <> to >< in $newsign
 resultlist=$newobject2,\
	$newright $newsign $newleft,\
	$newleft $badsign $newright

!exit
