Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Fraction to Binary Converter

NotificationsYou must be signed in to change notification settings

15dbooher/ftb

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

by Daniel Booher

This is a python script that converts a fraction or non-fractionDecimal Number (base 10) to the equivalentBinary Number (base 2).

Currently it cannot convert from binary to decimal.

If you'd like to add this feature, please feel free to do so

Usage

python ftb.py <fraction> <number of decimals>

fraction is the base-10 number that you would like to conver to binary (Note: if it's a fraction it must be indecimal form!)

number of decimals is the number of decimals (degree of accuracy) placed after the whole number part of the output binary number (Use 0 for whole numbers!)

Fraction Example

Input:python ftb.py 123.456 3

Output:1111011.011

Whole Number Example

Input:python ftb.py 123456 0

Output:11110001001000000

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp