• Stars
    star
    20
  • Rank 1,083,893 (Top 22 %)
  • Language
    Go
  • License
    Other
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

PiHex Library, written in Go, generates a hexadecimal number sequence in the number Pi in the range from 0 to 10,000,000.

PiHex

PiHex Library generates a hexadecimal number sequence in the number Pi in the range from 0 to 1.0e10000000. To calculate using "Bailey-Borwein-Plouffe" algorithm, instructions that was published by David H. Bailey September 17, 2006.

API documentation Go Report Card Mentioned in Awesome Go

Usage

An example of using the PiHex Library:

package main

import (
	"fmt"
	"github.com/claygod/PiHex"
)

func main() {
	pi := PiHex.New()
	fmt.Print("The first 9 digits of Pi (hexadecimal): ", pi.Get(0, 9))
}

Settings

In the configuration file, you can change the constant STEP. This constant determines the amount generated in one step numbers. The reduction leads to a constant increase in the operating time of the program.

Attention! This constant can not be more than 9! Limitation due to the 64-bit library architecture.

The configuration file config.go

Perfomance

To optimize the run-time program, highly loaded sections of the library are performed in parallel (4 goroutines).

API

Methods:

  • New - create a new PiHex
  • Get - receiving a sequence of hexadecimal digits starting at the specified position and in the right quantity.

Example:

pi := PiHex.New()
x :=  pi.Get(1000, 5)

Algorithm

The Bailey–Borwein–Plouffe formula (BBP formula) is a spigot algorithm for computing the nth binary digit of Pi using base 16 math. The formula can directly calculate the value of any given digit of π without calculating the preceding digits. The BBP is a summation-style formula that was discovered in 1995 by Simon Plouffe and was named after the authors of the paper in which the formula was published, David H. Bailey, Peter Borwein, and Simon Plouffe.

Implementation

Plays Library is based on the publication "The BBP Algorithm for Pi" of David H. Bailey on September 17, 2006: http://www.davidhbailey.com/dhbpapers/bbp-alg.pdf

Copyright

Copyright © 2017-2022 Eduard Sesigin. All rights reserved. Contacts: [email protected]

More Repositories

1

transaction

Embedded database for accounts transactions.
Go
127
star
2

microservice

This library provides a simple microservice framework based on clean architecture principles with a working example implemented.
Go
114
star
3

Bxog

Bxog is a simple and fast HTTP router for Go (HTTP request multiplexer).
Go
103
star
4

coffer

Simply ACID* key-value database. At the medium or even low latency it tries to provide greater throughput without losing the ACID properties of the database. The database provides the ability to create record headers at own discretion and use them as transactions. The maximum size of stored data is limited by the size of the computer's RAM.
Go
37
star
5

mmoa

Monolithic Message-Oriented Application (MMOA)
Go
9
star
6

Rumba

Micro framework Rumba written in Lua language for web development faster and light sites or CMS that are hosted on Apache (with mod_lua module)
Lua
8
star
7

processing

Blockchain-like decentralized distributed DAG-registry for processing
Go
6
star
8

door

Nimble multiplexer for Fast HTTP server, written in Golang
Go
3
star
9

accounter

Transactions and accounting of accounts.
Go
2
star
10

Context

Written in Golang Context library stores designed to store the application context.
Go
1
star
11

exchange

Exchange engine
Go
1
star
12

BxogTest

Test router Bxog and its benchmark (and other popular routers - multiplexers, written in the Go)
Go
1
star
13

BxogV2

Based on the Bxog, but a slower router
Go
1
star
14

structer

Storage for structures (embedded) with the ability to search by field structure.
Go
1
star
15

dotcp

TCP server with RPC mode for JSON.
Go
1
star