It is possible to print to several hundred decimal places a square root in bc, as it is in C. However in C it is only accurate to 15. I have checked the square root of 2 to 50 decimal places and it is accurate but what is the limit in bc? I can't find any reference to this.
To how many decimal places is bc accurate?
158 Views Asked by Ian Stewart At
1
There are 1 best solutions below
Related Questions in DECIMAL
- How to restrict EditText decimals to two? (Android studio/Kotlin)
- decimal128 ieee 754 combination/exponent
- Decimal to Binary program not working on my local machine but works perfectly on online compiler
- How do CAD applications handle out-of-range characters in SHX fonts?
- Ensure numeric display always has 2 decimal places
- Keeping Large Decimal to multiply with Float Pandas
- How to specify a float/decimal value for a column inside an insert in liquibase changelog?
- Data type mismatch in criteria expression for decimal with OleDbCommand
- Convert decimal to string with at least a zero for integer value in C#
- libdecnumber: decSingle vs decDouble/decQuad
- Conversation Index Child Block breakdown
- Stylization of decimals as uppercase in WooCommerce only in Single Product and Product Archive Pages
- Regex that finds both integers, decimals, and thousands separators
- Does 1. == 1.0 in numpy and pytorch?
- How do I get the value of a column to have a decimal length of 3 in sqlite3?
Related Questions in FLOATING-ACCURACY
- Float calculation problem. 12.7 - 20 + 7.3 not equal zero
- How much accuracy is lost due to representing time as a IEEE 754 binary64 number?
- ceil(double(int)*double) or ceil(float(int*double))?
- Fast implementation of complementary error function with 5-digit accuracy
- R: floating point errors in simple math operations
- Truncating decimal digits like Excel in python
- Calculating power of (1-1/x)^y for very large x,y
- Model Accuracy Using Transformer
- Why assignment changes the precision of calculation of MATLAB?
- Rounding errors when computing intersection between two lines in python
- Workarounds for High Floating-Point Error in NumPy Arrays Raised to Powers
- imshow plotting very large integers, but "dtype object cannot be converted to float"
- Precision in SVD calculation through eigenvalues/eigenvectors
- Conversion accuracy issues of E57 to LAS in Python using pye57 and laspy
- Without overflow and underflow, for a float number x, is x/4 always equals to x/2/2 (also for x*4 == x*2*2)?
Related Questions in BC
- Triple input redirection symbol in bash script
- Implementing cascading in business central for custom tables
- How to filter specific files on a list in folder comparison in BeyondCompare?
- I have built a CLI calculator in Bash and can't figure out why I am getting multiple incorrect calculatons even though I am usine BC
- Post sales order on custom table in AL language
- Beyond compare output option
- `printf "2+2" | bc` returns a syntax error, `echo "2+2" | bc` works, how are they handling strings differently?
- There will be messy code when redirect output of "top" command to a file
- Trouble making mathematical operations with big hexadecimal numbers on bash
- Syntax error while trying to generate a 2048bit long prime number
- How to let bash variable continue get value?
- linux shell scripting error: ./mp.sh: line 10: [: missing `]' File ] is unavailable
- To how many decimal places is bc accurate?
- Is there mathematical (or historical) motivation for including a Bessel function in the GNU bc math library?
- Set output size in bc library
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
bcis an arbitrary precision calculator. Arbitrary precision just tells us how many digits it can represent (as many as will fit in memory), but doesn't tell us anything about accuracy.C uses your processor's built-in floating point hardware. This is fast, but has a fixed number of bits to represent each number, so is obviously fixed rather than arbitrary precision.
Any arbitrary precision system will have more ... precision than this, but could of course still be inaccurate. Knowing how many digits can be stored doesn't tell us whether they're correct.
However, the GNU implementation of
bcis open source, so we can just see what it does.The
bc_sqrtfunction uses an iterative approximation (Newton's method, although the same technique was apparently known by the Babylonians in at least 1,000BC).This approximation is just run, improving each time, until two consecutive guesses differ by less than the precision requested. That is, if you ask for 1,000 digits, it'll keep going until the difference is at most in the 1,001st digit.
The only exception is when you ask for an N-digit result and the original number has more than N digits. It'll use the larger of the two as its target precision.
Since the convergence rate of this algorithm is faster than one digit per iteration, there seems little risk of two consecutive iterations agreeing to some N digits without also being correct to N digits.