Subject Re: [ib-support] Data types
Author Jonathan M. Freedman
so u pass 123456 in one var (intcomponent) and another (-3) in a second
variable (deccomponent), and just by simply separating them out
(converting one into a string then back to an integer (intcomponent), and
reading out the decimal position and converting it to a scale (int
deccomponent), which you
pass to ur UDF, which then converts them to a float by converting the scale
into a decimal and multiplying it times the intcomponent

?, and what is a
descriptor?


> if you assign 123.456 (123,456 for those who
> didn't go to school in the US) to a numeric (9, 3)
> column, what is stored is 123456. The column definition
> includes a scale of -3, so the database considers the
> value to be 123456 * .001.
>
> The scaled integer is a nuisance for C programmers
> (among others... I think only COBOL knows about that
> type intrinsically) because you have to pass the scale
> as well as the value to your UDF or program. But then,
> you should be passing a descriptor in any case, since
> that's the only way to handle nulls.


""Ann W. Harrison"" <aharrison@...> wrote in message
news:5.1.0.14.2.20021003114019.05313eb0@......
> At 07:45 PM 10/2/2002 -0400, Jonathan M. Freedman wrote:
> >I have noted several new data types...i am trying to pass all the
different
> >number types to a UDF I am developing that rounds the variables to a user
> >defined level.
>
> >biginteger---------------> ?
>
> Varies with the C compiler - it's a 64-bit integer.
>
> >numeric------------------> ?
> >decimal-------------------> ?
>
> Depending on the precision it may be short int (1-4),
> int (5-9), or 64-bit int (10-18). Larger would be
> represented as double. But here's the catch. Numeric
> and decimal are scaled, meaning that part of the column
> definition is the power of 10 by which the stored value
> must be multiplied to get the intended value. For
> example, if you assign 123.456 (123,456 for those who
> didn't go to school in the US) to a numeric (9, 3)
> column, what is stored is 123456. The column definition
> includes a scale of -3, so the database considers the
> value to be 123456 * .001.
>
> The scaled integer is a nuisance for C programmers
> (among others... I think only COBOL knows about that
> type intrinsically) because you have to pass the scale
> as well as the value to your UDF or program. But then,
> you should be passing a descriptor in any case, since
> that's the only way to handle nulls.
>
>
> Regards,
>
> Ann
> www.ibphoenix.com
> We have answers.
>
>
>
>
> To unsubscribe from this group, send an email to:
> ib-support-unsubscribe@egroups.com
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>