Questions tagged [significant-digits]

Significant digits are a way of describing the precision of measurements in a scale-independent way.

Typically if a number is in normal scientific notation, the number of significant digits is the length (number of digits) of the mantissa or significand. The significant figures of a number are those digits that carry meaning contributing to its precision. This includes all digits except: All leading zeros, Trailing zeros when they are merely placeholders to indicate the scale of the number (exact rules are explained at Identifying significant figures), and spurious digits introduced, for example, by calculations carried out to greater precision than that of the original data, or measurements reported to a greater precision than the equipment supports.

Numbers are often rounded to avoid reporting insignificant figures. For instance, if a device measures to the nearest gram and gives a reading of 12.345 kg, it would create false precision to express this measurement as 12.34500 kg. Significant Figures - Wikipedia

178 questions
2
votes
3 answers

How to test approximate equality for a specific number significant digits in Julia

The isapprox() function in Julia is used to test if two numbers or arrays are approximately equal. I want to be able to test for approximate equality for any desired number of significant digits. As the code sample below demonstrates, the tolerance…
Pål Bjartan
  • 793
  • 1
  • 6
  • 18
2
votes
1 answer

Advanced rounding options with BigDecimal

I am writing a program that has to round very large and precise numbers (possibly many more significant digits than even double could handle), and am using BigDecimals. Is there a way to make BigDecimal round based on place and not significant…
donnyton
  • 5,874
  • 9
  • 42
  • 60
2
votes
1 answer

Inconsistencies Rounding Up with Ceiling Function

I have to round a data frame to two decimal places and the 1/100s decimal always needs to round up. However I am seeing some odd behavior with the ceiling function that I'm using. a <- c(268.600, 268.700, 268.500) b <- c(22.410, 653.423,…
2
votes
1 answer

How do you round a number to correct uncertainty?

In python, I have a number: U = 0.02462631224438585 +- 3.350971888120506e-06. How do I round it to the correct significant figures due to the uncertainty being rounded to 1s.f.? Is there an easy way of using numpy? Or scipy or are the built-in…
hi hi
  • 21
  • 3
2
votes
1 answer

SQL - return all float values in field without writing in scientific notation

I have a column with an extremely large set of values (>21k), with an undetermined amount of decimal places, some sample data (FLOAT) that exists: 6.46 0.784 8.05 86.4 2.64 0 2.14 1E-06 14.81 3.45 0.87243 0 1.12279 0 21.41 0.6243 I would like to…
Paniom
  • 25
  • 7
2
votes
4 answers

finding the number of significant digits versus digits after decimal in r

I would like to find the number of significant digits in a vector of numbers that can have very different scales. For example, the number 1000 has 1 digit; the number 100 also has 1. The number 1300 has 2. This is not to be confused with the number…
Omry Atia
  • 2,411
  • 2
  • 14
  • 27
2
votes
3 answers

How to increment fixed significant digit in Java?

I am not sure that Java has tools for it but if there is a solution in Java it would be awesome. For example, I need to increment fifth significant digit in Double / Decimal / BigDecimal or similar variable. // Left is what I have. Right is what I…
Oleksandr
  • 3,574
  • 8
  • 41
  • 78
2
votes
0 answers

How to represent values of Crypto-Coins (Bitcoins, etc...)

Problem I face: How to work with Money in PHP if currencies are Bitoins, Litecoins, Etherum and others alt-coins? This problem in case of fiat money is solved mostly by representing money as int in the smallest unit (cents, etc...). Implementation…
user3687470
2
votes
1 answer

Why output of cout << setprecision(2) << 0.999 is 1 instead of 1.0?

The significant digits is 2. Why the output of cout << setprecision(2) << 0.999 << endl;` is 1 instead of 1.0?
2
votes
1 answer

How to create a decimal.Decimal object with a given number of significant figures?

The best way I've found to produce a decimal.Decimal number with a specific number of significant figures is the one used to initialize the variable kluge below: import decimal THIS_IS_JUST_AN_EXAMPLE = 0.00001/3.0 with decimal.localcontext() as c: …
kjo
  • 33,683
  • 52
  • 148
  • 265
2
votes
2 answers

Significant figures in C++

I've written a program that calculates values in a series and all of the values are particularly lengthy doubles. I want to print these values each displaying 15 significant figures. Here's some code that illustrates the issue I'm having: #include…
treeno
  • 39
  • 1
  • 4
2
votes
0 answers

Formatting with two significant digits after comma in java

I am looking for a NumberFormat configuration that format with signifant digits only applied to the fraction parts (and not on both integer and fraction parts). Here are the expected results for the following examples (2 significants applied on the…
Rizen
  • 121
  • 4
2
votes
2 answers

Curious output using formatC with 2 significant digits

I want to format figures with 2 significant digits using formatC. But it has a strange behaviour. Here are the figures: (x <- data.frame( cil = c(1.234, 0.444, 0.712, 0.999, 1.999) , ciu = c(1.812, 1.234, 0.999, 1.199, 2.690) …
giordano
  • 2,954
  • 7
  • 35
  • 57
2
votes
1 answer

In Python how to find the least significant digit

I'm looking for, a hopefully simple way to find, the least significant digit in a number (float or integer). For example: 101 --> 1 101.2 --> 0.2 1.1003 --> 0.0003 Cases like 10, 100, 1000 etc are slightly less relevant, though I'd be interested…
Richard W
  • 322
  • 3
  • 13
2
votes
3 answers

Round number but keep exact digits

when I call this function like this Rounded(50.080, 3) Im getting "50.08" how can I force to keep the trailing zeros? Public Function Rounded(ByVal Number, ByVal Decimals) Rounded = Int(Number * 10 ^ Decimals + 1 / 2) / 10 ^ Decimals End…
XK8ER
  • 770
  • 1
  • 10
  • 25