
#14384: real numbers, digits after the decimal point - digits of precision -------------------------------------+------------------------------------- Reporter: vanto | Owner: (none) Type: feature request | Status: closed Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by hsyl20): * status: new => closed * resolution: => invalid Comment: The feature already exists. {{{#!haskell {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleInstances #-} import Text.Printf class MyPrint a where myshow :: a -> IO () default myshow :: Show a => a -> IO () myshow = print instance MyPrint [Char] instance MyPrint Int instance MyPrint Double where myshow d = printf "%.11e\n" d }}} {{{
:load MyPrint.hs [1 of 1] Compiling Main ( MyPrint.hs, interpreted ) Ok, 1 module loaded. :set -interactive-print myshow (16.0/0.00002)**2.1 2.49166110385e12 }}}
-- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14384#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler