Giter Club home page Giter Club logo

doublefloats.jl's Introduction

DoubleFloats.jl

Math with 85+ accurate bits.


Build Status

See here for function specific absolute and relative errors over 0:1 and 1:2.

Documentation

  • Currentmost recently tagged version of the documentation.

Installation

The package can be installed with Pkg3 or Pkg.add.

pkg> add DoubleFloats
julia> using Pkg
julia> Pkg.add("DoubleFloats")

Examples

Double64, Double32, Double16

julia> using DoubleFloats

julia> d64 = sqrt(Double64(2)); 1 - d64 * inv(d64)
0.0
julia> d32 = sqrt(Double32(2)); 1 - d32 * inv(d32)
0.0
julia> d16 = sqrt(Double16(2)); 1 - d16 * inv(d16)
0.0

julia> typeof(ans) === Double16
true

show, string, parse

julia> using DoubleFloats

julia> x = sqrt(Double64(2)) / sqrt(Double64(6))
5.7735026918962576450914878050194151e-01
julia> string(x)
"5.7735026918962576450914878050194151e-01"

julia> showtyped(x)
Double64(0.5773502691896257, 3.3450280739356326e-17)
julia> showtyped(parse(Double64, stringtyped(x)))
Double64(0.5773502691896257, 3.3450280739356326e-17)

julia> Meta.parse(stringtyped(x))
:(Double64(0.5773502691896257, 3.3450280739356326e-17))

golden ratio

julia> using DoubleFloats

julia> ϕ = Double32(MathConstants.golden)
1.61803398874989490
julia> phi = "1.61803398874989484820+"
julia> ϕ⁻¹ = inv(ϕ)
6.18033988749894902e-01

julia> ϕ == 1 + ϕ⁻¹
true
julia> ϕ === ϕ * ϕ⁻¹ + ϕ⁻¹
true
typed value computed value ~abs(golden - computed)
MathConstants.golden 1.61803_39887_49894_84820_45868+ 0.0
Float64(MathConstants.golden) 1.61803_39887_49895 1.5e-16
Double32(MathConstants.golden) 1.61803_39887_49894_90 5.2e-17

Performance

Double64 relative to BigFloat

op speedup
+ 11x
* 18x
\ 7x
trig 3x-6x
  • results from testing with BenchmarkTools on one machine
  • BigFloat precision was set to 106 bits, for fair comparison

Suggested Use

If your input values are Float64[Float32], map them to Double64[Double32] and proceed with your computation. Then map the output values to Float64[Float32], and work with those values. Where throughput is important, this manner of us can be applied to particularly sensitive parts of your computation.

Questions and Contributions

Usage questions can be posted on the Julia Discourse forum. Use the topic Numerics (a "Discipline") and a put the package name, DoubleFloats, in your question ("topic").

Contributions are very welcome, as are feature requests and suggestions. Please open an issue if you encounter any problems. The contributing page has a few guidelines that should be followed when opening pull requests.

doublefloats.jl's People

Contributors

jeffreysarnoff avatar saschatimme avatar fredrikekre avatar rfourquet avatar

Watchers

Harmen Stoppels avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.