add details to help
This commit is contained in:
parent
cdb28018ac
commit
67a6ce9b69
|
|
@ -46,11 +46,18 @@ func isprime(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
// isprimeCmd represents the isprime command
|
// isprimeCmd represents the isprime command
|
||||||
var isprimeCmd = &cobra.Command{
|
var isprimeCmd = &cobra.Command{
|
||||||
Use: "isprime",
|
Use: "isprime N [N ...]",
|
||||||
Short: "Determine whether a number is prime",
|
Short: "Determine whether a number is prime",
|
||||||
Long: `Determine whether a number is prime.`,
|
Long: `Determine whether a number is prime.
|
||||||
Args: cobra.MinimumNArgs(1),
|
|
||||||
Run: isprime,
|
This applies 10 iterations of the Miller-Rabin test and a Baillie-PSW test. Use
|
||||||
|
flags to change the number of Miller-Rabin iterations.
|
||||||
|
|
||||||
|
For inputs less than 2^64, results are 100% accurate. For larger numbers, there
|
||||||
|
is a small chance of falsely reporting a composite number as prime. That chance
|
||||||
|
can be reduced by applying more rounds of Miller-Rabin.`,
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
Run: isprime,
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
|
@ -66,5 +73,5 @@ func init() {
|
||||||
// is called directly, e.g.:
|
// is called directly, e.g.:
|
||||||
// isprimeCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
// isprimeCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
|
||||||
|
|
||||||
isprimeCmd.Flags().UintVarP(&rounds, "rounds", "r", 10, "number of iterations")
|
isprimeCmd.Flags().UintVarP(&rounds, "rounds", "r", 10, "number of iterations of Miller-Rabin test")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue