diff --git a/kalk/src/kalk_num/regular.rs b/kalk/src/kalk_num/regular.rs index 57da65a..924578e 100644 --- a/kalk/src/kalk_num/regular.rs +++ b/kalk/src/kalk_num/regular.rs @@ -51,7 +51,10 @@ impl KalkNum { #[wasm_bindgen(js_name = toString)] pub fn to_string(&self) -> String { - self.value.to_string() + self.value + .to_string() + .trim_end_matches('0') + .trim_end_matches('.') } #[wasm_bindgen(js_name = toStringBig)] diff --git a/kalk_web/src/KalkCalculator.svelte b/kalk_web/src/KalkCalculator.svelte index 51a7568..8526e21 100644 --- a/kalk_web/src/KalkCalculator.svelte +++ b/kalk_web/src/KalkCalculator.svelte @@ -1,3 +1,5 @@ + + +
+
+ + {#each outputLines as line} + + {#if line[1]} + >> + {/if} + {@html line[0]} + + {/each} +
+
+ >>  + {#await import("@paddim8/kalk")} + Loading... + {:then kalk} +
handleKeyDown(event, kalk)} + on:keyup={handleKeyUp} + on:input={handleInput} + role="textbox" + /> + {:catch error} + {error} + {/await} +
+ {#if buttonpanel} +
+ + {#each buttonRowValues as value} + + {/each} + + {#if numberrow} + {#each numberRowValues as value} + + {/each} + {/if} +
+ {/if} +
+ - - -
-
- - {#each outputLines as line} - - {#if line[1]} - >> - {/if} - {@html line[0]} - - {/each} -
-
- >>  - {#await import('@paddim8/kalk')} - Loading... - {:then kalk} -
handleKeyDown(event, kalk)} - on:keyup={handleKeyUp} - on:input={handleInput} - role="textbox" /> - {:catch error} - {error} - {/await} -
- {#if buttonpanel} -
- - {#each buttonRowValues as value} - - {/each} - - {#if numberrow} - {#each numberRowValues as value} - - {/each} - {/if} -
- {/if} -