Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ecton committed Sep 19, 2024
0 parents commit 50df5a2
Show file tree
Hide file tree
Showing 18 changed files with 1,762 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: [ecton]
28 changes: 28 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Docs

on: [push, pull_request]

jobs:
docs:
runs-on: ubuntu-latest
steps:
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: nightly

- uses: actions/checkout@v3
- name: Generate Docs
run: |
cargo +nightly doc --no-deps --all-features --workspace
- name: Deploy Docs
if: github.ref == 'refs/heads/main'
uses: JamesIves/github-pages-deploy-action@releases/v4
with:
branch: gh-pages
folder: target/doc/
git-config-name: kl-botsu
git-config-email: [email protected]
target-folder: /main/
clean: true
37 changes: 37 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Tests

on: [push, pull_request]

jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3

- name: Install Rust
uses: hecrj/setup-rust-action@v1

- name: Run clippy
run: |
cargo clippy
- name: Run clippy without std
run: |
cargo clippy --no-default-features
- name: Run unit tests
run: |
cargo test
build-msrv:
name: Test on MSRV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Rust
uses: hecrj/setup-rust-action@v1
with:
rust-version: 1.81.0
- name: Run unit tests
run: cargo test
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
55 changes: 55 additions & 0 deletions .rustme/config.ron
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Configuration(
files: {
"../README.md": (
for_docs: false,
sections: [
"header.md",
"docs.md",
"https://github.com/khonsulabs/.github/raw/main/snippets/readme-footer.md",
],
),
"../src/.crate-docs.md": (
for_docs: true,
sections: [
"docs.md",
"https://github.com/khonsulabs/.github/raw/main/snippets/readme-footer.md",
],
),
"../CONTRIBUTING.md": [
"https://github.com/khonsulabs/.github/raw/main/docs/CONTRIBUTING.md",
],
"../CODE_OF_CONDUCT.md": [
"https://github.com/khonsulabs/.github/raw/main/docs/CODE_OF_CONDUCT.md",
],
"../LICENSE-APACHE": [
"https://github.com/khonsulabs/.github/raw/main/licenses/LICENSE-APACHE",
],
"../LICENSE-MIT": [
"https://github.com/khonsulabs/.github/raw/main/licenses/LICENSE-MIT",
],
},
glossaries: [
"https://github.com/khonsulabs/.github/raw/main/snippets/glossary.ron",
{
// "msrv": "1.70",
"ref-name": (
default: "main",
release: "v0.4.0",
),
"docs": (
default: "https://cushy.rs/main/docs/cushy/",
release: "https://docs.rs/cushy",
),
"widget": (
default: "https://cushy.rs/main/docs/cushy/widget/trait.Widget.html",
release: "https://docs.rs/cushy/*/cushy/widget/trait.Widget.html",
for_docs: "crate::widget::Widget",
),
"widgets": (
default: "https://cushy.rs/main/docs/cushy/widgets/index.html",
release: "https://docs.rs/cushy/*/cushy/widgets/index.html",
for_docs: "mod@crate::widgets",
),
},
],
)
31 changes: 31 additions & 0 deletions .rustme/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!-- This file is generated by `rustme`. Ensure you're editing the source in the .rustme/ directory --!>
<!-- markdownlint-disable first-line-h1 -->

![Approximint is considered alpha and unsupported](https://img.shields.io/badge/status-alpha-orange)
[![crate version](https://img.shields.io/crates/v/approximint.svg)](https://crates.io/crates/approximint)
[![Documentation for `$ref-name$`](https://img.shields.io/badge/docs-$ref-name$-informational)]($docs$)

A large integer library supporting a non-inclusive range of
(-1e4,294,967,305..+1e4,294,967,305) with 9 decimal digits of precision.

This library was designed to be a simple, efficient implementation of large
numbers for use in incremental games. It utilizes two 32 bit integers to
represent a number in the form of `coefficient * 10^exponent`.

## Basic usage

```rust
use approximint::Approximint;

let googol = Approximint::one_e(100);
let billion = Approximint::new(1_000_000_000);

assert_eq!((googol * billion).to_string(), "1.000e109");
assert_eq!((googol * billion).as_english().to_string(), "1 billion googol");
```

## no_std

This crate supports all integer operations, including formatting, in no_std
without alloc. Floating point operations require the `std` feature to be
enabled.
1 change: 1 addition & 0 deletions .rustme/header.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Approximint
128 changes: 128 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our
community a harassment-free experience for everyone, regardless of age, body
size, visible or invisible disability, ethnicity, sex characteristics, gender
identity and expression, level of experience, education, socio-economic status,
nationality, personal appearance, race, religion, or sexual identity
and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming,
diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of
acceptable behavior and will take appropriate and fair corrective action in
response to any behavior that they deem inappropriate, threatening, offensive,
or harmful.

Community leaders have the right and responsibility to remove, edit, or reject
comments, commits, code, wiki edits, issues, and other contributions that are
not aligned to this Code of Conduct, and will communicate reasons for moderation
decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when
an individual is officially representing the community in public spaces.
Examples of representing our community include using an official e-mail address,
posting via an official social media account, or acting as an appointed
representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
[email protected].
All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the
reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining
the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community Impact**: Use of inappropriate language or other behavior deemed
unprofessional or unwelcome in the community.

**Consequence**: A private, written warning from community leaders, providing
clarity around the nature of the violation and an explanation of why the
behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community Impact**: A violation through a single incident or series
of actions.

**Consequence**: A warning with consequences for continued behavior. No
interaction with the people involved, including unsolicited interaction with
those enforcing the Code of Conduct, for a specified period of time. This
includes avoiding interactions in community spaces as well as external channels
like social media. Violating these terms may lead to a temporary or
permanent ban.

### 3. Temporary Ban

**Community Impact**: A serious violation of community standards, including
sustained inappropriate behavior.

**Consequence**: A temporary ban from any sort of interaction or public
communication with the community for a specified period of time. No public or
private interaction with the people involved, including unsolicited interaction
with those enforcing the Code of Conduct, is allowed during this period.
Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant][homepage],
version 2.0, available at
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.

Community Impact Guidelines were inspired by [Mozilla's code of conduct
enforcement ladder](https://github.com/mozilla/diversity).

[homepage]: https://www.contributor-covenant.org

For answers to common questions about this code of conduct, see the FAQ at
https://www.contributor-covenant.org/faq. Translations are available at
https://www.contributor-covenant.org/translations.
55 changes: 55 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Contributing to our projects

Thank you for your interest in contributing to one of our projects. We want
everyone to have a positive experience contributing, so please carefully review
our only requirements for contributing:

- All contributors must agree to [our Contributor License
Agreement](https://gist.github.com/ecton/b2e1e72abfa122da5e69ed30164f739e).
This will be asked for during your first pull request.
- All contributors must uphold the standards of our [Code of
Conduct](./CODE_OF_CONDUCT.md).

The rest of this document is recommendations/guidelines to help consistency and
communication within our projects.

## Creating Issues

### Reporting Bugs

To us, if something isn't behaving as you expect it to, that's a bug. Even if
it's misbehaving due to a misunderstanding, that means there's an opportunity to
improve our documentation or examples. Please don't hesitate to let us know if
you run into any issues while working with one of our projects.

### Requesting New Features

When requesting new features, please include details about what problem you're
trying to solve, not just a solution to your problem. By helping the community
understand the underlying problem, we can better evaluate what the best solution
to the problem might be.

## Contributing Changes

We openly welcome pull requests on our projects. We don't like bugs, and if
you've found one and wish to submit a fix, we greatly appreciate it.

If you find that fixing a bug requires a significant change, or you are wanting
to add a somewhat large feature, please submit a proposal as an issue first. We
want to make sure that your efforts have the highest chance of success, and a
short discussion before starting can go a long way towards a pull request being
merged with less revisions.

When working on an existing issue, update the issue to reflect that you're
working on it. This will help prevent duplicated efforts.

If you begin working on something but need some assistance, don't hesitate to
reach out inside of the issue, on [our
forums](https://community.khonsulabs.com/), or in [our
Discord](https://discord.khonsulabs.com/). We will do our best to help you.

### Project-specific requirements

Be sure to check if a project's README contains additional contributing
guidelines. Each project may have different tools and commands that should be
run to validate that changes pass all requirements.
7 changes: 7 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
name = "approximint"
version = "0.1.0"
edition = "2021"
rust-version = "1.81.0"
description = "A large integer library using an approximate representation inspired by scientific notation"
repository = "https://github.com/khonsulabs/approximint"
license = "MIT OR Apache-2.0"
keywords = ["decimal", "incremental", "math"]
categories = ["mathematics", "game-development"]
readme = "./README.md"

[features]
default = ["std"]
std = []

[lints.clippy]
pedantic = { level = "warn", priority = -1 }
missing_errors_doc = "allow"
missing_panics_doc = "allow"

[lints.rust]
unsafe_code = "forbid"
missing_docs = "warn"
Loading

0 comments on commit 50df5a2

Please sign in to comment.