-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomplements.html
More file actions
116 lines (105 loc) · 5.39 KB
/
Copy pathcomplements.html
File metadata and controls
116 lines (105 loc) · 5.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Complement Calculator</title>
<link rel="stylesheet" href="assets/css/complements.css">
</head>
<body>
<div class="container">
<header>
<a class="back-btn" href="index.html" aria-label="Back to home" title="Back to home">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4">
<path stroke-linecap="round" stroke-linejoin="round" d="M15 18l-6-6 6-6" />
<path stroke-linecap="round" stroke-linejoin="round" d="M9 12h12" />
</svg>
</a>
<div>
<h1>Complement Calculator</h1>
<p class="subtitle">Radix-minus-one and radix complements for bases 2 to 36</p>
</div>
<div class="status-line" id="statusLine">
<span class="status-dot"></span>
<span id="statusText">Ready</span>
</div>
</header>
<div class="workspace">
<section class="panel">
<div class="control-stack">
<div>
<label for="inputValue">
<span>Number</span>
<span id="baseDisplay">Base 2</span>
</label>
<input type="text" id="inputValue" placeholder="101101" autocomplete="off">
</div>
<div class="split-row">
<div>
<label for="baseSelect">
<span>Base</span>
<span>2-36</span>
</label>
<select id="baseSelect" aria-label="Base"></select>
</div>
<div>
<label for="widthInput">
<span>Width</span>
<span>digits</span>
</label>
<input type="number" id="widthInput" min="1" max="256" value="8" inputmode="numeric">
</div>
</div>
<div class="base-shortcuts" aria-label="Base presets">
<button class="preset-btn" type="button" data-base="2">BIN</button>
<button class="preset-btn" type="button" data-base="8">OCT</button>
<button class="preset-btn" type="button" data-base="10">DEC</button>
<button class="preset-btn" type="button" data-base="16">HEX</button>
</div>
</div>
</section>
<section class="panel">
<div class="result-grid">
<div class="result-card primary">
<div class="result-topline">
<span class="result-title" id="minusOneTitle">1's complement</span>
<span class="result-formula" id="minusOneFormula">b - 1</span>
</div>
<div class="output-wrapper">
<input type="text" id="minusOneOutput" class="output-field" readonly placeholder="0">
<button class="copy-btn" type="button" data-copy="minusOneOutput" title="Copy result"
aria-label="Copy radix-minus-one complement">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M8 8h10v12H8z M6 16H4V4h12v2" />
</svg>
</button>
</div>
</div>
<div class="result-card">
<div class="result-topline">
<span class="result-title" id="radixTitle">2's complement</span>
<span class="result-formula" id="radixFormula">b^n - x</span>
</div>
<div class="output-wrapper">
<input type="text" id="radixOutput" class="output-field" readonly placeholder="0">
<button class="copy-btn" type="button" data-copy="radixOutput" title="Copy result"
aria-label="Copy radix complement">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
stroke="currentColor" stroke-width="2">
<path stroke-linecap="round" stroke-linejoin="round"
d="M8 8h10v12H8z M6 16H4V4h12v2" />
</svg>
</button>
</div>
</div>
</div>
<div class="normalized" id="normalizedValue">Padded input: 00000000</div>
</section>
</div>
</div>
<div id="toast" class="toast">Copied to clipboard!</div>
<script src="assets/js/complements.js"></script>
</body>
</html>