Hello,

I am typesetting a table with pgfplotstable and stumbling over some
weird rounding mistakes, seemingly on the part of pgfplotstable. Any
help is appreciated.

I am calculating some "energy" that should converge to the correct value
at some specific "level" (see example below). In order to asses this
convergence I calculate the absolute difference between the "energy" on
this specific "level" against the "energy" on current one "level".
I notice some weird rounding mistakes in the table values that I cannot
explain: The "diff" value of "level" 6 should read (at least) 1.e-5 not
2e-5, if not even -313.3008711--313.3008819 = 1.08e-5.

I am using pgf version 2.10-cvs and updated to pgfplots 2012/08/23
v1.6.1 (git show 1.6.1 ) (downloaded today from sourceforge), both
version numbers are taken directly from the pdflatex log.

On a further note: I searched the (excellent) manual, stumbling over
/pgfkeys{/pgf/fpu=true}. However, as the fpu is always activated when
using "expr" this does not seem to be the issue?

Here is the minimum example (sorry for the messy table creations but I
don't want to bother you with files, it's the same result anyway):
======================= SNIP ===========================
\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

\begin{document}

Here is a minimum example:
% just create a list of example values
\pgfplotstableset{
        create on use/a/.style={create col/set list={1,2,3,4,5,6,7}},
        create on use/b/.style={create col/set
list={-321.4430756,-313.2926882,-313.3037961,-313.3012453,-313.3008931,-313.3008819,-313.3008711}},
}
% create the table
\pgfplotstablenew[columns={a,b}]{7}\supertable
% get the minimum value from level "7" (index starts at 0)
\pgfplotstablegetelem{6}{b}\of\supertable
\let\amin=\pgfplotsretval
% prepare creation of one more row "diff" that is the absolute
difference between the minimum value and the current one
\pgfplotstableset{
        create on use/diff/.style={
                create col/expr={
                        abs(\amin-\thisrow{b})
                }
        },
}
% create the complete table with the difference column
\pgfplotstablenew[columns={a,b,diff}]{7}\moresupertable
% print the table
\pgfplotstabletypeset[
        columns={a,b,diff},%
        columns/a/.style={
                column name={level},
                precision=6,
        },
        columns/b/.style={
                column name={energy},
                precision=6,
        },
        columns/diff/.style={
                column name={diff},
                precision=6,
        },
]{\moresupertable}

\end{document}

======================= SNIP ===========================

Regards and thanks,

Frederik
-- 
Dipl.Phys. Frederik Heber
Wegelerstrasse 6/5.011, 53115 Bonn
Tel.: +49 228 73 3866
(Arbeitsgruppe Prof. Dr. M. Griebel)

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Pgfplots-features mailing list
Pgfplots-features@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pgfplots-features

Reply via email to