Discussion:
Interbase numbers and BCB datatype
(too old to reply)
Safwan
2006-09-13 20:48:27 UTC
Permalink
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)
2006-09-14 02:17:01 UTC
Permalink
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.
Post by Safwan
Hi
I want your recommendation !
Interbase Decimal (12, 4) : should I use ( ->AsFloat , ->AsCurrency
or ->AsBCD ) in "BDS2006:BCB".
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.
--------
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)
Loading...