GithubHelp home page GithubHelp logo

wezeku / mpir.net Goto Github PK

View Code? Open in Web Editor NEW
17.0 17.0 9.0 2.14 MB

MPIR for .NET

Home Page: http://wezeku.github.io/Mpir.NET/

License: GNU Lesser General Public License v3.0

Shell 0.01% F# 0.61% C# 28.71% PowerShell 0.02% PHP 1.45% C 22.94% Batchfile 0.12% Logos 0.84% C++ 45.30%

mpir.net's People

Contributors

perlmint avatar sluggyyarvin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mpir.net's Issues

Negative power by module

Hello,

The following source code returns the incorrect result. Instead of value 5 it show 6.
Platform target: x64

    static void Main(string[] args)
    {
        mpz_t a = new mpz_t(3);
        mpz_t b = new mpz_t(7);
        mpz_t c;

        c = a.PowerMod(-1, b);
        System.Console.WriteLine("{0}", c);

    }

Negative longs are treated as unsigned

If I give mpz_t a negative long in the constructor, I get a positive mpz_t.
For now, using int instead has been fine.

Repro is quite simple:
var val = new mpz_t((long)-1);
Inspecting in the debugger gives: {18446744073709551615}

Thanks for your great work!

mpf_t?

will mpf_t be available?

btw: wich generator do you use for generating the native mappings?

Bug with mpz_t implicit cast

Hi,
this code

        mpz_t a1 = 0;
        mpz_t a2 = 0;
        mpir.mpz_add(a2, a2, 2);
        Console.WriteLine(a1);

will write 2 instead of 0, because in implicit cast method you return reference to static mpz_t.Zero in both case. (i think you want to return .clone() or maybe it will be better to return new mpz_t(val))

mpq-support

I was informed that mpq is not supported, but it seems however that there are a number of supporting functions for mpq, and the mpq_t class does exist. A few functions are missing though, e.g. mpq_numref and mpq_denref.

I tried adding them the same way as the other functions, but it didn't seem to work.

If these functions are to return mpz_t, I suspect the mpz_t needs an additional field, e.g. IsPartOfMpq, that, if true, should indicate to mpz_t.Dispose()/destructor if it should indeed dispose internally or not, or let the mpq_t.Dispose()/destructor handle it, to avoid memory corruption by the GC. mpq_t would also need hold a reference to it's mpz_t (class) numref and denref so as to return the same instance, if they were ever instantiated.

Can not locate xmpir64.dll

After installing and starting my project, I get this exception:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'Mpir.NET.mpir' threw an exception.
Source=Mpir.NET
StackTrace:
at Mpir.NET.mpir.mpz_init_set_si(Int32 op)
at Mpir.NET.mpz_t..ctor(Int32 op)
at Mpir.NET.mpz_t.op_Implicit(Int32 value)
at PiDemo.Program.d__0.MoveNext() in C:\Users<user>\source\repos\PiDemo\Program.cs:line 13
at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection)
at System.Collections.Generic.List1.AddRange(IEnumerable1 collection)
at PiDemo.Program.Main(String[] args) in C:\Users<user>\source\repos\PiDemo\Program.cs:line 58

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
Exception: MPIR: can't determine path to the xmpir64.dll

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.