Convert data category from SI decimal (1000) to IEC binary (1024) units#4
Conversation
- Changed all data unit conversions from SI (decimal, base 1000) to IEC (binary, base 1024) - Updated conversion formulas in polyconvert.coffee to use Math.pow(1024, n) instead of 1e+n - Updated validation tests to expect binary values (1024, 1048576, etc.) - Updated README documentation to clarify binary units are used - All tests passing (2220 tests) Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
- Added binary unit constants (BYTES_PER_KIBIBYTE, etc.) for performance - Replaced Math.pow(1024, n) calls with pre-computed constants - Improves performance by avoiding repeated function calls - All 2220 tests still passing Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
- Changed exponentiation notation from ^ to explicit multiplication - Makes the formula more clear and easier to understand - All tests still passing Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
|
@copilot what about this section of the README dosn't it need to be updates as well? So, to use these functions, reference them through the polyconvert.data.bit.byte(100) // Returns 12.5 meaning that 100 bits equals 12.5 bytesTo reverse the conversion simply switch the order of the unit keys, like this: polyconvert.data.byte.bit(12.5) // Returns 100 meaning that 12.5 bytes equals 100 bits |
- Changed examples from bit/byte to kilobyte/byte conversions - Better demonstrates the IEC binary units (1 KiB = 1024 bytes) - Examples now showcase the main change in this PR Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
|
@copilot in both the README and the |
- Changed 1024*1024*1024 to 1024**3 for better readability - Updated polyconvert.coffee constants to use power notation - Updated README.md examples to use power notation - All 2220 tests passing with correct conversions Co-authored-by: jgphilpott <4128208+jgphilpott@users.noreply.github.com>
Updated both files to use power notation ( |
Plan: Update Data Category to Binary (IEC) Units
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.