function fx = p12_fx ( x )

%*****************************************************************************80
%
%% P12_FX evaluates Flat Stanley.
%
%  Licensing:
%
%    This code is distributed under the MIT license.
%
%  Modified:
%
%    31 March 2019
%
%  Author:
%
%    John Burkardt
%
%  Input:
%
%    real X(*), the point at which F is to be evaluated.
%
%  Output:
%
%    real FX(*), the value of the function at X.
%
  factor = 1000.0;

  i = find ( x == 1.0 );
  fx(i) = 0.0;
  j = find ( x ~= 1.0 );
  fx(j) = sign (  x(j) - 1.0 ) ...
    * exp ( log ( factor ) + log ( abs ( x(j) - 1.0 ) ) - 1.0 ./ ( x(j) - 1.0 ).^2 );

  return
end
