-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
519 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# https://EditorConfig.org | ||
|
||
# top-most EditorConfig file | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 4 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = true | ||
insert_final_newline = true | ||
|
||
[*.yaml] | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,155 @@ | ||
|
||
cache: | ||
policy: pull-push | ||
# should we only share cache between jobs on one tag? | ||
# key: ${CI_COMMIT_REF_SLUG} | ||
paths: | ||
- .cargo/bin | ||
- .cargo/registry/index | ||
- .cargo/registry/cache | ||
- target/debug/deps | ||
- target/debug/build | ||
|
||
variables: | ||
# store cargo registry in the project directory | ||
CARGO_HOME: ${CI_PROJECT_DIR}/.cargo | ||
|
||
# this fixes an error when updating cargo registry | ||
CARGO_NET_GIT_FETCH_WITH_CLI: 'true' | ||
|
||
|
||
.cargo:build-script: &cargo-build-script | ||
script: | ||
- rustc --version && cargo --version | ||
- cargo build | ||
|
||
|
||
.cargo-test-script: &cargo-test-script | ||
script: | ||
- rustc --version && cargo --version | ||
- cargo test --verbose | ||
|
||
|
||
cargo:build-stable: | ||
stage: build | ||
image: "rust:latest" | ||
<<: *cargo-build-script | ||
|
||
|
||
cargo:test-stable: | ||
stage: test | ||
image: "rust:latest" | ||
needs: | ||
- "cargo:build-stable" | ||
<<: *cargo-build-script | ||
|
||
|
||
cargo:build-nightly: | ||
stage: build | ||
image: rustlang/rust:nightly | ||
allow_failure: true | ||
<<: *cargo-build-script | ||
|
||
|
||
cargo:test-nightly: | ||
stage: test | ||
image: rustlang/rust:nightly | ||
needs: | ||
- cargo:build-nightly | ||
allow_failure: true | ||
<<: *cargo-test-script | ||
|
||
|
||
cargo:build-1.34: | ||
stage: build | ||
image: "akubera/rust-kcov:1.34.2-stretch" | ||
<<: *cargo-build-script | ||
|
||
cargo:test-1.34: | ||
stage: test | ||
needs: | ||
- cargo:build-1.34 | ||
image: "akubera/rust-kcov:1.34.2-stretch" | ||
allow_failure: true | ||
<<: *cargo-test-script | ||
|
||
|
||
cargo:build-1.42: | ||
stage: build | ||
image: "akubera/rust-kcov:1.42.0-buster" | ||
<<: *cargo-build-script | ||
|
||
cargo:test·1.42: | ||
stage: test | ||
needs: | ||
- "cargo:build-1.42" | ||
image: "akubera/rust-kcov:1.42.0-buster" | ||
<<: *cargo-test-script | ||
|
||
|
||
cargo:build-1.54: | ||
stage: build | ||
image: "akubera/rust-kcov:1.54.0-bullseye" | ||
<<: *cargo-build-script | ||
|
||
cargo:test·1.54: | ||
stage: test | ||
needs: | ||
- "cargo:build-1.54" | ||
image: "akubera/rust-kcov:1.54.0-bullseye" | ||
<<: *cargo-test-script | ||
|
||
|
||
cargo:build-1.68: | ||
stage: build | ||
image: "akubera/rust-grcov:1.68.2-bullseye" | ||
<<: *cargo-build-script | ||
|
||
cargo:test-1.68: | ||
stage: test | ||
needs: | ||
- "cargo:build-1.68" | ||
image: "akubera/rust-grcov:1.68.2-bullseye" | ||
<<: *cargo-test-script | ||
|
||
|
||
coverage-test: | ||
stage: test | ||
needs: | ||
- "cargo:test-1.68" | ||
image: "akubera/rust-grcov:1.68.2-bullseye" | ||
|
||
variables: | ||
CARGO_NET_GIT_FETCH_WITH_CLI: 'true' | ||
LLVM_PROFILE_FILE: "target/coverage/%p-%m.profraw" | ||
RUSTFLAGS: "-Cinstrument-coverage -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off " | ||
# RUSTDOCFLAGS: "-Cpanic=abort" | ||
CARGO_INCREMENTAL: "0" | ||
|
||
coverage: '/Code Coverage: \d+\.\d+/' | ||
script: | ||
- rustc --version && cargo --version | ||
- cargo test | ||
- ls -l target/coverage | ||
- grcov target/coverage --binary-path target/debug -s . --keep-only 'src/*' -tcobertura -o cobertura.xml | ||
- > | ||
grep -m1 -o 'line-rate="[^"]*' cobertura.xml | ||
| sed 's/[^0-9.]*//' | ||
| awk '{ print "Code Coverage: " $0 * 100 }' | ||
artifacts: | ||
reports: | ||
coverage_report: | ||
coverage_format: cobertura | ||
path: cobertura.xml | ||
|
||
|
||
cargo-publish: | ||
stage: deploy | ||
image: "rust:latest" | ||
when: manual | ||
only: | ||
- master | ||
allow_failure: true | ||
script: | ||
- cargo publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# bigdecimal-rs | ||
|
||
|
||
[](https://crates.io/crates/bigdecimal) | ||
[](https://docs.rs/bigdecimal) | ||
|
||
[](https://rust-lang.github.io/rfcs/2495-min-rust-version.html) | ||
|
||
[](https://gitlab.com/akubera/bigdecimal-rs/-/pipelines) | ||
[](https://gitlab.com/akubera/bigdecimal-rs/-/pipelines) | ||
[](https://gitlab.com/akubera/bigdecimal-rs/-/pipelines) | ||
|
||
|
||
Arbitary-precision decimal numbers implemented in pure Rust. | ||
|
||
## Usage | ||
|
||
Add bigdecimal as a dependency to your `Cargo.toml` file: | ||
|
||
```toml | ||
[dependencies] | ||
bigdecimal = "0.3" | ||
``` | ||
|
||
Import and use the `BigDecimal` struct to solve your problems: | ||
|
||
```rust | ||
use bigdecimal::BigDecimal; | ||
|
||
fn main() { | ||
let two = BigDecimal::from(2); | ||
println!("sqrt(2) = {}", two.sqrt().unwrap()); | ||
} | ||
``` | ||
|
||
this code will print | ||
|
||
``` | ||
sqrt(2) = 1.414213562373095048801688724209698078569671875376948073176679737990732478462107038850387534327641573 | ||
``` | ||
|
||
|
||
## Improvements | ||
|
||
Work is being done on this codebase again and there are many features | ||
and improvements on the way. | ||
|
||
|
||
## About | ||
|
||
This repository contains code originally meant for a bigdecimal module | ||
in the popular [num](https://crates.io/crates/num) crate, but was not | ||
merged due to uncertainty of what the best design for such a crate | ||
should be. | ||
|
||
|
||
## License | ||
|
||
This code is dual-licensed under the permissive | ||
[MIT](https://opensource.org/licenses/MIT) & | ||
[Apache 2.0](https://opensource.org/licenses/Apache-2.0) licenses. | ||
|
||
### Contribution | ||
|
||
Unless you explicitly state otherwise, any contribution intentionally | ||
submitted for inclusion in the work by you, as defined in the | ||
Apache-2.0 license, shall be dual licensed as above, without any | ||
additional terms or conditions. | ||
|
||
|
||
## Community | ||
|
||
Join the conversation on Zulip: https://bigdecimal-rs.zulipchat.com |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.