Skip to content

Proposal for arbitrary precision data type and arbitrary precision Lapack/Blas #231

Open
@Jim-215-Fisher

Description

@Jim-215-Fisher

Like to see an arbitrary precision data type in stdlib. Other languages like python, c++, java and Julia have already implemented. As a programming language for scientific calculation, Fortran should have the arbitrary precision data type implemented as well.

GNU has a GMP multiple precision library for c++. To the Fortran side, there are David Bailey's MPfun2015 package (https://www.davidhbailey.com/dhbsoftware/) and David Smith's FM package (https://dmsmith.lmu.build/).

For arbitrary precision Lapack/Blas, there is mpack(http://mplapack.sourceforge.net/).

Activity

arjenmarkus

arjenmarkus commented on Sep 14, 2020

@arjenmarkus
Member
Jim-215-Fisher

Jim-215-Fisher commented on Sep 20, 2020

@Jim-215-Fisher
ContributorAuthor

For mpack, it is 2-caluse BSD style license. It has not been updated since 2012.
For MPfun2015 package, it has LIMITED BSD LICENSE, i do know what that means.
For FM package, it is free.

arjenmarkus

arjenmarkus commented on Sep 22, 2020

@arjenmarkus
Member
tueda

tueda commented on Apr 11, 2021

@tueda

FYI: the latest version of mplapack (the name has been changed because of nakatamaho/mplapack#2) is sitting here: https://github.com/nakatamaho/mplapack.

added
topic: mathematicslinear algebra, sparse matrices, special functions, FFT, random numbers, statistics, ...
on Sep 18, 2021
certik

certik commented on Feb 3, 2022

@certik
Member

Yes, Fortran definitely needs an arbitrary precision floating point, as either a library or part of stdlib.

Arbitrary precision lapack/blas is also occasionally useful. I've used quadruple precision Lapack in the past by recompiling Lapack in quadruple precision. Not the best, but it worked to give me some extra precision.

@Jim-215-Fisher, would you be interested in working on this?

Jim-215-Fisher

Jim-215-Fisher commented on Feb 3, 2022

@Jim-215-Fisher
ContributorAuthor

Yes, I would be glad to introduce an arbitrary precision package to stdlib. I need some feedback about implementation and interface.

Jim-215-Fisher

Jim-215-Fisher commented on Feb 5, 2022

@Jim-215-Fisher
ContributorAuthor

Here is some thoughts about the implementation and interface of the arbitrary precision module for stdlib.

module  multiprecision
    type :: mp
       integer, allocatable :: n(:)
   end type mp
  ! use integer array to represent sign, exponent and digits of a float with a desired precision

   public :: set_precision     ! call for precision setup
   interface operator(+)       ! operator overload for arithmetic
   interface operatoe(-)
   interface operator(*)
   interface operator(/)
   interface assignment(=)  ! operator overload for assignment
   interface operator(==)     ! operator overload for logic comparison
   interface operator(<)
   interface operator(<=)
   interface operator(>)
   interface operator(>=)
   interface abs                  ! intrinsic function overload
   interface sin
   interface cos
...

end module multiprecision

Any suggestion or comment?

certik

certik commented on Feb 6, 2022

@certik
Member

CC @awvwgk, @milancurcic, @LKedward, @arjenmarkus

What would be the best approach?

awvwgk

awvwgk commented on Feb 6, 2022

@awvwgk
Member

I have rather limited experience with multiprecision libraries (used them once for code generation in Ruby, but this is years ago).

Probably worth to collect some information what other libraries/languages are doing regarding representation, functionality and interfaces. A couple of Fortran compatible libraries are already linked above.

Another question is how much effort a multiprecision implementation in stdlib is going to be, especially regarding code review, testing and validation. Do we have the tools for this available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: mathematicslinear algebra, sparse matrices, special functions, FFT, random numbers, statistics, ...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @certik@tueda@arjenmarkus@awvwgk@Jim-215-Fisher

        Issue actions

          Proposal for arbitrary precision data type and arbitrary precision Lapack/Blas · Issue #231 · fortran-lang/stdlib