Exoddic v1.1.0 Exoddic

A means for working with odds and probability.

In particular, a means to convert between different representations.

Summary

Types

A keyword list with conversion options

Functions

convert values among the various supported odds formats

Types

exoddic_options :: [from: atom, to: atom, for_display: boolean]

A keyword list with conversion options

  • from: the supplied format
  • to: the desired format
  • for_display: whether to nicely format the output as a string

Functions

convert(amount, options \\ [])

Specs

convert(number | String.t, exoddic_options) ::
  String.t |
  number

convert values among the various supported odds formats.

The to and from formats are identified by atoms corresponding to the converter module names.

Conversion amounts provided as strings will receive a best effort attempt at conversion to an appropriate number.

for_display defaults to true and will return an appropriately formatted string for the requested item. If set to false, it will return an unformatted number.