Re: weird problem
From: David Lowndes (davidl_at_example.invalid)
Date: 03/07/04
- Next message: Simon Cheng: "Question about layout of vptr/vtbl"
- Previous message: Kurt Van Samang: "Re: weird problem"
- In reply to: Kurt Van Samang: "Re: weird problem"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 07 Mar 2004 21:46:05 +0000
>yes there is, that's probably the problem, but how to solve it?
The solution really depends on your application. If you can do without
floating point values, then do so. Stick with integers, scale them
appropriately if you need to maximise accuracy.
If you can't avoid floating point values, and you want an integer
value, then at some point you have to round the value. Depending on
your requirement, you may need to round down (which is the default
behaviour and what's happened in your current situation), or round to
the nearest integer. Have a look at the _controlfp function, or
implement the rounding yourself as suggested by the other poster.
Dave
-- MVP VC++ FAQ: http://www.mvps.org/vcfaq
- Next message: Simon Cheng: "Question about layout of vptr/vtbl"
- Previous message: Kurt Van Samang: "Re: weird problem"
- In reply to: Kurt Van Samang: "Re: weird problem"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|