aspose file tools
The moose likes General Computing and the fly likes fixed point values Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » General Computing
Reply Bookmark "fixed point values" Watch "fixed point values" New topic
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
 
Threads others viewed
Jsp file not compling
Problems in my code
tracing the mouse pointer
Displaying data from right to left in a textbox
Circular motion.......
MyEclipse, The Clear Choice