function Gibbs_energy_t_exact = gsw_Gibbs_energy_t_exact(SA,t,p)

% gsw_Gibbs_energy_t_exact                         Gibbs energy of seawater
%==========================================================================
%
% USAGE:
%  Gibbs_energy_t_exact = gsw_Gibbs_energy_t_exact(SA,t,p)
%
% DESCRIPTION:
%  Calculates the Gibbs energy of seawater. 
%
% INPUT:
%  SA  =  Absolute Salinity                                        [ g/kg ]
%  t   =  in-situ temperature (ITS-90)                            [ deg C ]
%  p   =  sea pressure                                             [ dbar ]
%         ( i.e. absolute pressure - 10.1325 dbar ) 
%
%  SA & t need to have the same dimensions.
%  p may have dimensions 1x1 or Mx1 or 1xN or MxN, where SA & t are MxN.
%
% OUTPUT:
%  Gibbs_energy_t_exact = Gibbs energy                             [ J/kg ]
%
% AUTHOR: 
%  Paul Barker and Trevor McDougall                    [ help@teos-10.org ]
%      
% VERSION NUMBER: 3.06.12 (25th May, 2020)
%
% REFERENCES:
%  IOC, SCOR and IAPSO, 2010: The international thermodynamic equation of 
%   seawater - 2010: Calculation and use of thermodynamic properties.  
%   Intergovernmental Oceanographic Commission, Manuals and Guides No. 56,
%   UNESCO (English), 196 pp.  Available from http://www.TEOS-10.org
%    See section 2.13 of this TEOS-10 Manual.
%
%  The software is available from http://www.TEOS-10.org
%
%==========================================================================

%--------------------------------------------------------------------------
% Check variables and resize if necessary
%--------------------------------------------------------------------------

if ~(nargin==3)
   error('gsw_Gibbs_energy_t_exact:  Requires three inputs')
end 

sz_SA = size(SA);
sz_t = size(t);

if sum(sz_SA - sz_t) ~= 0 
    error('gsw_Gibbs_energy_t_exact: SA and t must have same dimensions')
end 

p = gsw_resize(p,sz_SA);

%--------------------------------------------------------------------------
% Start of the calculation
%--------------------------------------------------------------------------

Gibbs_energy_t_exact = gsw_gibbs(0,0,0,SA,t,p);

end