I am stuck on a "Dimension too large" problem which is occurring here in this code:
\documentclass{article}
\usepackage{colortbl,dcolumn}
\def\a#1{%
\ifdim#1pt>2000pt\cellcolor{green}\else
\ifdim#1pt<1000pt\cellcolor{red}\else
\cellcolor{yellow}\fi\fi
#1}
\def\b#1{%
\ifdim#1pt>1000000pt\cellcolor{green}\else
\ifdim#1pt<500pt\cellcolor{red}\else
\cellcolor{yellow}\fi\fi
#1}
\begin{document}
\begin{tabular}{|c|c|}
\a{500} & \b{500} \\
\a{1000} & \b{100} \\
\a{300} & \b{1500} \\
\a{150} & \b{600} \\
\end{tabular}
\end{document}
Actually I want to color each cell in each column according to its value and when I put the range upper than some threshold it gives me this error. I found that tex dimension is limited to some extent,but Is there any alternative way to do the same functionality or solving this problem ?

TeXdimensions are restricted to a maximum value of16383pt, which means about 5.72 meter... I doubt, that you really need a dimension of 1000000pt, which is about 35km ;-) – Aug 11 '16 at 09:36\ifnum, which allows 2^31 - 1 as maximum values, see my answer here: http://tex.stackexchange.com/questions/270535/what-is-the-maximum-integer-that-can-be-saved-in-a-latex-counter/270536#270536 – Aug 11 '16 at 09:43\ayou break latex's accent handling – David Carlisle Aug 11 '16 at 10:05