 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Safwan Guest
|
Posted: Thu Sep 14, 2006 1:48 am Post subject: Interbase numbers and BCB datatype |
|
|
Hi
I want your recommendation !
Interbase Decimal (12, 4) : should I use ( ->AsFloat , ->AsCurrency
or ->AsBCD ) in "BDS2006:BCB".
And if I want to do some calculation, what datatype to declare in "C" :
float , double or long double.
A decimal (12, 4) : in interbase.
float m = 0.0;
m = Dataset1A->AsFloat * somevalue.
My application is an accounting program. it uses numbers like ( 5464.4200 )
I ask this because I face some problem in fraction and calculation. it gives
me sometimes ( 5464.4199 ) insted of ( 5464.4200 )
I think that there is no compatiblity between the Interbase datatype and C
datatype. or I have a wrong thinking.
Thanks you for any kind of help.
Your's
Safwan.
--------
Thanks Borland for their :
Borland Developer Studio 2006 : BCB.
Borland Interbase 7.5 SP1.
TeamB.
We cannot work without thus tools. |
|
| Back to top |
|
 |
Jeff Overcash (TeamB) Guest
|
Posted: Thu Sep 14, 2006 7:17 am Post subject: Re: Interbase numbers and BCB datatype |
|
|
You should either use AsCurrency or AsBCD (both technically scaled integers).
Both should be fine within 4 decimal points. Going to AsFloat you will
introduce floating point inaccuracies as the conversion from a scaled integer
(as stored in InterBase and locally in IBX's internal memory to a floating point
number.
Safwan wrote:
| Quote: | Hi
I want your recommendation !
Interbase Decimal (12, 4) : should I use ( ->AsFloat , ->AsCurrency
or ->AsBCD ) in "BDS2006:BCB".
And if I want to do some calculation, what datatype to declare in "C" :
float , double or long double.
A decimal (12, 4) : in interbase.
float m = 0.0;
m = Dataset1A->AsFloat * somevalue.
My application is an accounting program. it uses numbers like ( 5464.4200 )
I ask this because I face some problem in fraction and calculation. it gives
me sometimes ( 5464.4199 ) insted of ( 5464.4200 )
I think that there is no compatiblity between the Interbase datatype and C
datatype. or I have a wrong thinking.
Thanks you for any kind of help.
Your's
Safwan.
--------
Thanks Borland for their :
Borland Developer Studio 2006 : BCB.
Borland Interbase 7.5 SP1.
TeamB.
We cannot work without thus tools.
|
--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts, build
a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act
alone, solve equations, analyze a new problem, pitch manure, program a computer,
cook a tasty meal, fight efficiently, die gallantly. Specialization is for
insects. (RAH) |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|