Poweranimals
- 68
- 0
What is the best way to convert a fraction into a decimal. IE: 3/8?
The discussion focuses on converting the fraction 3/8 into its decimal representation using a pseudo program. The outlined algorithm involves iterative calculations to derive decimal digits, starting with an initial whole number and adjusting based on the results of multiplication and subtraction. Participants emphasize the limitations of standard computing methods, particularly in handling repeating decimals and precision issues inherent in languages like C/C++. The consensus suggests that while long division is the simplest method, the proposed algorithm can be useful for generating more precise decimal representations.
PREREQUISITESThis discussion is beneficial for mathematicians, software developers, and data scientists who require precise decimal conversions from fractions, particularly in programming environments with strict precision constraints.
cookiemonster said:The easiest way is to just long divide until you start getting 0's or you satisfy the number of digits you need.
cookiemonster
ophecleide said:Yeah, I can see that. If division is not an option, your program may be a viable option.
Integral said:Windows generates about 15 decimal digits so any fraction which requires more digits then this cannot be precisely computed by windows.