Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Using the siunitx package

\usepackage{siunitx}

I am trying to put numbers with plenty of decimal digits in a table while rounding them to 3 digits after the decimal point. There is a compilation error saying ! Number too big.. I tried to change the expected digit amounts to a thousand, but this does not work:

\begin{table}
  \sisetup{
    table-number-alignment = center,
    table-figures-exponent = 1000,
    table-figures-integer = 1000,
    table-figures-uncertainty = 1000,
    table-figures-decimal = 1000,
    table-sign-mantissa,
    table-sign-exponent,
    table-auto-round
  }
  \begin{tabular}{
    S
    S
    S
    S
  }
  0.2 & 0.6903200460356393 & 0.625 & -6.532004603563935e-2 \\ 
  \end{tabular}
\end{table}

Is there a fix?

share|improve this question
1  
See tex.stackexchange.com/questions/37900/… and my comments there. (As you are the second person to raise this, I will move it up my 'to do' list a bit!) –  Joseph Wright Jan 19 '12 at 22:28
1  
[EDIT: Joseph did.] I suspect that Joseph Wright will chip in soon to explain what is going on more precisely. I think that the reason is that at some stage in the processing Siunitx uses floating points from l3fp, which currently only supports 9 (10?) digit numbers, and barfs when the decimal part has more digits than that (at an even lower level you have a TeX error: the decimal part is >2^{31}). I'm slowly working on an update to l3fp which would use more IEEE-854 compliant 16 digit mantissas and would simply round when the input has too many decimals. Not sure when that'll be done. –  Bruno Le Floch Jan 19 '12 at 22:32
    
@BrunoLeFloch Actually, the rounding code does not use l3fp (the calculation stuff for angles does, for obvious reasons). The issue with the rounding code is that I essentially need to do a 'big int' comparison rather than \int_compare:nNnTF in some places to allow completely arbitrary amounts of digits. –  Joseph Wright Jan 19 '12 at 22:35
    
@Joseph Actually, reading the comments you link to, I realize I'm wrong here. But would it make sense on the long term to use the rounding function from l3fp? That would restrict the mantissa to 16 digits, unfortunately, so not good for high-precision measurements of \alpha in a couple of years I guess. [Again, our comments crossed.] –  Bruno Le Floch Jan 19 '12 at 22:35
2  
A fix for this issue is in hand, and will be sent to CTAN once I have fully tested it (tomorrow). I notice that your input is not going to work, though, as you have misunderstood the way that table formatting works with siunitx. For example, table-figures-integer = 1000 reserves space for 1000 digits before the decimal place. I assume you want table-figures-integer = 4 for four digits, i.e. up to 9999.... –  Joseph Wright Jan 19 '12 at 22:45

1 Answer 1

up vote 5 down vote accepted

This is fixed in the latest siunitx release (try v2.4j or later), although your table-figures-exponent = 1000 will fail. Try

\documentclass{article}
\usepackage{siunitx}
\begin{document}
\begin{table}
  \sisetup{
    table-format = -1.3e-1,
    table-number-alignment = center,
    table-auto-round
  }
  \begin{tabular}{
    S
    S
    S
    S
  }
  0.2 & 0.6903200460356393 & 0.625 & -6.532004603563935e-2 \\ 
  \end{tabular}
\end{table}
\end{document}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.