-The Show instances for RealFloat types provided in base are very elegant, as they produce the shortest string which 'read' converts back to the original number.

-That, however, involves a check after each digit has been determined and arithmetic of usually fairly large Integers, which makes these Show instances rather slow.

+The Show instances for RealFloat types provided in base are very elegant,

+as they produce the shortest string which 'read' converts back to the

+original number. That, however, involves a check after each digit has been

+determined and arithmetic of usually fairly large Integers, which makes these

+Show instances rather slow.

-For cases where having the conversion fast is more important than having it produce elegant output, this package provides alternative conversions, which avoid the checks and reduce the occurrences of large Integers by just producing a sufficiently long output string.

+For cases where having the conversion fast is more important than having it

+produce elegant output, this package provides alternative conversions, which

+avoid the checks and reduce the occurrences of large Integers by just producing

+a sufficiently long output string.

-The speed gain can be substantial if the numbers have exponents of large absolute modulus, but for the more common case of numbers whose exponents have small absolute modulus, the difference is (although still significant for Double) too small in my opinion to seriously consider replacing the Show instances.

+The speed gain can be substantial if the numbers have exponents of large

+absolute modulus, but for the more common case of numbers whose exponents

+have small absolute modulus, the difference is (although still significant

+for Double) too small in my opinion to seriously consider replacing the

-Some benchmarks produced with criterion (http://hackage.haskell.org/package/criterion) show a considerable speedup, or example, converting 10,000 numbers to String and calculating the length produced:

+Some benchmarks produced with criterion (http://hackage.haskell.org/package/criterion)

+show a considerable speedup, or example, converting 10,000 numbers to String

+and calculating the length produced:

------------------------------------------------------------------

benchmarking show @ Double

std dev: 827.6377 us, lb 248.5136 us, ub 1.466120 ms, ci 0.950

------------------------------------------------------------------

-The difference is far smaller however if we consider only numbers with exponents of small absolute modulus (numbers between 1e-8 and 1e8 here):

+The difference is far smaller however if we consider only numbers

+with exponents of small absolute modulus (numbers between 1e-8 and

------------------------------------------------------------------

benchmarking show @ Double

std dev: 509.0308 us, lb 199.9313 us, ub 1.099169 ms, ci 0.950

------------------------------------------------------------------

-Another benchmark, calculating d*sin(d^2) for d = 1, ..., 200000 and writing their string representations to a file, timed 'show' at 4.26s, 'fshow' at 1.08s and 'show' for the newtype wrapper Double7 (rounds to seven significant digits) around Double at 0.55s. A corresponding C programme ran in 0.26s with the default precision and in 0.32s with a precision of 17 digits.

+Another benchmark, calculating d*sin(d^2) for d = 1, ..., 200000

+and writing their string representations to a file, timed 'show'

+at 4.26s, 'fshow' at 1.08s and 'show' for the newtype wrapper

+Double7 (rounds to seven significant digits) around Double at 0.55s.

+A corresponding C programme ran in 0.26s with the default precision

+and in 0.32s with a precision of 17 digits.