Skip to content

purescript-lua/purescript-lua-numbers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

purescript-numbers

Latest release Build status Pursuit

Utility functions for working with PureScripts builtin Number type.

Installation

spago install numbers

Examples

Parsing:

> fromString "12.34"
(Just 12.34)

> fromString "1e-3"
(Just 0.001)

Formatting (Data.Number.Format):

> let x = 1234.56789

> toStringWith (precision 6) x
"1234.57"

> toStringWith (fixed 3) x
"1234.568"

> toStringWith (exponential 2) x
"1.23e+3"

Approximate comparisons (Data.Number.Approximate):

> 0.1 + 0.2 == 0.3
false

> 0.1 + 0.20.3
true

NaN and infinity:

> isNaN (Math.asin 2.0)
true

> isFinite (1.0 / 0.0)
false

Documentation

Module documentation is published on Pursuit.

About

Purescript Lua: Functions for working with PureScripts 'Number' type

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PureScript 61.4%
  • Lua 21.6%
  • Nix 7.6%
  • JavaScript 4.6%
  • Shell 3.3%
  • Dhall 1.5%