Okay, heres the deal, You have gotten mostly good info and some wrong info.

A guard rail in an industrial application requires ( Where Kids are not allowed ) needs to be a minimum 42" which means 41-15/16 fails so go 42-1/4" to be safe.

In a factory type setting you need a top rail, a mid rail and a 4" tall toe plate, keep in mind in addition you may not have a opening greater than 21" between the top rail and the mid rail or the space between the mid rail and the toe plate.

In a commercial setting like the mall, school or apartment complex which is consider to be ( Multi family dwelling ) You are required to have a rail which is at least 42" tall without a space for a 4" sphear to fit through ( Sphear meaning no openings that a 4" ball will fit through.)

Residential code which is a single family dwelling allows for the guards to have a minimum height of 36" tall.

When going down stairs in a commercial setting you need a 42" min. guard rail measured off the stair nosing with no openings greater than 4" ( However, you are also required to have a grab rail that is not higher that 38" but not lower than 34" measured off the stair nosing vertically, I put my top of rail at 35" off the stair nosing. ) There is one exception to this rule, If you have stairs that does not have a stringer on the side and you have a triangulated area below the railing you are allowed for a opening not larger for a 6" sphear.

These are Michigan codes which are some of the strictest, My guess is that you will be safe using these requirements However I strongly urge you to check with your local building officials.

I just went on vacation to Kentucky and the motel we stayed at would not have passed our Michigan codes in many ways ( However most of my work is done in Ann Arbor, MI and they are very strict.