Verified Commit 267bec0a authored by Houtan Bastani's avatar Houtan Bastani
Browse files

add comments about rounding

parent 79d4b888
Pipeline #674 failed with stage
in 36 seconds
...@@ -37,6 +37,7 @@ precision = 10^precision; ...@@ -37,6 +37,7 @@ precision = 10^precision;
data = setDataToZeroFromZeroTol(o, data); data = setDataToZeroFromZeroTol(o, data);
for i=1:size(data,1) for i=1:size(data,1)
fprintf(fid, '&'); fprintf(fid, '&');
% Use round half away from zero rounding
output = round(data(i)*precision)/precision; output = round(data(i)*precision)/precision;
if isnan(output) if isnan(output)
fprintf(fid, '%s', o.tableNaNSymb); fprintf(fid, '%s', o.tableNaNSymb);
......
...@@ -99,6 +99,7 @@ for i = 1:nrows ...@@ -99,6 +99,7 @@ for i = 1:nrows
if val < o.zeroTol && val > -o.zeroTol if val < o.zeroTol && val > -o.zeroTol
val = 0; val = 0;
end end
% Use round half away from zero rounding
val = round(val*rounding)/rounding; val = round(val*rounding)/rounding;
if isnan(val) if isnan(val)
val = o.tableNaNSymb; val = o.tableNaNSymb;
......
...@@ -15,7 +15,7 @@ function o = printSeries(o, fid, dser, dates, precision) ...@@ -15,7 +15,7 @@ function o = printSeries(o, fid, dser, dates, precision)
% SPECIAL REQUIREMENTS % SPECIAL REQUIREMENTS
% none % none
% Copyright (C) 2014-2016 Dynare Team % Copyright (C) 2014-2019 Dynare Team
% %
% This file is part of Dynare. % This file is part of Dynare.
% %
...@@ -47,7 +47,7 @@ for i=1:size(data,1) ...@@ -47,7 +47,7 @@ for i=1:size(data,1)
end end
fprintf(fid, '['); fprintf(fid, '[');
end end
% Use round half away from zero rounding
output = round(data(i)*precision)/precision; output = round(data(i)*precision)/precision;
if isnan(output) if isnan(output)
fprintf(fid, '%s', o.tableNaNSymb); fprintf(fid, '%s', o.tableNaNSymb);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment