# fivezeros macro in qrcode.sty

The qrcode.sty package is used for printing QR codes. It includes the following lines 1148-1155:

\def\qr@Ni{3}%
\def\qr@Nii{3}%
\def\qr@Niii{40}%
\def\qr@Niv{10}%
\def\qr@fiveones{11111}%
\def\qr@fivezeros{11111}%
\def\qr@twoones{11}%
\def\qr@twozeros{00}%


Why is \def\qr@fivezeros{11111} here? More logical is \def\qr@fivezeros{00000}. It seems like misspelling. But, why the package works well? If I replace this macro to \def\qr@fivezeros{00000}then the qrcode works well too (on a few codes I have tested) but it prints to the log another partial results about penalties. It says that the change of this macro does another internal calculation of the QR code.

• I agree it looks like a mistake in the code, but I don't really understand what that part of the code does either. Probably the best person to answer is the package author Anders Hendrickson, you can find his e-mail address in the readme file of qrcode. If he answers then of course it would be nice if you report back here (or ask him to write an answer on the site). May 8, 2020 at 7:19
• I am interested too. I am discovered this mistake when I re-implemented the qrcode package to my new OpTeX. And I simply corrected this to \def\.fivezeros{00000} and I hope that the results will be better than in the original qrcode.sty. May 8, 2020 at 8:15

\def\qr@fivezeros{11111} certainly looks like a bug, but let's look why the package work before and after changing it:
The macro \qr@fivezeros is only used in determining if there are problems with a mask, so changing the macro only affects the mask selection. Given that it is only one of many factors in the mask selection code it often doesn't really make a difference and even if it does, it "only" leads to the selection of a sub-optimal mask. While this might make your code a bit less reliable, it doesn't make it wrong or unreadable.