scientific-notation-0.1.2.0: Scientific notation intended for tokenization

Safe HaskellNone
LanguageHaskell2010

Data.Number.Scientific

Contents

Synopsis

Documentation

data Scientific Source #

Instances
Eq Scientific Source # 
Instance details

Defined in Data.Number.Scientific

Show Scientific Source # 
Instance details

Defined in Data.Number.Scientific

type Scientific# = (#Int#, Int#, LargeScientific#) Source #

Produce

small Source #

Arguments

:: Int

Coefficient

-> Int

Exponent

-> Scientific 

Construct a Scientific from a coefficient and exponent that fit in a machine word.

large Source #

Arguments

:: Integer

Coefficient

-> Integer

Exponent

-> Scientific 

Construct a Scientific from a coefficient and exponent of arbitrary size.

fromFixed :: HasResolution e => Fixed e -> Scientific Source #

Construct a Scientific from a fixed-precision number. This does not perform well and is only included for convenience.

Consume

withExposed Source #

Arguments

:: (Int -> Int -> a)

Called when coefficient and exponent are small

-> (Integer -> Integer -> a)

Called when coefficient and exponent are large

-> Scientific 
-> a 

Expose the non-normalized exponent and coefficient.

Decode

parserSignedUtf8Bytes :: e -> Parser e s Scientific Source #

Parse a number that is encoded in UTF-8 and in scientific notation. All of these are accepted:

  • 330e-1
  • 330e+1
  • 330e1
  • 330.0e1
  • -330.0e1
  • 12
  • 00012
  • 2.05
  • +2.05
  • +33.6e+1

parserTrailingUtf8Bytes Source #

Arguments

:: e

Error message

-> Int

Leading digit, should be between -9 and 9.

-> Parser e s Scientific 

parserUnsignedUtf8Bytes :: e -> Parser e s Scientific Source #

Variant of parserSignedUtf8Bytes that rejects strings with a leading plus or minus sign.

parserNegatedUtf8Bytes :: e -> Parser e s Scientific Source #

Variant of parserUnsignedUtf8Bytes that negates the result.

parserNegatedTrailingUtf8Bytes Source #

Arguments

:: e

Error message

-> Int

Leading digit, should be between -9 and 9.

-> Parser e s Scientific 

parserSignedUtf8Bytes# Source #

Arguments

:: e

Error message

-> Parser e s Scientific# 

parserTrailingUtf8Bytes# Source #

Arguments

:: e

Error message

-> Int#

Leading digit

-> Parser e s Scientific# 

parserUnsignedUtf8Bytes# Source #

Arguments

:: e

Error message

-> Parser e s Scientific# 

Variant of parseUnsignedUtf8Bytes where all arguments are unboxed.

parserNegatedUtf8Bytes# Source #

Arguments

:: e

Error message

-> Parser e s Scientific# 

parserNegatedTrailingUtf8Bytes# Source #

Arguments

:: e

Error message

-> Int#

Leading digit

-> Parser e s Scientific# 

Encode