Package it.unich.jgmp
Class GMP
- java.lang.Object
-
- it.unich.jgmp.GMP
-
public class GMP extends java.lang.Object
Collects global variables and static methods which do no fit in more specific classes.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.ref.Cleaner
cleaner
Cleaner used by the JGMP library.(package private) static java.lang.String
MSG_DIVIDE_BY_ZERO
Exception message for division by zero.(package private) static java.lang.String
MSG_EVEN_MODULUS
Error message for even modulus in @code{powmSec} functions.(package private) static java.lang.String
MSG_EVEN_ROOT_OF_NEGATIVE
Exception message for even root of negative number.(package private) static java.lang.String
MSG_FINITE_DOUBLE_REQUIRED
Exception message for a non-finite double.(package private) static java.lang.String
MSG_INVALID_BASE
Error messages for invalid base.(package private) static java.lang.String
MSG_INVALID_STRING_CONVERSION
Error messages for invalid conversion from strings.(package private) static java.lang.String
MSG_NAN_NOT_ALLOWED
Exception message for a NaN double.(package private) static java.lang.String
MSG_NEGATIVE_EXPONENT
Error message for negative exponent in @code{powmSec} functions.(package private) static java.lang.String
MSG_SAME_OBJECT
Error message when arguments this and r cannot be the same object.(package private) static java.lang.String
MSG_SIZE_TOO_BIG
Error message for parameter size too big.private static java.util.Properties
properties
Java Properties used by JGMP.
-
Constructor Summary
Constructors Modifier Constructor Description private
GMP()
A private constructor since this class should never be instantiated.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static int
getBitsPerLimb()
Return the number of bits per limb.static java.lang.String
getDecimalSeparator()
Return the system decimal separator, as used by thesscanf(String, String, Object...)
andsprintf(String, Object...)
methods.static java.lang.String
getJGmpVersion()
Return the JGMP library version.static int
getMajorVersion()
Return the major version of the native GMP library.static int
getMinorVersion()
Return the minor version of the native GMP library.static int
getPatchLevel()
Return the patch level of the native GMP library.static java.lang.String
getVersion()
Return the version of the native GMP library.static int
printf(java.lang.String format, java.lang.Object... args)
Print to the standard output according to the format specification infmt
and the additional arguments inargs
.static int
scanf(java.lang.String format, java.lang.Object... args)
Parse the standard input according to the format specification infmt
, filling the variables inargs
.static java.lang.String
sprintf(java.lang.String format, java.lang.Object... args)
Return a string according to the format specification infmt
and the additional arguments inargs
.static int
sscanf(java.lang.String s, java.lang.String fmt, java.lang.Object... args)
Parse the strings
according to the format specification infmt
, filling the variables inargs
.
-
-
-
Field Detail
-
properties
private static final java.util.Properties properties
Java Properties used by JGMP.
-
MSG_DIVIDE_BY_ZERO
static final java.lang.String MSG_DIVIDE_BY_ZERO
Exception message for division by zero.- See Also:
- Constant Field Values
-
MSG_EVEN_ROOT_OF_NEGATIVE
static final java.lang.String MSG_EVEN_ROOT_OF_NEGATIVE
Exception message for even root of negative number.- See Also:
- Constant Field Values
-
MSG_FINITE_DOUBLE_REQUIRED
static final java.lang.String MSG_FINITE_DOUBLE_REQUIRED
Exception message for a non-finite double.- See Also:
- Constant Field Values
-
MSG_NAN_NOT_ALLOWED
static final java.lang.String MSG_NAN_NOT_ALLOWED
Exception message for a NaN double.- See Also:
- Constant Field Values
-
MSG_SAME_OBJECT
static final java.lang.String MSG_SAME_OBJECT
Error message when arguments this and r cannot be the same object.- See Also:
- Constant Field Values
-
MSG_INVALID_BASE
static final java.lang.String MSG_INVALID_BASE
Error messages for invalid base.- See Also:
- Constant Field Values
-
MSG_INVALID_STRING_CONVERSION
static final java.lang.String MSG_INVALID_STRING_CONVERSION
Error messages for invalid conversion from strings.- See Also:
- Constant Field Values
-
MSG_SIZE_TOO_BIG
static final java.lang.String MSG_SIZE_TOO_BIG
Error message for parameter size too big.- See Also:
- Constant Field Values
-
MSG_EVEN_MODULUS
static final java.lang.String MSG_EVEN_MODULUS
Error message for even modulus in @code{powmSec} functions.- See Also:
- Constant Field Values
-
MSG_NEGATIVE_EXPONENT
static final java.lang.String MSG_NEGATIVE_EXPONENT
Error message for negative exponent in @code{powmSec} functions.- See Also:
- Constant Field Values
-
cleaner
static final java.lang.ref.Cleaner cleaner
Cleaner used by the JGMP library.
-
-
Method Detail
-
getVersion
public static java.lang.String getVersion()
Return the version of the native GMP library.
-
getJGmpVersion
public static java.lang.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 java.lang.String getDecimalSeparator()
Return the system decimal separator, as used by thesscanf(String, String, Object...)
andsprintf(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(java.lang.String format, java.lang.Object... args)
Print to the standard output according to the format specification infmt
and the additional arguments inargs
. This is similar to the Cprintf
function and the JavaPrintStream.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 java.lang.String sprintf(java.lang.String format, java.lang.Object... args)
Return a string according to the format specification infmt
and the additional arguments inargs
. This is similar to the Casprintf
function and the JavaString.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(java.lang.String format, java.lang.Object... args)
Parse the standard input according to the format specification infmt
, filling the variables inargs
. This is similar to the Cscanf
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(java.lang.String s, java.lang.String fmt, java.lang.Object... args)
Parse the strings
according to the format specification infmt
, filling the variables inargs
. This is similar to the Csscanf
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.
-
-