2

I would like to know if there is a well-known function that behaves in a manner best illustrated with reference to the following (completely hypothetical) weighing machine.

The weighing machine has a super-extended digital display stretching left and right. It takes a weight $w$, and a single parameter $d$. As will become apparent, the machine effectively weighs in units of $d$.

Specifically, with parameter $d=100$, the machine has a piece of paper obscuring (i.e., taking neither floor nor ceiling, nor rounding), all the digits to the right of the 100s indicator. Given a weight $w=82631.35698789$ grams, the machine effectively shows 82600, since the digits to the right of the $6$ are unobservable.

A similar machine with parameter $d= \frac{1}{1000}$ obscures all the digits to the right of the third decimal place, again taking neither floor, nor ceiling, nor rounding. Given the same object as previously, with weight $w=82631.35698789$ grams, the machine returns $82631.356$ .

Note: Please don't focus too much on the hypothetical machine or the fact that it shows digits in base $10$. I'd be happy to learn of a similar function that dealt in bits (!) or any other base.

I've indicated significant-figures as a keyword ... which is of the right flavor, but certainly not correct!

CrimsonDark
  • 241
  • 1
  • 8

1 Answers1

4

The well-known Method is "truncation" which is very similar to rounding , but easier , hence less accurate.

$ trunc(x,n) = \frac{ \lfloor { x 10^n } \rfloor } { 10^n } $

$trunc(82631.35698789,-2)=82600$

$trunc(82631.35698789,3)=82631.356$

Here $x$ is the number we want to truncate , while $n$ is the number of Digits to the right of the Decimal Point.

We can , of course , use some other Base too. Binary truncation is very common in C Programming.

We have to check the Case where $x$ is negative , where the output will not match rounding methods.

A few references:
https://www.ualberta.ca/computing-science/media-library/teaching-resources/java/truncation-rounding.html
https://en.wikipedia.org/wiki/Truncation

amWhy
  • 210,739
Prem
  • 14,696
  • Many, many thanks! All so obvious (as so many things are) ... *now that you've said it*! And yet I had found it impossible to work out what to search for. – CrimsonDark Dec 25 '22 at 23:27