Exoddic (Exoddic v1.3.7) View Source

A means for working with odds and probability.

In particular, a means to convert between different representations.

Link to this section Summary

Types

A keyword list with conversion options

Functions

Convert values among the various supported odds formats.

Link to this section Types

Specs

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

A keyword list with conversion options

The to and from formats are identified by atoms corresponding to the converter module names. They default to :prob

  • from: the supplied input format
  • to: the desired output format
  • for_display: whether to nicely format the output as a string, defaults to true

Link to this section Functions

Link to this function

convert(amount, options \\ [])

View Source

Specs

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

Convert values among the various supported odds formats.

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