[gnome-calculator/60-split-out-a-backend-library: 9/39] calculator ported to GCalc
- From: Daniel Espinosa Ortiz <despinosa src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calculator/60-split-out-a-backend-library: 9/39] calculator ported to GCalc
- Date: Fri, 4 Jan 2019 16:34:59 +0000 (UTC)
commit 55193c36057904223ebd85e33dd7404e7f9f9d38
Author: Daniel Espinosa <esodan gmail com>
Date: Thu Dec 6 11:12:50 2018 -0600
calculator ported to GCalc
Actions:
* Removed duplicated classes from lib/ to use GCalc ones
* Calculator's library MathEquation based on SourceBuffer now uses
GCalc classes
* Calculator sources at src/ now uses GCalc classes porting
from old lib/ classes to new ones' API
* Fixes on GCalc API for GCalc.Number and GCalc.Number.Precision
* Search Provider now uses GCalc
* Ported tests to GCalc classes
* Added Complex.set_prec() to change precision and fix segfault
gcalc/gcalc-number.vala | 98 +-
gcalc/meson.build | 3 +-
lib/currency.vala | 500 ----------
lib/equation-lexer.vala | 713 --------------
lib/equation-parser.vala | 2106 ----------------------------------------
lib/equation.vala | 236 -----
lib/financial.vala | 1 +
lib/function-manager.vala | 384 --------
lib/math-equation.vala | 16 +-
lib/math-function.vala | 284 ------
lib/math-variables.vala | 165 ----
lib/meson.build | 21 +-
lib/mpfr-glue.vala | 29 -
lib/number.vala | 1339 -------------------------
lib/serializer.vala | 523 ----------
lib/unit.vala | 442 ---------
search-provider/meson.build | 3 +-
src/gcalccmd.vala | 1 +
src/gnome-calculator.vala | 6 +-
src/math-buttons.vala | 13 +-
src/math-converter.vala | 1 +
src/math-display.vala | 1 +
src/math-function-popover.vala | 1 +
src/math-history.vala | 1 +
src/math-preferences.vala | 1 +
src/math-variable-popover.vala | 1 +
src/math-window.vala | 1 +
src/meson.build | 8 +-
tests/meson.build | 9 +-
tests/test-equation.vala | 1 +
tests/test-number.vala | 1 +
tests/test-serializer.vala | 1 +
vapi/mpc.vapi | 2 +
33 files changed, 126 insertions(+), 6786 deletions(-)
---
diff --git a/gcalc/gcalc-number.vala b/gcalc/gcalc-number.vala
index c20b0118..fb77da25 100644
--- a/gcalc/gcalc-number.vala
+++ b/gcalc/gcalc-number.vala
@@ -45,12 +45,11 @@ namespace GCalc {
public class Number : Object
{
/* real and imaginary part of a Number */
- internal static MPFR.Precision _mpfr_precision;
- private Complex num = Complex (_mpfr_precision);
+ private Complex num = Complex (1000);
construct {
- _mpfr_precision = 1000;
+ MPFR.Precision _mpfr_precision = 1000;
precision = new Precision.internal_precision (_mpfr_precision);
}
@@ -59,18 +58,31 @@ namespace GCalc {
/* Stores the error msg if an error occurs during calculation. Otherwise should be null */
public static string? error { get; set; default = null; }
- public Number.integer (int64 real, int64 imag = 0)
+ public Number.integer (int64 real, int64 imag = 0, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_signed_integer ((long) real, (long) imag);
}
- public Number.unsigned_integer (uint64 real, uint64 imag = 0)
+ public Number.unsigned_integer (uint64 real, uint64 imag = 0, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_unsigned_integer ((ulong) real, (ulong) imag);
}
- public Number.fraction (int64 numerator, int64 denominator)
+ public Number.fraction (int64 numerator, int64 denominator, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
+
if (denominator < 0)
{
numerator = -numerator;
@@ -85,50 +97,82 @@ namespace GCalc {
}
/* Helper constructor. Creates new Number from already existing MPFR.Real. */
- internal Number.mpreal (MPFR.Real real, MPFR.Real? imag = null)
+ internal Number.mpreal (MPFR.Real real, MPFR.Real? imag = null, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_mpreal (real, imag);
}
- public Number.double (double real, double imag = 0)
+ public Number.double (double real, double imag = 0, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_double (real, imag);
}
- public Number.complex (Number r, Number i)
+ public Number.complex (Number r, Number i, Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_mpreal (r.num.get_real ().val, i.num.get_real ().val);
}
- public Number.polar (Number r, Number theta, AngleUnit unit = AngleUnit.RADIANS)
+ public Number.polar (Number r, Number theta, AngleUnit unit = AngleUnit.RADIANS, Precision? precision
= null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
var x = theta.cos (unit);
var y = theta.sin (unit);
this.complex (x.multiply (r), y.multiply (r));
}
- public Number.eulers ()
+ public Number.eulers (Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.get_real ().val.set_unsigned_integer (1);
/* e^1, since mpfr doesn't have a function to return e */
num.get_real ().val.exp (num.get_real ().val);
num.get_imag ().val.set_zero ();
}
- public Number.i ()
+ public Number.i (Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.set_signed_integer (0, 1);
}
- public Number.pi ()
+ public Number.pi (Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
num.get_real ().val.const_pi ();
num.get_imag ().val.set_zero ();
}
/* Sets z to be a uniform random number in the range [0, 1] */
- public Number.random ()
+ public Number.random (Precision? precision = null)
{
+ if (precision != null) {
+ this.precision = precision;
+ num.set_prec (precision._mpfr_precision);
+ }
this.double (Random.next_double ());
}
@@ -445,7 +489,7 @@ namespace GCalc {
z.num.get_real ().val.root (z.num.get_real ().val, (ulong) p);
z.num.get_imag().val.set_zero();
} else {
- var tmp = MPFR.Real (_mpfr_precision);
+ var tmp = MPFR.Real (precision._mpfr_precision);
tmp.set_unsigned_integer ((ulong) p);
tmp.unsigned_integer_divide (1, tmp);
z.num.power_mpreal (z.num, tmp);
@@ -524,7 +568,7 @@ namespace GCalc {
}
var tmp = add (new Number.integer (1));
- var tmp2 = MPFR.Real (_mpfr_precision);
+ var tmp2 = MPFR.Real (precision._mpfr_precision);
/* Factorial(x) = Gamma(x+1) - This is the formula used to calculate Factorial.*/
tmp2.gamma (tmp.num.get_real ().val);
@@ -997,7 +1041,7 @@ namespace GCalc {
return z;
}
- private static void mpc_from_radians (Complex res, Complex op, AngleUnit unit)
+ private void mpc_from_radians (Complex res, Complex op, AngleUnit unit)
{
int i;
@@ -1018,13 +1062,13 @@ namespace GCalc {
break;
}
- var scale = MPFR.Real (_mpfr_precision);
+ var scale = MPFR.Real (precision._mpfr_precision);
scale.const_pi ();
scale.signed_integer_divide (i, scale);
res.multiply_mpreal (op, scale);
}
- private static void mpc_to_radians (Complex res, Complex op, AngleUnit unit)
+ private void mpc_to_radians (Complex res, Complex op, AngleUnit unit)
{
int i;
@@ -1044,7 +1088,7 @@ namespace GCalc {
i=200;
break;
}
- var scale = MPFR.Real (_mpfr_precision);
+ var scale = MPFR.Real (precision._mpfr_precision);
scale.const_pi ();
scale.divide_signed_integer (scale, i);
res.multiply_mpreal (op, scale);
@@ -1114,25 +1158,25 @@ namespace GCalc {
return serializer.to_string (this);
}
public class Precision : Object {
- internal MPFR.Precision _precision;
+ internal MPFR.Precision _mpfr_precision;
construct {
- _precision = 1000;
+ _mpfr_precision = 1000;
}
- public long precision { get { return (long) _precision; } }
+ public ulong precision { get { return (ulong) _mpfr_precision; } }
internal Precision.internal_precision (MPFR.Precision precision) {
- _precision = precision;
+ _mpfr_precision = precision;
}
- public Precision (long precision) {
- _precision = (MPFR.Precision) precision;
+ public Precision (ulong precision) {
+ _mpfr_precision = (MPFR.Precision) precision;
}
}
public class Real : Object {
internal MPFR.Real _value;
public Real (Precision precision) {
- _value = MPFR.Real (precision._precision);
+ _value = MPFR.Real (precision._mpfr_precision);
}
}
}
diff --git a/gcalc/meson.build b/gcalc/meson.build
index 2472d9b4..c5778db8 100644
--- a/gcalc/meson.build
+++ b/gcalc/meson.build
@@ -67,7 +67,8 @@ deps = [
inc_rooth_dep,
posix,
libxml,
- libsoup
+ libsoup,
+ inc_rooth_dep
]
diff --git a/lib/financial.vala b/lib/financial.vala
index 0ed79aab..dd1a7eca 100644
--- a/lib/financial.vala
+++ b/lib/financial.vala
@@ -8,6 +8,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+ using GCalc;
public enum FinancialDialog
{
diff --git a/lib/math-equation.vala b/lib/math-equation.vala
index bb9c7718..61379aef 100644
--- a/lib/math-equation.vala
+++ b/lib/math-equation.vala
@@ -9,6 +9,8 @@
* license.
*/
+using GCalc;
+
public enum NumberMode
{
NORMAL,
@@ -47,6 +49,8 @@ public class MathEquation : Gtk.SourceBuffer
{
private Gtk.TextTag ans_tag;
+ public Number.Precision precision { get; set; default = new Number.Precision (1000); }
+
/* Word size in bits */
private int _word_size;
public int word_size
@@ -194,7 +198,7 @@ public class MathEquation : Gtk.SourceBuffer
_serializer = new Serializer (DisplayFormat.AUTOMATIC, 10, 9);
queue = new AsyncQueue<SolveData> ();
- state.ans = new Number.integer (0);
+ state.ans = new Number.integer (0, 0, _precision);
state.ans_base = 10;
ans_tag = create_tag (null, "weight", Pango.Weight.BOLD, null);
@@ -1272,7 +1276,7 @@ public class MathEquation : Gtk.SourceBuffer
public void toggle_bit (uint bit)
{
var x = number;
- var max = new Number.unsigned_integer (uint64.MAX);
+ var max = new Number.unsigned_integer (uint64.MAX, 0, precision);
if (x == null || x.is_negative () || x.compare (max) > 0)
{
/* Message displayed when cannot toggle bit in display */
@@ -1282,7 +1286,7 @@ public class MathEquation : Gtk.SourceBuffer
var bits = x.to_unsigned_integer ();
bits ^= (1LL << (63 - bit));
- x = new Number.unsigned_integer (bits);
+ x = new Number.unsigned_integer (bits, 0, precision);
// FIXME: Only do this if in ans format, otherwise set text in same format as previous number
set_number (x);
@@ -1377,11 +1381,13 @@ public class MathEquation : Gtk.SourceBuffer
private class MEquation : Equation
{
private MathEquation m_equation;
+ private Number.Precision precision = new Number.Precision (1000);
- public MEquation (MathEquation m_equation, string equation)
+ public MEquation (MathEquation m_equation, string equation, Number.Precision? precision = null)
{
base (equation);
this.m_equation = m_equation;
+ this.precision = precision;
}
public override bool variable_is_defined (string name)
@@ -1399,7 +1405,7 @@ private class MEquation : Equation
var lower_name = name.down ();
if (lower_name == "rand")
- return new Number.random ();
+ return new Number.random (precision);
else if (lower_name == "_")
return m_equation.answer;
else
diff --git a/lib/meson.build b/lib/meson.build
index ffbe3f3f..4ef01a17 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -1,17 +1,6 @@
libcalculator_sources = files ([
- 'mpfr-glue.vala',
- 'currency.vala',
- 'equation.vala',
- 'equation-lexer.vala',
- 'equation-parser.vala',
'financial.vala',
- 'function-manager.vala',
- 'math-equation.vala',
- 'math-function.vala',
- 'math-variables.vala',
- 'number.vala',
- 'serializer.vala',
- 'unit.vala',
+ 'math-equation.vala'
])
libcalculator_vala_flags = [
@@ -23,16 +12,11 @@ libcalculator_c_flags = [
]
libcalculator_deps = [
- gio,
- glib,
- gobject,
gtk,
gtksourceview,
- libsoup,
- libxml,
- mpc,
mpfr,
posix,
+ inc_rooth_dep
]
libcalculator = static_library('calculator', libcalculator_sources,
@@ -41,4 +25,5 @@ libcalculator = static_library('calculator', libcalculator_sources,
vala_args: libcalculator_vala_flags,
include_directories: config_h_dir,
install: false,
+ link_with: [lib, lib_mpfrg],
)
diff --git a/search-provider/meson.build b/search-provider/meson.build
index 00c6f84a..6157c494 100644
--- a/search-provider/meson.build
+++ b/search-provider/meson.build
@@ -11,6 +11,7 @@ search_provider_deps = [
mpc,
mpfr,
posix,
+ inc_rooth_dep
]
search_provider_vala_flags = [
@@ -30,7 +31,7 @@ search_provider_includes = [
# The executable
executable('gnome-calculator-search-provider', search_provider_sources,
dependencies: search_provider_deps,
- link_with: libcalculator,
+ link_with: [lib, lib_mpfrg, libcalculator],
install_dir: get_option('libexecdir'),
include_directories: search_provider_includes,
vala_args: search_provider_vala_flags,
diff --git a/src/gcalccmd.vala b/src/gcalccmd.vala
index 3bf6c45e..97956dd3 100644
--- a/src/gcalccmd.vala
+++ b/src/gcalccmd.vala
@@ -8,6 +8,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
private const int MAXLINE = 1024;
diff --git a/src/gnome-calculator.vala b/src/gnome-calculator.vala
index 1e4a1c28..aa7e7d0f 100644
--- a/src/gnome-calculator.vala
+++ b/src/gnome-calculator.vala
@@ -8,11 +8,13 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
public class Calculator : Gtk.Application
{
private Settings settings;
private MathWindow last_opened_window;
+ private Number.Precision _precision = new Number.Precision (1000);
int n_math_windows = 0;
private MathPreferencesDialog preferences_dialog;
private Gtk.ShortcutsWindow shortcuts_window;
@@ -59,9 +61,10 @@ public class Calculator : Gtk.Application
var target_currency = settings.get_string ("target-currency");
var source_units = settings.get_string ("source-units");
var target_units = settings.get_string ("target-units");
- var precision = settings.get_int ("precision");
+ _precision = new Number.Precision ((ulong) settings.get_int ("precision"));
var equation = new MathEquation ();
+ equation.precision = _precision;
equation.accuracy = accuracy;
equation.word_size = word_size;
equation.show_thousands_separators = show_tsep;
@@ -72,7 +75,6 @@ public class Calculator : Gtk.Application
equation.target_currency = target_currency;
equation.source_units = source_units;
equation.target_units = target_units;
- Number.precision = precision;
add_action_entries (app_entries, this);
diff --git a/src/math-buttons.vala b/src/math-buttons.vala
index 2e7f5461..1ad74f20 100644
--- a/src/math-buttons.vala
+++ b/src/math-buttons.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
public enum ButtonMode
{
@@ -217,7 +218,7 @@ public class MathButtons : Gtk.Box
var enabled = x != null;
if (enabled)
{
- var max = new Number.unsigned_integer (uint64.MAX);
+ var max = new Number.unsigned_integer (uint64.MAX, 0, equation.precision);
var fraction = x.fractional_part ();
if (x.is_negative () || x.compare (max) > 0 || !fraction.is_zero ())
enabled = false;
@@ -542,7 +543,11 @@ public class MathButtons : Gtk.Box
break;
}
- Number arg[4] = { new Number.integer (0), new Number.integer (0), new Number.integer (0), new
Number.integer (0) };
+ Number arg[4] = { new Number.integer (0, 0, equation.precision),
+ new Number.integer (0, 0, equation.precision),
+ new Number.integer (0, 0, equation.precision),
+ new Number.integer (0, 0, equation.precision)
+ };
for (var i = 0; i < entries.length; i++)
{
var entry = financial_ui.get_object (entries[i]) as Gtk.Entry;
@@ -561,10 +566,10 @@ public class MathButtons : Gtk.Box
if (response_id == Gtk.ResponseType.OK)
{
- var x = new Number.integer (0);
+ var x = new Number.integer (0, 0, equation.precision);
for (var i = 0; text[i] != '\0'; i++)
{
- x = x.add (new Number.integer (text[i]));
+ x = x.add (new Number.integer (text[i], 0, equation.precision));
x = x.shift (8);
}
diff --git a/src/math-converter.vala b/src/math-converter.vala
index a83dea24..a91ca257 100644
--- a/src/math-converter.vala
+++ b/src/math-converter.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
[GtkTemplate (ui = "/org/gnome/calculator/math-converter.ui")]
public class MathConverter : Gtk.Grid
diff --git a/src/math-display.vala b/src/math-display.vala
index 87e31400..da3b8eed 100644
--- a/src/math-display.vala
+++ b/src/math-display.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
public class MathDisplay : Gtk.Viewport
{
diff --git a/src/math-function-popover.vala b/src/math-function-popover.vala
index f2d1ea09..641b2a7d 100644
--- a/src/math-function-popover.vala
+++ b/src/math-function-popover.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
[GtkTemplate (ui = "/org/gnome/calculator/math-function-popover.ui")]
public class MathFunctionPopover : Gtk.Popover
diff --git a/src/math-history.vala b/src/math-history.vala
index 53ab5eec..403b5c6e 100644
--- a/src/math-history.vala
+++ b/src/math-history.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
[GtkTemplate (ui = "/org/gnome/calculator/history-view.ui")]
public class HistoryView : Gtk.ScrolledWindow
diff --git a/src/math-preferences.vala b/src/math-preferences.vala
index d1ab7657..62b46528 100644
--- a/src/math-preferences.vala
+++ b/src/math-preferences.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
public class MathPreferencesDialog : Gtk.Dialog
{
diff --git a/src/math-variable-popover.vala b/src/math-variable-popover.vala
index 1c387865..7b5b3fd2 100644
--- a/src/math-variable-popover.vala
+++ b/src/math-variable-popover.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
[GtkTemplate (ui = "/org/gnome/calculator/math-variable-popover.ui")]
public class MathVariablePopover : Gtk.Popover
diff --git a/src/math-window.vala b/src/math-window.vala
index ddb0caea..73817f89 100644
--- a/src/math-window.vala
+++ b/src/math-window.vala
@@ -8,6 +8,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
[GtkTemplate (ui = "/org/gnome/calculator/math-window.ui")]
public class MathWindow : Gtk.ApplicationWindow
diff --git a/src/meson.build b/src/meson.build
index 5f374d85..a3c77dca 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -27,6 +27,7 @@ gnome_calculator_deps = [
mpc,
mpfr,
posix,
+ inc_rooth_dep
]
gnome_calculator_vala_flags = [
@@ -47,7 +48,7 @@ gnome_calculator_includes = [
executable('gnome-calculator', gnome_calculator_sources,
dependencies: gnome_calculator_deps,
- link_with: libcalculator,
+ link_with: [lib, lib_mpfrg, libcalculator],
include_directories: gnome_calculator_includes,
vala_args: gnome_calculator_vala_flags,
c_args: gnome_calculator_c_flags,
@@ -69,6 +70,7 @@ gcalccmd_deps = [
mpc,
mpfr,
posix,
+ inc_rooth_dep
]
gcalccmd_vala_flags = [
@@ -83,8 +85,8 @@ gcalccmd_includes = [
executable('gcalccmd', gcalccmd_sources,
dependencies: gcalccmd_deps,
- link_with: libcalculator,
+ link_with: [lib, lib_mpfrg, libcalculator],
include_directories: gcalccmd_includes,
vala_args: gcalccmd_vala_flags,
install: true,
-)
+)
\ No newline at end of file
diff --git a/tests/meson.build b/tests/meson.build
index 808c85e3..803932be 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -9,6 +9,7 @@ gnome_calculator_tests_deps = [
mpc,
mpfr,
posix,
+ inc_rooth_dep
]
gnome_calculator_tests_includes = [
@@ -21,7 +22,7 @@ test_equation_sources = [
]
test_equation = executable('test-equation', test_equation_sources,
dependencies: gnome_calculator_tests_deps,
- link_with: libcalculator,
+ link_with: [libcalculator, lib, lib_mpfrg],
include_directories: gnome_calculator_tests_includes,
)
test('Equation test', test_equation)
@@ -31,7 +32,7 @@ test_number_sources = [
]
test_number = executable('test-number', test_number_sources,
dependencies: gnome_calculator_tests_deps,
- link_with: libcalculator,
+ link_with: [libcalculator, lib, lib_mpfrg],
include_directories: gnome_calculator_tests_includes,
)
test('Number test', test_number)
@@ -41,7 +42,7 @@ test_serializer_sources = [
]
test_serializer = executable('test-serializer', test_serializer_sources,
dependencies: gnome_calculator_tests_deps,
- link_with: libcalculator,
+ link_with: [libcalculator, lib, lib_mpfrg],
include_directories: gnome_calculator_tests_includes,
)
-test('Serializer test', test_serializer)
+test('Serializer test', test_serializer)
\ No newline at end of file
diff --git a/tests/test-equation.vala b/tests/test-equation.vala
index e1fa390d..122ae60e 100644
--- a/tests/test-equation.vala
+++ b/tests/test-equation.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
private int number_base = 10;
private int wordlen = 32;
diff --git a/tests/test-number.vala b/tests/test-number.vala
index cb346a4e..1ca09d41 100644
--- a/tests/test-number.vala
+++ b/tests/test-number.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
private int fail_count = 0;
private int pass_count = 0;
diff --git a/tests/test-serializer.vala b/tests/test-serializer.vala
index 67eba3ab..627b39d2 100644
--- a/tests/test-serializer.vala
+++ b/tests/test-serializer.vala
@@ -7,6 +7,7 @@
* version. See http://www.gnu.org/copyleft/gpl.html the full text of the
* license.
*/
+using GCalc;
private int fail_count = 0;
private int pass_count = 0;
diff --git a/vapi/mpc.vapi b/vapi/mpc.vapi
index 985da93b..00e6c138 100644
--- a/vapi/mpc.vapi
+++ b/vapi/mpc.vapi
@@ -49,6 +49,8 @@ namespace MPC {
public struct Complex {
[CCode (cname="mpc_init2")]
public Complex (MPFR.Precision prec);
+ [CCode (cname="mpc_set_prec")]
+ public void set_prec (MPFR.Precision prec);
public int @set (Complex op, Round rnd = Round.NEAREST);
[CCode (cname="mpc_set_ui_ui")]
public int set_unsigned_integer (ulong re, ulong im = 0, Round rnd = Round.NEAREST);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]