SourceForge has been redesigned. Learn more.
Close

Diff of /@mp/private/getmaxprec.m [000000] .. [471bfe]  Maximize  Restore

Switch to side-by-side view

--- a
+++ b/@mp/private/getmaxprec.m
@@ -0,0 +1,26 @@
+function [precision, varargout] =  getmaxprec(varargin)
+
+  %# function [precision, varargout] =  getmaxprec(varargin) given a
+  %# list of values, returns the maximum precision and a list where
+  %# all elements are converted to mp at the highest precision.
+
+  precision = int32 (0); 
+
+  for ii = (1:numel (varargin))
+    varargin{ii};
+    if (isa (ans, 'mp'))
+      precision = max ([precision, max(getPrecs (ans(:)))]);
+    end
+  end 
+  
+  if (0 == precision)  
+    mp_defaults 
+    precision = default_precision;
+  end
+
+  if (nargout > 1) %# convert each value to the highest precision
+    varargout = cellfun (@(x) mp (x, precision), varargin, ...
+			 'UniformOutput',false);
+  end
+
+end