For liquids heavier than water SG=[145/(145-Baume)]. For liquids lighter than water SG=[140/(130+Buame)].
API uses the formula SG=[141.5/(Buame+131.5)].
I assume you are using the formula found in the third edition of API 653 (2001), Section B.2.2.4 part e.
The equation works by manipulating the variables to increase or decrease the period, amplitude, and origin of the sine curve (fitting the curve). You can set a=0, b=1, and c=0, and then...