I don't event know what should it be

I know I would like to use something like this \format{0.00016493240} and get the output like 1.649324\cdot10^{-4}.
Is there something I could use?
NEW: TikZ book now 40% off at Amazon.com for a short time.
There are several packages providing such functionality. Take a look at numprint, siunitx and pgf/TikZ and see if any of them suits your needs. PGF even comes with math engine, so you can use it for some simple calculations.one_eddie wrote:I know I would like to use something like this \format{0.00016493240} and get the output like 1.649324\cdot10^{-4}.
Is there something I could use?
Code: Select all
\documentclass{article}\usepackage{fp,siunitx}\newcommand{\format}[2][5]{% format #2 rounding the mantissa to #1 digits (5 by default)\FPln\ExpX{#2}%\FPln\lnTen{10}%\FPdiv\ExpX\ExpX\lnTen%\FPifpos\ExpX% #2 is a number >=1\FPtrunc\ExpX\ExpX{0}%\FPpow\MantX{10}{\ExpX}%\FPdiv\MantX{#2}\MantX%\FPround\MantX\MantX{#1}%\else% #2 is a number between 0 and 1\FPadd\ExpX\ExpX{-1}%\FPtrunc\ExpX\ExpX{0}%\FPneg\nExpX\ExpX%\FPpow\MantX{10}{\nExpX}%\FPmul\MantX{#2}\MantX%\FPround\MantX\MantX{#1}%\fi%\num[expproduct=cdot]{\MantX e\ExpX}}\newcommand{\printexample}[1]{\num{#1} = \format{#1}\par}\begin{document}\printexample{1234567.89}\printexample{123456.789}\printexample{12345.6789}\printexample{1234.56789}\printexample{123.456789}\printexample{12.3456789}\printexample{1.23456789}\printexample{0.123456789}\printexample{0.0123456789}\printexample{0.00123456789}\printexample{0.000123456789}\printexample{0.0000123456789}\end{document}
NEW: TikZ book now 40% off at Amazon.com for a short time.