Division algorithm: Difference between revisions

Content deleted Content added
m cleanup somewhat, fmt
m turn code's 2 ifs into a single if-else
Line 32:
q[n-(i+1)] := 1
P[i+1] := TP[i+1]
'''end ifelse'''
'''if''' TP[i+1] ≤ 0
q[n-(i+1)] := 0
P[i+1] := TP[i+1] + D
Line 48 ⟶ 47:
i := 0
'''while''' i < n '''do'''
'''if''' P[i] >=&ge; 0 '''then'''
q[n-(i+1)] := 1
P[i+1] := 2*P[i] - D
'''end ifelse'''
'''if''' P[i] < 0 '''then'''
q[n-(i+1)] := -1
P[i+1] := 2*P[i] + D