I’ve recently been adding DWScript snippets to Rosetta Code, using them as unit tests as well.
Quite a few of Rosetta Code’s tasks consist in mathematical tasks, and I was wondering, how many math tests do you really need?
Well, quite a few! While implementing the Lucas-Lehmer test, it ended up hitting the precision boundary quite sooner than it should theoretically had, given that DWScript’s Integer is actually a 64bit integer.
Some investigations in the CPU view later turned out that the Delphi compiler did not generate the proper CPU instructions for Sqr() in the case of integers, which DWS was relying upon. Apparently this has been QC’ed many times since Delphi 5, but still exists to this day in Delphi XE. The issue is now worked around in the SVN.
Fixed for XE2? Let’s hope, there may still be time…