| Author |
fixed point values
|
Damien Howard
Ranch Hand
Joined: Apr 01, 2003
Posts: 456
|
|
|
Can someone explain how fixed point notation works and how one can implement it in c or in programming in general?
|
 |
Randall Twede
Ranch Hand
Joined: Oct 21, 2000
Posts: 3901
|
|
in c++ you would:
#include <iostream> using std::fixed; #include <iomanip> using std::setprecision;
then later in your code:
cout << setprecision(2) << fixed << yourDoubleOrFloat;
the above would print the number to the screen with 2 decimal places. [ October 19, 2003: Message edited by: Randall Twede ]
|
I never took notes in college. That's how I got a 4.0 the first 2 years, and a 3.5 the second two years.
|
 |
 |
|
|
subject: fixed point values
|
|
|