Class GMP

java.lang.Object
it.unich.jgmp.GMP

public class GMP extends Object
Collects global variables and static methods which do no fit in more specific classes.
  • Method Details

    • getVersion

      public static String getVersion()
      Return the version of the native GMP library.
    • getJGmpVersion

      public static String getJGmpVersion()
      Return the JGMP library version.
    • getMajorVersion

      public static int getMajorVersion()
      Return the major version of the native GMP library.
    • getMinorVersion

      public static int getMinorVersion()
      Return the minor version of the native GMP library.
    • getPatchLevel

      public static int getPatchLevel()
      Return the patch level of the native GMP library.
    • getBitsPerLimb

      public static int getBitsPerLimb()
      Return the number of bits per limb. A limb means the part of a multi-precision number that fits in a single machine word.
    • getDecimalSeparator

      public static String getDecimalSeparator()
      Return the system decimal separator, as used by the sscanf(String, String, Object...) and sprintf(String, Object...) methods. This might not correspond to the decimal separator of the current Java locale, since native locales are more fine-grained then Java ones.
    • printf

      public static int printf(String format, Object... args)
      Print to the standard output according to the format specification in fmt and the additional arguments in args. This is similar to the C printf function and the Java PrintStream.printf(String, Object...) method. If the format string is invalid, or the arguments don't match what the format specifies, then the behaviour of this function will be unpredictable. It will return -1 to indicate a write error. Output is not "atomic", so partial output may be produced if a write error occurs.

      This method bypasses the standard I/O procedures of the JVM. It is generally better to use the sprintf(String, Object...) method.

      See also the page Formatted Output Strings from the GMP manual.

      Returns:
      the number of characters written, -1 if an error occured.
    • sprintf

      public static String sprintf(String format, Object... args)
      Return a string according to the format specification in fmt and the additional arguments in args. This is similar to the C asprintf function and the Java String.format(String, Object...) method. If the format string is invalid, or the arguments don't match what the format specifies, then the behaviour of this function will be unpredictable.

      See also the page Formatted Output Strings from the GMP manual..org/manual/Formatted-Output-Strings

    • scanf

      public static int scanf(String format, Object... args)
      Parse the standard input according to the format specification in fmt, filling the variables in args. This is similar to the C scanf function. If the format string is invalid, or the arguments don't match what the format specifies, then the behaviour of this function will be unpredictable.

      This method bypasses the standard I/O procedures of the JVM. It is generally better to use the sscanf(String, String, Object...) method.

      See also the pages Formatted Input Strings and Formatted Input Functions from the GMP manual.

      Returns:
      the number of fields successfully parsed and stored.
    • sscanf

      public static int sscanf(String s, String fmt, Object... args)
      Parse the string s according to the format specification in fmt, filling the variables in args. This is similar to the C sscanf function. If the format string is invalid, or the arguments don't match what the format specifies, then the behaviour of this function will be unpredictable.

      See also the pages Formatted Input Strings and Formatted Input Functions from the GMP manual.

      Returns:
      the number of fields successfully parsed and stored.