Its formula is ([Singles] + [Doubles x 2] + [Triples x 3] + [Home Runs x 4])/[At Bats]
At bats are different than plate appearances.
An equivalent formula is ([Hits] + [Doubles] + [Triples x 2] + [Home Runs x 3])/At Bats
This formula is not as intuitive, but is often more convenient, as singles are often not given (although they could easily be deduced). Singles can be figured fom the following equation because they are simply hits that are not for extra bases: (Hits - [Doubles + Triples + Home Runs])
There is also an Adjusted statistic called SLG+, which adjusts the slugging percentage to account for the ballpark and the league that the player played in. In addition, the number is "normalized", so that the median is 100, with better-than-average scores above 100. The formula is SLG+ = 100*(SLG/lgSLG), with lgSLG representing the league average for that year.