binary,floating-point,decimal,floating-point-precision,significant-digits

The precision is fixed, which is exactly 53 binary digits for double-precision (or 52 if we exclude the implicit leading 1). This comes out to about 15 decimal digits. The OP asked me to elaborate on why having exactly 53 binary digits means "about" 15 decimal digits. To understand this...

To illustrate what I was saying in my comment, you can do : x$ci<-with(x,paste("(", format(cil,digits=2,nsmall=2), "-", format(ciu,digits=2,nsmall=2),")")) > x case cil ciu ci 1 A 1.234 1.812 ( 1.23 - 1.81 ) 2 B 0.444 1.234 ( 0.44 - 1.23 ) 3 C 0.712 0.999 ( 0.71 - 1.00 )...

x <- c(4, 28.382, 120, 82.3, 100, 30.0003) #compare the values with result of signif #you need to consider floating point precision keep <- abs(signif(x, 1) - x) > .Machine$double.eps x[keep] #[1] 28.3820 120.0000 82.3000 30.0003 ...

matlab,matrix,precision,significant-digits

maybe something simple like this? m = [10 15.675; 13.5 34.987; 20 55.5]; file = fopen('file.txt', 'w'); for ii = 1:size(m, 1) fprintf(file, '%0.1f %0.2f\n', m(ii, 1), m(ii, 2)); end I've edited to add the '\n'...

c#,string-formatting,significant-digits

See this link on G-Format Specifier. It clearly states: The result contains a decimal point if required, and trailing zeros after the decimal point are omitted. ...

java,string,digits,significant-digits

If in your current locale the decimal separator is a dot then you will get 0.920. If you want to get the result independent from you current locale to have as decimal separator a comma and as thousand separator a dot you could achieve it for example like this String...

r,export,xtable,significant-digits,reporters

Define a helper function that will look for a signature of a p-value, which I am taking to be those colnames that have "Pr" in them: xtable2 <- function(x, ...) { sm <- x[['coefficients']]; ncol <- ncol(sm) whch<- grep("Pr", colnames(sm)) digs <- rep(4, ncol+1); digs[whch+1] <- 2 disp <-rep("f", ncol+1);...

floating-point,double,ieee-754,floating-point-conversion,significant-digits

First, for this question it is better to use the total significand sizes 24 and 53. The fact that the leading bit is not represented is just an aspect of the encoding. If you are interested only in a vague explanation, one decimal digits contains exactly log2(10) (about 3.32) bits...

matlab,vector,decimal-point,significant-digits

First, read the MATLAB documentation on Floating Point values, paying special attention to the section on floating point error and precision: MATLAB Floating Point You are encountering a incredibly common issue with floating-point precision. It is important to recognize you are not in fact comparing: >> a = 0.6; >>...

c++,binary,decimal,floating-point-precision,significant-digits

what is the most significant decimal digits precision that can be converted to binary and back to decimal without loss of significance? The most significant decimal digits precision that can be converted to binary and back to decimal without loss of significance (for single-precision floating-point numbers or 24-bits) is...