Working with Numbers Flashcards
Integer Division
The result of integer division will drop the remainder
Scientific Notation
“e” precedes the power-of-10 exponent
- 02e23 equals 6.02X10^23
- 0e-3 equals 0.001 or 1X10^-3
Floating-point Division
If either or both operands in a division expression are floating-point, the result will be floating-point
Arithmetic Precedence Rules
() unary- *, /, % \+, - left-to-right
cmath
Standard math library with C++
sqrt
Square Root
Type Conversion
One data type is converted to another
Int-to-double - adds a .0
Double-to-int - drops the fraction
Implicit Conversion
Automatic conversion
If an operand on either side of an arithmetic operator is a double, then result is a double
During assignments, right side is converted to the left side
fabs
Absolute Value
fabs(value)
Comparing floating-point numbers
“Close enough”
fabs(x-y) < 0.0001
Epsilon
Difference threshold indicating floating-point numbers are equal