Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Rounding is usually done by rounding up values that have a fractional part that is at least 0.5, and rounding down values that have a

Rounding is usually done by rounding up values that have a fractional part that is at least 0.5, and rounding down values that have a fractional part of less than 0.5. This means 14.55 is rounded to 15, while 2.3 is rounded to 2. C/C++ does not have a rounding function. However, rounding can be achieved using the following math (the floor (Links to an external site.) of x plus half): LaTeX: \mathrm{round}(x)=\lfloor x+\frac{1}{2} floor = \lfloor \frac{2x+1}{2} floorr o u n d ( x ) = x + 1 2 = 2 x + 1 2 In the process of converting base-10 scientific notation to base-2 scientific notation, it not uncommon that we need to divide numbers by 10, and rounding can be integrated in the division: LaTeX: \mathrm{round }(\frac{x}{10}) =\lfloor \frac{x}{10} + \frac{1}{2} floor = \lfloor \frac{x+5}{10} floorr o u n d ( x 10 ) = x 10 + 1 2 = x + 5 10 The nice part is that integer division automatically truncates and for non-negative values, it is the same as taking the floor function. Compute the difference between the rounded version and the truncated version of 15.93/10.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Formal SQL Tuning For Oracle Databases Practical Efficiency Efficient Practice

Authors: Leonid Nossov ,Hanno Ernst ,Victor Chupis

1st Edition

3662570564, 978-3662570562

More Books

Students also viewed these Databases questions

Question

Using Language That Works

Answered: 1 week ago

Question

4. Are my sources relevant?

Answered: 1 week ago