This is an implementation of the 2000b nutation algorithm as described in The IAU Resolutions on Astronomical Reference Systems, Time Scales, and Earth Rotation Models Explanation and Implementation (George H. Kaplan). I have tested it against the IAU SOFA routine iauNut00b(). A set of test data is available.
The terms are computed from least significant to most significant, to reduce any rounding errors. I have grouped the computations for each term into a single line for ease of truncation. If you wish to truncate the computation, start with the top lines and work down (since the least significant terms are at the top).