• Phillip Wood's avatar
    Use MPC for complex numbers · 476df143
    Phillip Wood authored
    MPC is a library for complex numbers built on top of MPFR. Using it
    fixes a number of issues with GNOME Calculators incomplete support for
    complex numbers and simplifies the implementation of a number of
    functions.
    
    Thanks to Daniel Renninghoff this commit also reworks the MPFR bindings
    to use vala's automatic memory management. I've added a default rounding
    mode which makes the calling code cleaner.
    
    The use of MPFR.RealRef is not ideal but there doesn't seem to be a
    better way to deal with references to structs in vala.
    
    The lvalue_allowed = false annotation is necessary to make MPC.abs() and
    MPC.arg() work, otherwise vala stores the result in a copy of the target
    variable.
    
    The bindings for MPC and MPFR.RealRef are licensed GPL3+ as MPFR and
    MPC are LGPL3 so it doesn't make sense to license them as GPL2+ as the
    GPL2 is incompatible with LGPL3
    
    https://bugzilla.gnome.org/show_bug.cgi?id=759439
    476df143
mpfr-glue.vala 913 Bytes