mirror of
https://github.com/PaddiM8/kalker.git
synced 2024-12-13 10:00:51 +01:00
Print results in another base, if another base than 10 is used
This commit is contained in:
parent
7bce5409e6
commit
74d787fe5d
@ -6,7 +6,7 @@ pub(crate) const DEFAULT_PRECISION: u32 = 1024;
|
|||||||
pub fn eval(parser: &mut parser::Context, input: &str, precision: u32, base: u8, format: ScientificNotationFormat) {
|
pub fn eval(parser: &mut parser::Context, input: &str, precision: u32, base: u8, format: ScientificNotationFormat) {
|
||||||
match parser::eval(parser, input, precision) {
|
match parser::eval(parser, input, precision) {
|
||||||
Ok(Some(mut result)) => {
|
Ok(Some(mut result)) => {
|
||||||
if !result.set_radix(base) {
|
if base != 10 && !result.set_radix(base) {
|
||||||
print_err("Invalid base. Change it by typing eg. `base 10`.");
|
print_err("Invalid base. Change it by typing eg. `base 10`.");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@paddim8/kalk-component",
|
"name": "@paddim8/kalk-component",
|
||||||
"version": "2.1.0",
|
"version": "2.1.1",
|
||||||
"description": "A Svelte component for kalk, a calculator that supports user-defined functions and variables.",
|
"description": "A Svelte component for kalk, a calculator that supports user-defined functions and variables.",
|
||||||
"svelte": "src/main.ts",
|
"svelte": "src/main.ts",
|
||||||
"main": "public/build/bundle.js",
|
"main": "public/build/bundle.js",
|
||||||
|
Loading…
Reference in New Issue
Block a user