Devam Ediyor

505566 An (Unsigned) Integer Calculator

Write comments in your program, a discussion of what you see (and why), when you run this program (there should be some unexpected results).

Sample Output (no user input required):

INT_MIN=-2147483648

INT_MIN SQUARED=0

Squaring powers of 10, storing in INT (32 bit)

10 squared = 100

100 squared = 10000

1000 squared = 1000000

10000 squared = 100000000

100000 squared = -2147483648

FLT_MAX=[url removed, login to view]+038

FLT_MAX DOUBLED=1.#INF000000000000e+000

FLT_MIN=1.1754943508222875e-038

FLT_MIN DIVIDED BY 10 =1.1754946310819804e-039

DBL_EPSILON=2.2204460492503131e-016

((2+DBL_EPSILON)+DBL_EPSILON)=[url removed, login to view]+000

(2+(DBL_EPSILON+DBL_EPSILON))=[url removed, login to view]+000

.2 summed 100 times =[url removed, login to view]+001

.2 summed 10000 times =[url removed, login to view]+003

L A B S T E P S

STEP 1: (Unsigned) Integer Calculations (10 points)

(i)

Locate the smallest (negative) integer, INT_MIN, and print it. Then square INT_MIN and print the output.

(ii)

Find the smallest power of 10 that when squared in C++ gives the wrong value. Present output that indicates the power chosen and the incorrect result that C++ calculates.

STEP 2: (Single-Precision) Floating Point Calculations (20 points)

(iii)

Find the largest real value, FLT_MAX, and print it. Then double FLT_MAX and print the resulting value.

(iv)

Find the smallest positive real value, FLT_MIN, and print it. Then divide FLT_MIN by 10 and print the resulting value.

(v)

If e represents double-precision machine epsilon for C++ (DBL_EPSILON), calculate 2 + e + e first by adding the numbers (using a computer) from left to right and then from right to left.

(vi)

Sum (DO NOT MULTIPLY) repeated copies of 0.2:

100 times and print the output to as many digits as possible. Does it equal 20.0?

10,000 times and print the output to as many digits as possible. Does it equal 2000.0?

______________________________________________________________________________________________________________________________________

Here is a list of helpful include files:

#include <iostream>

#include <iomanip>

#include <math.h>

#include <float.h>

Beceriler: Her şey Kabul, C Programlama

Daha fazlasını görün: unsigned integer calculator, unsigned int calculator, calculator unsigned int, find unsigned integer calculator, smallest possible integer calculator, unsigned calculator, value epsilon, bit integer, unsigned integer, math programming, int v, int power, float programming, first computer programming, epsilon value, double programming, programming powers, programming power, programming find output, calculator programming, bit unsigned integer, find power point, times square, integer programming, float

İşveren Hakkında:
( 3 değerlendirme )

Proje NO: #2251491

Seçilen:

pioneerb64

as discussed

1 gün içinde 50$ USD
(11 Değerlendirme)
2.9