function s=eosben07_s(p,r,th)
%EOSBEN07_S Salinity.
%   EOSBEN07_S(P, R, TH) computes the salinity [g kg-1] at pressure, P
%   [dbar], density, R [kg m-3], and potential temperature (referenced
%   to 0 dbar), TH [degC].

eosben07_const

a=a16-a26*r;
b=a13-a23*r+(a15-a25*r).*th+(b13-b23*r).*p;
c=a11-a21*r+(b11-b21*r).*p+(a12-a22*r+(a14-a24*r).*th+(b12-b22*r).*p).*th;

s=(-b+sqrt(b.*b-4*a.*c))./(2*a);
