public class Pi extends Object
Modifier and Type | Class and Description |
---|---|
protected static class |
Pi.AbstractBinarySplittingSeries
Abstract base class for the binary splitting series.
|
protected static class |
Pi.BinarySplittingPiCalculator
Class for implementing the binary splitting algorithm.
|
static class |
Pi.BinarySplittingProgressIndicator
Indicates progress of the pi calculation using
the binary splitting algorithm.
|
protected static interface |
Pi.BinarySplittingSeries
Terms for the binary splitting series.
|
static class |
Pi.BorweinPiCalculator
Calculates pi using the Borweins' quartic algorithm.
|
protected static class |
Pi.ChudnovskyBinarySplittingSeries
Chudnovskys' algorithm terms for the binary splitting series.
|
static class |
Pi.ChudnovskyPiCalculator
Basic class for calculating pi using the Chudnovskys' binary splitting algorithm.
|
static class |
Pi.GaussLegendrePiCalculator
Calculates pi using the Gauss-Legendre algorithm.
|
protected static class |
Pi.RamanujanBinarySplittingSeries
Ramanujan's algorithm terms for the binary splitting series.
|
static class |
Pi.RamanujanPiCalculator
Basic class for calculating pi using the Ramanujan binary splitting algorithm.
|
Modifier and Type | Field and Description |
---|---|
protected static PrintWriter |
err
Output stream for status messages printout.
|
protected static PrintWriter |
out
Output stream for the result printout.
|
Modifier and Type | Method and Description |
---|---|
protected static void |
checkAlive()
Check whether the program should stop executing.
|
static PrintWriter |
getErr()
Get the output stream for status messages printout.
|
protected static int |
getInt(String arg,
String name,
int minValue,
int maxValue)
Parse an integer from an argument.
|
protected static long |
getLong(String arg,
String name,
long minValue,
long maxValue)
Parse a long from an argument.
|
static PrintWriter |
getOut()
Get the output stream for the result printout.
|
protected static long |
getPrecision(String arg)
Parse the precision from an argument.
|
protected static int |
getRadix(String arg)
Parse the radix from an argument.
|
static void |
main(String[] args)
Command-line entry point.
|
static void |
run(long precision,
int radix,
Operation<Apfloat> operation)
Execute an operation and display some additional information.
|
static void |
setAlive(boolean isAlive)
Set whether the program should stop executing.
|
static void |
setErr(PrintWriter err)
Set the output stream for status messages printout.
|
static void |
setOut(PrintWriter out)
Set the output stream for the result printout.
|
protected static PrintWriter out
protected static PrintWriter err
protected static long getLong(String arg, String name, long minValue, long maxValue)
arg
- The string to be parsed.name
- Description of the argument.minValue
- Minimum allowed value.maxValue
- Maximum allowed value.long
.protected static int getInt(String arg, String name, int minValue, int maxValue)
arg
- The string to be parsed.name
- Description of the argument.minValue
- Minimum allowed value.maxValue
- Maximum allowed value.protected static long getPrecision(String arg)
arg
- The string to be parsed.protected static int getRadix(String arg)
arg
- The string to be parsed.public static void run(long precision, int radix, Operation<Apfloat> operation) throws IOException, ApfloatRuntimeException
out
.precision
- The precision to be used.radix
- The radix to be used.operation
- The operation to execute.IOException
- In case writing the output fails.ApfloatRuntimeException
public static void setOut(PrintWriter out)
out
- The output stream.public static PrintWriter getOut()
public static void setErr(PrintWriter err)
err
- The output stream.public static PrintWriter getErr()
public static void setAlive(boolean isAlive)
isAlive
- true
to keep running the program, false
to stop.public static void main(String[] args) throws IOException, ApfloatRuntimeException
args
- Command-line parameters.IOException
- In case writing the output fails.ApfloatRuntimeException
protected static void checkAlive()
ThreadDeath
- in case setAlive(boolean)
has been set to false
.Copyright © 2019. All rights reserved.