Skip to content

Commit

Permalink
base-converter: Tolerate spaces in IEEE representation
Browse files Browse the repository at this point in the history
  • Loading branch information
eliandoran committed Jul 12, 2024
1 parent 2c30acf commit 2885877
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/routes/base-converter/ieee754.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
}
function parseBinaryNotation(input) {
// Trim whitespace
input = input.replace(/[ ]/g, "");
const bytes = [];
while (input.length > 0) {
const byte = input.substring(0, 8);
Expand Down Expand Up @@ -54,11 +57,11 @@
</InputField>

<InputField label="32-bits (float)">
<input type="number" value={floatValue} on:input={(e) => onIeeeValueChanged(e, true)} />
<input type="text" value={floatValue} on:input={(e) => onIeeeValueChanged(e, true)} max="32" />
</InputField>

<InputField label="64-bits (double)">
<input type="number" value={doubleValue} on:input={(e) => onIeeeValueChanged(e, false)} />
<input type="text" value={doubleValue} on:input={(e) => onIeeeValueChanged(e, false)} max="64" />
</InputField>

<style>
Expand Down

0 comments on commit 2885877

Please sign in to comment.