កម្មវិធីបម្លែងមូលដ្ឋានលេខ
បម្លែងលេខរវាងប្រព័ន្ធគោលពីរ ប្រព័ន្ធប្រាំមួយ ប្រព័ន្ធដប់ និងប្រព័ន្ធដប់ប្រាំមួយ ។
លទ្ធផលធ្វើឲ្យទាន់សម័យតាមដែលអ្នកវាយ ។
អំពីម៉ាស៊ីនគិតលេខនេះ
A number base converter rewrites an integer from one positional base to another — binary (base 2), octal (base 8), decimal (base 10) and hexadecimal (base 16). It reads your value in the source base, works out its plain decimal value, and re-expresses that value in the target base.
Each base uses a fixed set of digits: 0–1 for binary, 0–7 for octal, 0–9 for decimal and 0–9 then A–F for hexadecimal, where A–F stand for 10–15. Because 16 is 2⁴, each hex digit maps to exactly four binary digits, which is why programmers use hex as shorthand for raw bytes.
Worked example: the decimal number 255 is 11111111 in binary and FF in hexadecimal, since 255 = 15×16 + 15. The converter also reports the intermediate decimal value so you can check the working. A results table shows the same number in all four bases at once, and an invalid digit for the chosen source base is flagged rather than silently miscounted.
សំណួរដែលសួរញឹកញាប់
តើខ្ញុំបម្លែងទសភាគទៅគោលពីរដោយរបៀបណា ?
Repeatedly divide by 2 and read the remainders from bottom to top. For example 10 in decimal is 1010 in binary, and 255 is 11111111.
តើអ្វីជាប្រព័ន្ធគោលដប់ប្រាំមួយដែលបានប្រើសម្រាប់ ?
Hexadecimal (មូលដ្ឋាន 16) វេចខ្ចប់បំណែក binary ចំនួនបួនចូលទៅក្នុងតួលេខមួយ (0-9 បន្ទាប់មក A-F), ដូច្នេះវាជាវិធីសាមញ្ញដើម្បីសរសេរបៃ. ចំនួនទសភាគ 255 គឺ FF ក្នុង hex.
ហេតុអ្វីបានជាលេខរបស់ខ្ញុំបង្ហាញសញ្ញាក្បៀស ?
តួលេខត្រូវតែត្រឹមត្រូវសម្រាប់មូលដ្ឋានប្រភព ឧទាហរណ៍តែ0និង 1 ក្នុងប្រព័ន្ធគោលពីរ ឬ 0-9និង A-F ក្នុងប្រព័ន្ធគោលប្រាំមួយ ។ តួលេខមិនត្រឹមត្រូវធ្វើឲ្យលទ្ធផលមិនបានកំណត់ ។
តើតួអក្សរ A ទៅ F មានន័យយ៉ាងដូចម្តេចក្នុងប្រព័ន្ធគោលដប់ប្រាំមួយ ?
ពួកគេជាតួលេខតែមួយសម្រាប់តម្លៃ 10 តាមរយៈ 15: A គឺ 10, B គឺ 11, រហូតដល់ F ដែលគឺ 15. នេះអនុញ្ញាតឲ្យមូលដ្ឋាន 16 សមលេខរហូតដល់ 15 ទៅក្នុងកន្លែងមួយមុនពេលវាត្រូវបានដឹកជញ្ជូន ។
ហេតុអ្វីបានជាតួលេខគោលដប់ប្រាំមួយនីមួយៗស្មើនឹងតួលេខគោលពីរបួន ?
Because 16 equals 2 to the fourth power, every hexadecimal digit covers exactly four bits. So the byte 11111111 groups into 1111 1111, which is FF — this number base converter does that grouping for you.
តើកម្មវិធីបម្លែងនេះអាចដោះស្រាយចំនួនធំបានឬ ?
វាធ្វើការលើចំនួនទាំងមូល ហើយគឺត្រឹមត្រូវរហូតដល់ជួរចំនួនគត់ត្រូវបានរក្សាទុកយ៉ាងត្រឹមត្រូវ (ប្រហែល ៩ គីឡូក្រាម ឬ 2⁵³) ។ លើសពីនោះ ខ្សែអក្សរគោលពីរវែងបំផុត ឬ ខ្សែអក្សរគោលដប់ប្រាំមួយអាចបាត់បង់ភាពត្រឹមត្រូវនៅក្នុងតួលេខចុងក្រោយរបស់ពួកគេ ។
API — ប្រើម៉ាស៊ីនគិតលេខនេះពីកូដ
ទូរស័ព្ទទៅម៉ាស៊ីនគិតលេខនេះជាចំណុចបញ្ចប់ JSON ឥតគិតថ្លៃ - គ្មានគ្រាប់ចុចដែលត្រូវការ ។ ផ្ញើតម្លៃវាលខាងក្រោមជាប៉ារ៉ាម៉ែត្រសំណួរ ឬ JSON ។ អ្វីដែលអ្នករំលងប្រើលំនាំដើមដូចគ្នាដែលទំព័រនេះត្រូវបានបំពេញជាមុនជាមួយប៉ារ៉ាម៉ែត្រមិនស្គាល់គឺ ៤០០ មិនមែនសូន្យស្ងាត់ទេ ។ អានឯកសារ API ពេញលេញ →
ចំណុចបញ្ចប់
GET https://calculator.free/api/v1/number-base/
curl
curl "https://calculator.free/api/v1/number-base/?amount=255&from=10&to=2"
JavaScript fetch()
const r = await fetch(
"https://calculator.free/api/v1/number-base/?" + new URLSearchParams({
"amount": "255",
"from": "10",
"to": "2"
}));
const data = await r.json();
console.log(data.results);
លទ្ធផលគឺការប៉ាន់ប្រមាណសម្រាប់តែការណែនាំទូទៅប៉ុណ្ណោះ, មិនហិរញ្ញវត្ថុ, វេជ្ជសាស្ត្រឬដំបូន្មានពន្ធ.