From: Bob D. <bd...@si...> - 2005-05-12 20:07:03
|
Derek, Are you sure? Try: <field format="'%.5d'" value="abs(-5.3333)" width="10"/> It works for me. Also RLIB doesn't need to call fabs because the number is stored in FXP and not floating point notation for numerical accuracy - bob On Thu, 2005-05-12 at 13:34 -0500, Derek Giromini wrote: > RLIB Gurus-- > > The RLIB function abs() works only for integers, which explains why > float values passed to this function break in our reports. I refer you > to pcode_op_functions.c lines 688 through 701: > > gint rlib_pcode_operator_abs(rlib *r, struct rlib_value_stack *vs, > struct rlib_value *this_field_value) { > 689 struct rlib_value *v1, rval_rtn; > 690 v1 = rlib_value_stack_pop(vs); > 691 if(RLIB_VALUE_IS_NUMBER(v1)) { > 692 gint64 result = > abs(RLIB_VALUE_GET_AS_NUMBER(v1)); > 693 rlib_value_free(v1); > 694 rlib_value_stack_push(vs, > rlib_value_new_number(&rval_rtn, result)); > 695 return TRUE; > 696 } > 697 rlib_pcode_operator_fatal_execption("abs", 1, v1, > NULL, NULL); > 698 rlib_value_free(v1); > 699 rlib_value_stack_push(vs, > rlib_value_new_error(&rval_rtn)); > 700 return FALSE; > 701 } > > It calls only the standard abs() function and doesn't attempt to check > if the number is a double so that it could instead call the standard > fabs() function. > > I could take a crack at fixing this if you'd prefer, but I wanted to > bring it to your attention. > > Cheers > > -- > Derek Giromini > Gelber Group, L.L.C. > desk: +1.312.692.2843 > pager: +1.312.689.0378 > |