
29 Mar
2005
29 Mar
'05
7:53 a.m.
Ross Boylan wrote:
I use rational<int> in a scientific application. It's specifying a step size, and I wanted to avoid situations where, e.g., someone gave a step of 1/3 and didn't get exactly 3 steps from 0 to 1.
am i right, that your usage of rational is equivalent to one of: int d = 3 ; for ( int n = 0 ; n <= d ; ++n ) cout << double( n ) / d ; or int s = 3 ; int d = 17 ; for ( int n = 0 ; n <= d ; n += s ) cout << double( n ) / d ; ? if not, can you send me some simplified code snippet? tia, andras