Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (24 sloc) 654 Bytes
{-# LANGUAGE CPP #-}
-- Module: Blaze.Text.Double
-- Copyright: (c) 2011 MailRank, Inc.
-- License: BSD3
-- Maintainer: Bryan O'Sullivan <bos@serpentine.com>
-- Stability: experimental
-- Portability: portable
--
-- Efficiently serialize a Double as a lazy 'L.ByteString'.
module Blaze.Text.Double
(
float
, double
) where
#ifdef NATIVE
import Blaze.Text.Double.Native
#else
import Blaze.ByteString.Builder (Builder, fromByteString)
import Data.Double.Conversion.ByteString (toShortest)
float :: Float -> Builder
float = double . realToFrac
double :: Double -> Builder
double f = fromByteString (toShortest f)
#endif
Jump to Line
Something went wrong with that request. Please try again.