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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
|
| 4 |
+
<head>
|
| 5 |
+
<meta charset="UTF-8">
|
| 6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 7 |
+
<title>Nearest Integer Square Root Finder</title>
|
| 8 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
+
<style>
|
| 10 |
+
* {
|
| 11 |
+
margin: 0;
|
| 12 |
+
padding: 0;
|
| 13 |
+
box-sizing: border-box;
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
:root {
|
| 17 |
+
--primary: #6366f1;
|
| 18 |
+
--primary-dark: #4f46e5;
|
| 19 |
+
--secondary: #ec4899;
|
| 20 |
+
--background: #0f172a;
|
| 21 |
+
--surface: #1e293b;
|
| 22 |
+
--surface-light: #334155;
|
| 23 |
+
--text: #f8fafc;
|
| 24 |
+
--text-muted: #94a3b8;
|
| 25 |
+
--success: #22c55e;
|
| 26 |
+
--gradient: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
body {
|
| 30 |
+
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
| 31 |
+
background: var(--background);
|
| 32 |
+
min-height: 100vh;
|
| 33 |
+
color: var(--text);
|
| 34 |
+
display: flex;
|
| 35 |
+
flex-direction: column;
|
| 36 |
+
align-items: center;
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
header {
|
| 40 |
+
width: 100%;
|
| 41 |
+
padding: 1rem 2rem;
|
| 42 |
+
background: var(--surface);
|
| 43 |
+
border-bottom: 1px solid var(--surface-light);
|
| 44 |
+
display: flex;
|
| 45 |
+
justify-content: space-between;
|
| 46 |
+
align-items: center;
|
| 47 |
+
flex-wrap: wrap;
|
| 48 |
+
gap: 1rem;
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
.logo {
|
| 52 |
+
display: flex;
|
| 53 |
+
align-items: center;
|
| 54 |
+
gap: 0.75rem;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
.logo i {
|
| 58 |
+
font-size: 1.75rem;
|
| 59 |
+
background: var(--gradient);
|
| 60 |
+
-webkit-background-clip: text;
|
| 61 |
+
-webkit-text-fill-color: transparent;
|
| 62 |
+
background-clip: text;
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
.logo h1 {
|
| 66 |
+
font-size: 1.25rem;
|
| 67 |
+
font-weight: 600;
|
| 68 |
+
}
|
| 69 |
+
|
| 70 |
+
.built-with {
|
| 71 |
+
color: var(--text-muted);
|
| 72 |
+
font-size: 0.875rem;
|
| 73 |
+
text-decoration: none;
|
| 74 |
+
transition: color 0.3s ease;
|
| 75 |
+
display: flex;
|
| 76 |
+
align-items: center;
|
| 77 |
+
gap: 0.5rem;
|
| 78 |
+
}
|
| 79 |
+
|
| 80 |
+
.built-with:hover {
|
| 81 |
+
color: var(--primary);
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
main {
|
| 85 |
+
flex: 1;
|
| 86 |
+
display: flex;
|
| 87 |
+
flex-direction: column;
|
| 88 |
+
align-items: center;
|
| 89 |
+
justify-content: center;
|
| 90 |
+
padding: 2rem;
|
| 91 |
+
width: 100%;
|
| 92 |
+
max-width: 800px;
|
| 93 |
+
}
|
| 94 |
+
|
| 95 |
+
.calculator-card {
|
| 96 |
+
background: var(--surface);
|
| 97 |
+
border-radius: 1.5rem;
|
| 98 |
+
padding: 2.5rem;
|
| 99 |
+
width: 100%;
|
| 100 |
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
|
| 101 |
+
border: 1px solid var(--surface-light);
|
| 102 |
+
}
|
| 103 |
+
|
| 104 |
+
.card-header {
|
| 105 |
+
text-align: center;
|
| 106 |
+
margin-bottom: 2rem;
|
| 107 |
+
}
|
| 108 |
+
|
| 109 |
+
.card-header h2 {
|
| 110 |
+
font-size: 1.75rem;
|
| 111 |
+
margin-bottom: 0.5rem;
|
| 112 |
+
background: var(--gradient);
|
| 113 |
+
-webkit-background-clip: text;
|
| 114 |
+
-webkit-text-fill-color: transparent;
|
| 115 |
+
background-clip: text;
|
| 116 |
+
}
|
| 117 |
+
|
| 118 |
+
.card-header p {
|
| 119 |
+
color: var(--text-muted);
|
| 120 |
+
font-size: 0.95rem;
|
| 121 |
+
}
|
| 122 |
+
|
| 123 |
+
.input-group {
|
| 124 |
+
position: relative;
|
| 125 |
+
margin-bottom: 1.5rem;
|
| 126 |
+
}
|
| 127 |
+
|
| 128 |
+
.input-group label {
|
| 129 |
+
display: block;
|
| 130 |
+
margin-bottom: 0.5rem;
|
| 131 |
+
font-weight: 500;
|
| 132 |
+
color: var(--text-muted);
|
| 133 |
+
}
|
| 134 |
+
|
| 135 |
+
.input-wrapper {
|
| 136 |
+
position: relative;
|
| 137 |
+
display: flex;
|
| 138 |
+
gap: 0.75rem;
|
| 139 |
+
}
|
| 140 |
+
|
| 141 |
+
.input-wrapper input {
|
| 142 |
+
flex: 1;
|
| 143 |
+
padding: 1rem 1.25rem;
|
| 144 |
+
font-size: 1.25rem;
|
| 145 |
+
border: 2px solid var(--surface-light);
|
| 146 |
+
border-radius: 0.75rem;
|
| 147 |
+
background: var(--background);
|
| 148 |
+
color: var(--text);
|
| 149 |
+
transition: all 0.3s ease;
|
| 150 |
+
outline: none;
|
| 151 |
+
}
|
| 152 |
+
|
| 153 |
+
.input-wrapper input:focus {
|
| 154 |
+
border-color: var(--primary);
|
| 155 |
+
box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
|
| 156 |
+
}
|
| 157 |
+
|
| 158 |
+
.input-wrapper input::placeholder {
|
| 159 |
+
color: var(--text-muted);
|
| 160 |
+
}
|
| 161 |
+
|
| 162 |
+
.btn {
|
| 163 |
+
padding: 1rem 1.5rem;
|
| 164 |
+
font-size: 1rem;
|
| 165 |
+
font-weight: 600;
|
| 166 |
+
border: none;
|
| 167 |
+
border-radius: 0.75rem;
|
| 168 |
+
cursor: pointer;
|
| 169 |
+
transition: all 0.3s ease;
|
| 170 |
+
display: flex;
|
| 171 |
+
align-items: center;
|
| 172 |
+
gap: 0.5rem;
|
| 173 |
+
}
|
| 174 |
+
|
| 175 |
+
.btn-primary {
|
| 176 |
+
background: var(--gradient);
|
| 177 |
+
color: white;
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.btn-primary:hover {
|
| 181 |
+
transform: translateY(-2px);
|
| 182 |
+
box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
|
| 183 |
+
}
|
| 184 |
+
|
| 185 |
+
.btn-secondary {
|
| 186 |
+
background: var(--surface-light);
|
| 187 |
+
color: var(--text);
|
| 188 |
+
}
|
| 189 |
+
|
| 190 |
+
.btn-secondary:hover {
|
| 191 |
+
background: #475569;
|
| 192 |
+
}
|
| 193 |
+
|
| 194 |
+
.btn-random {
|
| 195 |
+
background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
|
| 196 |
+
color: white;
|
| 197 |
+
}
|
| 198 |
+
|
| 199 |
+
.btn-random:hover {
|
| 200 |
+
transform: translateY(-2px);
|
| 201 |
+
box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
|
| 202 |
+
}
|
| 203 |
+
|
| 204 |
+
.button-group {
|
| 205 |
+
display: flex;
|
| 206 |
+
gap: 0.75rem;
|
| 207 |
+
margin-top: 1rem;
|
| 208 |
+
flex-wrap: wrap;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
.result-container {
|
| 212 |
+
margin-top: 2rem;
|
| 213 |
+
padding: 2rem;
|
| 214 |
+
background: var(--background);
|
| 215 |
+
border-radius: 1rem;
|
| 216 |
+
border: 1px solid var(--surface-light);
|
| 217 |
+
display: none;
|
| 218 |
+
animation: fadeIn 0.5s ease;
|
| 219 |
+
}
|
| 220 |
+
|
| 221 |
+
.result-container.show {
|
| 222 |
+
display: block;
|
| 223 |
+
}
|
| 224 |
+
|
| 225 |
+
@keyframes fadeIn {
|
| 226 |
+
from {
|
| 227 |
+
opacity: 0;
|
| 228 |
+
transform: translateY(10px);
|
| 229 |
+
}
|
| 230 |
+
|
| 231 |
+
to {
|
| 232 |
+
opacity: 1;
|
| 233 |
+
transform: translateY(0);
|
| 234 |
+
}
|
| 235 |
+
}
|
| 236 |
+
|
| 237 |
+
.result-header {
|
| 238 |
+
display: flex;
|
| 239 |
+
align-items: center;
|
| 240 |
+
gap: 0.75rem;
|
| 241 |
+
margin-bottom: 1.5rem;
|
| 242 |
+
}
|
| 243 |
+
|
| 244 |
+
.result-header i {
|
| 245 |
+
font-size: 1.5rem;
|
| 246 |
+
color: var(--success);
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.result-header h3 {
|
| 250 |
+
font-size: 1.25rem;
|
| 251 |
+
}
|
| 252 |
+
|
| 253 |
+
.result-grid {
|
| 254 |
+
display: grid;
|
| 255 |
+
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
|
| 256 |
+
gap: 1rem;
|
| 257 |
+
}
|
| 258 |
+
|
| 259 |
+
.result-item {
|
| 260 |
+
background: var(--surface);
|
| 261 |
+
padding: 1.25rem;
|
| 262 |
+
border-radius: 0.75rem;
|
| 263 |
+
text-align: center;
|
| 264 |
+
border: 1px solid var(--surface-light);
|
| 265 |
+
transition: transform 0.3s ease;
|
| 266 |
+
}
|
| 267 |
+
|
| 268 |
+
.result-item:hover {
|
| 269 |
+
transform: translateY(-3px);
|
| 270 |
+
}
|
| 271 |
+
|
| 272 |
+
.result-item.highlight {
|
| 273 |
+
border-color: var(--primary);
|
| 274 |
+
background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(236, 72, 153, 0.1) 100%);
|
| 275 |
+
}
|
| 276 |
+
|
| 277 |
+
.result-label {
|
| 278 |
+
font-size: 0.85rem;
|
| 279 |
+
color: var(--text-muted);
|
| 280 |
+
margin-bottom: 0.5rem;
|
| 281 |
+
text-transform: uppercase;
|
| 282 |
+
letter-spacing: 0.05em;
|
| 283 |
+
}
|
| 284 |
+
|
| 285 |
+
.result-value {
|
| 286 |
+
font-size: 2rem;
|
| 287 |
+
font-weight: 700;
|
| 288 |
+
background: var(--gradient);
|
| 289 |
+
-webkit-background-clip: text;
|
| 290 |
+
-webkit-text-fill-color: transparent;
|
| 291 |
+
background-clip: text;
|
| 292 |
+
}
|
| 293 |
+
|
| 294 |
+
.result-item.highlight .result-value {
|
| 295 |
+
font-size: 2.5rem;
|
| 296 |
+
}
|
| 297 |
+
|
| 298 |
+
.result-sub {
|
| 299 |
+
font-size: 0.85rem;
|
| 300 |
+
color: var(--text-muted);
|
| 301 |
+
margin-top: 0.25rem;
|
| 302 |
+
}
|
| 303 |
+
|
| 304 |
+
.visualization {
|
| 305 |
+
margin-top: 2rem;
|
| 306 |
+
padding: 1.5rem;
|
| 307 |
+
background: var(--surface);
|
| 308 |
+
border-radius: 0.75rem;
|
| 309 |
+
border: 1px solid var(--surface-light);
|
| 310 |
+
}
|
| 311 |
+
|
| 312 |
+
.visualization h4 {
|
| 313 |
+
margin-bottom: 1rem;
|
| 314 |
+
color: var(--text-muted);
|
| 315 |
+
font-size: 0.9rem;
|
| 316 |
+
text-transform: uppercase;
|
| 317 |
+
letter-spacing: 0.05em;
|
| 318 |
+
}
|
| 319 |
+
|
| 320 |
+
.number-line {
|
| 321 |
+
position: relative;
|
| 322 |
+
height: 60px;
|
| 323 |
+
background: var(--background);
|
| 324 |
+
border-radius: 0.5rem;
|
| 325 |
+
margin: 1rem 0;
|
| 326 |
+
overflow: hidden;
|
| 327 |
+
}
|
| 328 |
+
|
| 329 |
+
.number-line-track {
|
| 330 |
+
position: absolute;
|
| 331 |
+
top: 50%;
|
| 332 |
+
left: 5%;
|
| 333 |
+
right: 5%;
|
| 334 |
+
height: 4px;
|
| 335 |
+
background: var(--surface-light);
|
| 336 |
+
border-radius: 2px;
|
| 337 |
+
transform: translateY(-50%);
|
| 338 |
+
}
|
| 339 |
+
|
| 340 |
+
.number-marker {
|
| 341 |
+
position: absolute;
|
| 342 |
+
top: 50%;
|
| 343 |
+
transform: translate(-50%, -50%);
|
| 344 |
+
display: flex;
|
| 345 |
+
flex-direction: column;
|
| 346 |
+
align-items: center;
|
| 347 |
+
transition: all 0.5s ease;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
.marker-dot {
|
| 351 |
+
width: 16px;
|
| 352 |
+
height: 16px;
|
| 353 |
+
border-radius: 50%;
|
| 354 |
+
background: var(--primary);
|
| 355 |
+
}
|
| 356 |
+
|
| 357 |
+
.marker-dot.input {
|
| 358 |
+
background: var(--secondary);
|
| 359 |
+
width: 20px;
|
| 360 |
+
height: 20px;
|
| 361 |
+
box-shadow: 0 0 20px rgba(236, 72, 153, 0.5);
|
| 362 |
+
}
|
| 363 |
+
|
| 364 |
+
.marker-dot.nearest {
|
| 365 |
+
background: var(--success);
|
| 366 |
+
width: 24px;
|
| 367 |
+
height: 24px;
|
| 368 |
+
box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
|
| 369 |
+
}
|
| 370 |
+
|
| 371 |
+
.marker-label {
|
| 372 |
+
position: absolute;
|
| 373 |
+
font-size: 0.75rem;
|
| 374 |
+
white-space: nowrap;
|
| 375 |
+
color: var(--text-muted);
|
| 376 |
+
}
|
| 377 |
+
|
| 378 |
+
.marker-label.top {
|
| 379 |
+
bottom: 100%;
|
| 380 |
+
margin-bottom: 0.5rem;
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
.marker-label.bottom {
|
| 384 |
+
top: 100%;
|
| 385 |
+
margin-top: 0.5rem;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
.formula-display {
|
| 389 |
+
margin-top: 1.5rem;
|
| 390 |
+
padding: 1rem;
|
| 391 |
+
background: var(--background);
|
| 392 |
+
border-radius: 0.5rem;
|
| 393 |
+
font-family: 'Courier New', monospace;
|
| 394 |
+
font-size: 0.9rem;
|
| 395 |
+
color: var(--text-muted);
|
| 396 |
+
text-align: center;
|
| 397 |
+
}
|
| 398 |
+
|
| 399 |
+
.formula-display span {
|
| 400 |
+
color: var(--primary);
|
| 401 |
+
font-weight: 600;
|
| 402 |
+
}
|
| 403 |
+
|
| 404 |
+
.error-message {
|
| 405 |
+
color: #ef4444;
|
| 406 |
+
font-size: 0.875rem;
|
| 407 |
+
margin-top: 0.5rem;
|
| 408 |
+
display: none;
|
| 409 |
+
}
|
| 410 |
+
|
| 411 |
+
.error-message.show {
|
| 412 |
+
display: block;
|
| 413 |
+
animation: shake 0.5s ease;
|
| 414 |
+
}
|
| 415 |
+
|
| 416 |
+
@keyframes shake {
|
| 417 |
+
|
| 418 |
+
0%,
|
| 419 |
+
100% {
|
| 420 |
+
transform: translateX(0);
|
| 421 |
+
}
|
| 422 |
+
|
| 423 |
+
25% {
|
| 424 |
+
transform: translateX(-5px);
|
| 425 |
+
}
|
| 426 |
+
|
| 427 |
+
75% {
|
| 428 |
+
transform: translateX(5px);
|
| 429 |
+
}
|
| 430 |
+
}
|
| 431 |
+
|
| 432 |
+
footer {
|
| 433 |
+
width: 100%;
|
| 434 |
+
padding: 1.5rem;
|
| 435 |
+
text-align: center;
|
| 436 |
+
color: var(--text-muted);
|
| 437 |
+
font-size: 0.875rem;
|
| 438 |
+
border-top: 1px solid var(--surface-light);
|
| 439 |
+
}
|
| 440 |
+
|
| 441 |
+
@media (max-width: 600px) {
|
| 442 |
+
.calculator-card {
|
| 443 |
+
padding: 1.5rem;
|
| 444 |
+
}
|
| 445 |
+
|
| 446 |
+
.card-header h2 {
|
| 447 |
+
font-size: 1.5rem;
|
| 448 |
+
}
|
| 449 |
+
|
| 450 |
+
.input-wrapper {
|
| 451 |
+
flex-direction: column;
|
| 452 |
+
}
|
| 453 |
+
|
| 454 |
+
.btn {
|
| 455 |
+
width: 100%;
|
| 456 |
+
justify-content: center;
|
| 457 |
+
}
|
| 458 |
+
|
| 459 |
+
.button-group {
|
| 460 |
+
flex-direction: column;
|
| 461 |
+
}
|
| 462 |
+
|
| 463 |
+
.result-value {
|
| 464 |
+
font-size: 1.5rem;
|
| 465 |
+
}
|
| 466 |
+
|
| 467 |
+
.result-item.highlight .result-value {
|
| 468 |
+
font-size: 2rem;
|
| 469 |
+
}
|
| 470 |
+
}
|
| 471 |
+
</style>
|
| 472 |
+
</head>
|
| 473 |
+
|
| 474 |
+
<body>
|
| 475 |
+
<header>
|
| 476 |
+
<div class="logo">
|
| 477 |
+
<i class="fas fa-square-root-variable"></i>
|
| 478 |
+
<h1>Square Root Finder</h1>
|
| 479 |
+
</div>
|
| 480 |
+
<a href="https://huggingface.co/spaces/akhaliq/anycoder" class="built-with" target="_blank">
|
| 481 |
+
<i class="fas fa-code"></i>
|
| 482 |
+
Built with anycoder
|
| 483 |
+
</a>
|
| 484 |
+
</header>
|
| 485 |
+
|
| 486 |
+
<main>
|
| 487 |
+
<div class="calculator-card">
|
| 488 |
+
<div class="card-header">
|
| 489 |
+
<h2><i class="fas fa-calculator"></i> Nearest Integer Square Root</h2>
|
| 490 |
+
<p>Enter any positive number to find its nearest integer square root</p>
|
| 491 |
+
</div>
|
| 492 |
+
|
| 493 |
+
<div class="input-group">
|
| 494 |
+
<label for="numberInput">Enter a positive number</label>
|
| 495 |
+
<div class="input-wrapper">
|
| 496 |
+
<input type="number" id="numberInput" placeholder="e.g., 50" min="0" step="any">
|
| 497 |
+
<button class="btn btn-primary" onclick="calculateSquareRoot()">
|
| 498 |
+
<i class="fas fa-calculator"></i>
|
| 499 |
+
Calculate
|
| 500 |
+
</button>
|
| 501 |
+
</div>
|
| 502 |
+
<p class="error-message" id="errorMessage">Please enter a valid positive number</p>
|
| 503 |
+
</div>
|
| 504 |
+
|
| 505 |
+
<div class="button-group">
|
| 506 |
+
<button class="btn btn-random" onclick="generateRandom()">
|
| 507 |
+
<i class="fas fa-dice"></i>
|
| 508 |
+
Random Number
|
| 509 |
+
</button>
|
| 510 |
+
<button class="btn btn-secondary" onclick="clearAll()">
|
| 511 |
+
<i class="fas fa-eraser"></i>
|
| 512 |
+
Clear
|
| 513 |
+
</button>
|
| 514 |
+
</div>
|
| 515 |
+
|
| 516 |
+
<div class="result-container" id="resultContainer">
|
| 517 |
+
<div class="result-header">
|
| 518 |
+
<i class="fas fa-check-circle"></i>
|
| 519 |
+
<h3>Results</h3>
|
| 520 |
+
</div>
|
| 521 |
+
|
| 522 |
+
<div class="result-grid">
|
| 523 |
+
<div class="result-item">
|
| 524 |
+
<div class="result-label">Input Number</div>
|
| 525 |
+
<div class="result-value" id="inputNumber">-</div>
|
| 526 |
+
</div>
|
| 527 |
+
<div class="result-item">
|
| 528 |
+
<div class="result-label">Exact Square Root</div>
|
| 529 |
+
<div class="result-value" id="exactRoot">-</div>
|
| 530 |
+
</div>
|
| 531 |
+
<div class="result-item highlight">
|
| 532 |
+
<div class="result-label">Nearest Integer β</div>
|
| 533 |
+
<div class="result-value" id="nearestRoot">-</div>
|
| 534 |
+
<div class="result-sub" id="nearestSquare">-</div>
|
| 535 |
+
</div>
|
| 536 |
+
<div class="result-item">
|
| 537 |
+
<div class="result-label">Difference</div>
|
| 538 |
+
<div class="result-value" id="difference">-</div>
|
| 539 |
+
</div>
|
| 540 |
+
</div>
|
| 541 |
+
|
| 542 |
+
<div class="visualization">
|
| 543 |
+
<h4><i class="fas fa-chart-line"></i> Visual Representation</h4>
|
| 544 |
+
<div class="number-line">
|
| 545 |
+
<div class="number-line-track"></div>
|
| 546 |
+
<div class="number-marker" id="lowerMarker" style="left: 20%;">
|
| 547 |
+
<div class="marker-dot"></div>
|
| 548 |
+
<span class="marker-label top" id="lowerLabel">-</span>
|
| 549 |
+
<span class="marker-label bottom" id="lowerSquare">-</span>
|
| 550 |
+
</div>
|
| 551 |
+
<div class="number-marker" id="inputMarker" style="left: 50%;">
|
| 552 |
+
<div class="marker-dot input"></div>
|
| 553 |
+
<span class="marker-label top" id="inputLabel">Input</span>
|
| 554 |
+
</div>
|
| 555 |
+
<div class="number-marker" id="upperMarker" style="left: 80%;">
|
| 556 |
+
<div class="marker-dot"></div>
|
| 557 |
+
<span class="marker-label top" id="upperLabel">-</span>
|
| 558 |
+
<span class="marker-label bottom" id="upperSquare">-</span>
|
| 559 |
+
</div>
|
| 560 |
+
</div>
|
| 561 |
+
<div class="formula-display" id="formulaDisplay">
|
| 562 |
+
β<span>n</span> β <span>result</span>
|
| 563 |
+
</div>
|
| 564 |
+
</div>
|
| 565 |
+
</div>
|
| 566 |
+
</div>
|
| 567 |
+
</main>
|
| 568 |
+
|
| 569 |
+
<footer>
|
| 570 |
+
<p>Β© 2024 Square Root Finder | Mathematical precision at your fingertips</p>
|
| 571 |
+
</footer>
|
| 572 |
+
|
| 573 |
+
<script>
|
| 574 |
+
const numberInput = document.getElementById('numberInput');
|
| 575 |
+
const resultContainer = document.getElementById('resultContainer');
|
| 576 |
+
const errorMessage = document.getElementById('errorMessage');
|
| 577 |
+
|
| 578 |
+
numberInput.addEventListener('keypress', function(e) {
|
| 579 |
+
if (e.key === 'Enter') {
|
| 580 |
+
calculateSquareRoot();
|
| 581 |
+
}
|
| 582 |
+
});
|
| 583 |
+
|
| 584 |
+
function calculateSquareRoot() {
|
| 585 |
+
const input = parseFloat(numberInput.value);
|
| 586 |
+
|
| 587 |
+
// Validate input
|
| 588 |
+
if (isNaN(input) || input < 0) {
|
| 589 |
+
showError();
|
| 590 |
+
return;
|
| 591 |
+
}
|
| 592 |
+
|
| 593 |
+
hideError();
|
| 594 |
+
|
| 595 |
+
// Calculate values
|
| 596 |
+
const exactRoot = Math.sqrt(input);
|
| 597 |
+
const floorRoot = Math.floor(exactRoot);
|
| 598 |
+
const ceilRoot = Math.ceil(exactRoot);
|
| 599 |
+
|
| 600 |
+
// Determine nearest integer square root
|
| 601 |
+
let nearestRoot;
|
| 602 |
+
if (exactRoot === floorRoot) {
|
| 603 |
+
nearestRoot = floorRoot;
|
| 604 |
+
} else {
|
| 605 |
+
const floorDiff = Math.abs(input - (floorRoot * floorRoot));
|
| 606 |
+
const ceilDiff = Math.abs(input - (ceilRoot * ceilRoot));
|
| 607 |
+
nearestRoot = floorDiff <= ceilDiff ? floorRoot : ceilRoot;
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
const nearestSquare = nearestRoot * nearestRoot;
|
| 611 |
+
const difference = Math.abs(input - nearestSquare);
|
| 612 |
+
|
| 613 |
+
// Update display
|
| 614 |
+
document.getElementById('inputNumber').textContent = formatNumber(input);
|
| 615 |
+
document.getElementById('exactRoot').textContent = formatNumber(exactRoot, 6);
|
| 616 |
+
document.getElementById('nearestRoot').textContent = nearestRoot;
|
| 617 |
+
document.getElementById('nearestSquare').textContent = `(${nearestRoot}Β² = ${nearestSquare})`;
|
| 618 |
+
document.getElementById('difference').textContent = formatNumber(difference, 4);
|
| 619 |
+
|
| 620 |
+
// Update visualization
|
| 621 |
+
updateVisualization(input, floorRoot, ceilRoot, nearestRoot);
|
| 622 |
+
|
| 623 |
+
// Update formula display
|
| 624 |
+
document.getElementById('formulaDisplay').innerHTML =
|
| 625 |
+
`β<span>${formatNumber(input)}</span> = <span>${formatNumber(exactRoot, 6)}</span> β <span>${nearestRoot}</span>`;
|
| 626 |
+
|
| 627 |
+
// Show results
|
| 628 |
+
resultContainer.classList.add('show');
|
| 629 |
+
}
|
| 630 |
+
|
| 631 |
+
function updateVisualization(input, floorRoot, ceilRoot, nearestRoot) {
|
| 632 |
+
const lowerMarker = document.getElementById('lowerMarker');
|
| 633 |
+
const inputMarker = document.getElementById('inputMarker');
|
| 634 |
+
const upperMarker = document.getElementById('upperMarker');
|
| 635 |
+
|
| 636 |
+
const lowerSquare = floorRoot * floorRoot;
|
| 637 |
+
const upperSquare = ceilRoot * ceilRoot;
|
| 638 |
+
|
| 639 |
+
// Handle perfect squares
|
| 640 |
+
if (floorRoot === ceilRoot) {
|
| 641 |
+
lowerMarker.style.left = '30%';
|
| 642 |
+
inputMarker.style.left = '50%';
|
| 643 |
+
upperMarker.style.left = '70%';
|
| 644 |
+
|
| 645 |
+
document.getElementById('lowerLabel').textContent = `β${lowerSquare} = ${floorRoot}`;
|
| 646 |
+
document.getElementById('lowerSquare').textContent = 'Perfect Square!';
|
| 647 |
+
document.getElementById('upperLabel').textContent = `β${(floorRoot + 1) * (floorRoot + 1)} = ${floorRoot + 1}`;
|
| 648 |
+
document.getElementById('upperSquare').textContent = `${(floorRoot + 1) * (floorRoot + 1)}`;
|
| 649 |
+
} else {
|
| 650 |
+
// Calculate positions
|
| 651 |
+
const range = upperSquare - lowerSquare;
|
| 652 |
+
const inputPosition = ((input - lowerSquare) / range) * 60 + 20;
|
| 653 |
+
|
| 654 |
+
lowerMarker.style.left = '20%';
|
| 655 |
+
inputMarker.style.left = `${Math.min(80, Math.max(20, inputPosition))}%`;
|
| 656 |
+
upperMarker.style.left = '80%';
|
| 657 |
+
|
| 658 |
+
document.getElementById('lowerLabel').textContent = `β${lowerSquare} = ${floorRoot}`;
|
| 659 |
+
document.getElementById('lowerSquare').textContent = `${lowerSquare}`;
|
| 660 |
+
document.getElementById('upperLabel').textContent = `β${upperSquare} = ${ceilRoot}`;
|
| 661 |
+
document.getElementById('upperSquare').textContent = `${upperSquare}`;
|
| 662 |
+
}
|
| 663 |
+
|
| 664 |
+
document.getElementById('inputLabel').textContent = formatNumber(input);
|
| 665 |
+
|
| 666 |
+
// Highlight nearest
|
| 667 |
+
const lowerDot = lowerMarker.querySelector('.marker-dot');
|
| 668 |
+
const upperDot = upperMarker.querySelector('.marker-dot');
|
| 669 |
+
|
| 670 |
+
lowerDot.classList.remove('nearest');
|
| 671 |
+
upperDot.classList.remove('nearest');
|
| 672 |
+
|
| 673 |
+
if (nearestRoot === floorRoot) {
|
| 674 |
+
lowerDot.classList.add('nearest');
|
| 675 |
+
} else {
|
| 676 |
+
upperDot.classList.add('nearest');
|
| 677 |
+
}
|
| 678 |
+
}
|
| 679 |
+
|
| 680 |
+
function generateRandom() {
|
| 681 |
+
const random = Math.floor(Math.random() * 10000) + 1;
|
| 682 |
+
numberInput.value = random;
|
| 683 |
+
calculateSquareRoot();
|
| 684 |
+
}
|
| 685 |
+
|
| 686 |
+
function clearAll() {
|
| 687 |
+
numberInput.value = '';
|
| 688 |
+
resultContainer.classList.remove('show');
|
| 689 |
+
hideError();
|
| 690 |
+
}
|
| 691 |
+
|
| 692 |
+
function showError() {
|
| 693 |
+
errorMessage.classList.add('show');
|
| 694 |
+
numberInput.style.borderColor = '#ef4444';
|
| 695 |
+
}
|
| 696 |
+
|
| 697 |
+
function hideError() {
|
| 698 |
+
errorMessage.classList.remove('show');
|
| 699 |
+
numberInput.style.borderColor = '';
|
| 700 |
+
}
|
| 701 |
+
|
| 702 |
+
function formatNumber(num, decimals = 2) {
|
| 703 |
+
if (Number.isInteger(num)) {
|
| 704 |
+
return num.toString();
|
| 705 |
+
}
|
| 706 |
+
return parseFloat(num.toFixed(decimals)).toString();
|
| 707 |
+
}
|
| 708 |
+
|
| 709 |
+
// Initial animation
|
| 710 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 711 |
+
numberInput.focus();
|
| 712 |
+
});
|
| 713 |
+
</script>
|
| 714 |
+
</body>
|
| 715 |
+
|
| 716 |
+
</html>
|