Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

## #359 1, 2, or 3 bugs.

open
nobody
None
5
2012-03-25
2012-03-25
Anonymous
No

Depending upon your belief what a whole number is, there is probably at least one error here:

Dividing by 1 (unity) shouldn't change the "wholeness" of a number.

+++++++++++++++++++++++++++++++++++++++++++++++++++
/**/
do j=1 to 2
say
say center(j,40,'=')
say 'digits=' digits()
n=3735928559
if j==2 then n=n/1
say 'n='n
say 'datatype(n)='datatype(n)
say 'datatype(n,W)='datatype(n,'W')
say 'done as' d2x(n)
say centre(j,40,'=')
say
end
+++++++++++++++++++++++++++++++++++++++++++++++++++

Output:

===================1====================
digits= 9
n=3735928559
datatype(n)=NUM
datatype(n,W)=0
===================1====================

===================2====================
digits= 9
n=3.73592856E+9
datatype(n)=NUM
datatype(n,W)=0
===================2====================

If N isn't a whole number, then the D2X bif
should raise a syntax error.

_____________________ Gerard Schildberger

## Discussion

• Enrico
2012-04-01

IMHO the error is in the coding ... :-)

the REGINA REXX manual - in the D2C and D2X paragraphs - state in clear words that

... Integer must be a whole number under the current settings of NUMERIC,
it is not effected by the precision of the built-in functions.
( for D2C in a slightly different wording )

and datatype(n,W)=0 tells that n is NOT a
... valid REXX whole number under the current setting of NUMERIC.

but now somebody might feel that a different error is coming up....
and the FIRST DISPLAY of n should have been in EXP format
because of the assigning of a 10 digits number to a variable when a NUMERIC DIGITS 9 is in effect !

well, the feeling is wrong ...
REXX enforces the NUMERIC DIGITS constraint only when doing <arithmetics>,
until then the <thing> is just a string made of all numbers

regards

Enrico Sorichetti

PS.
al least ooRexx chokes in a slightly more CONSISTENT and descriptive way ...
( also on the first iteration )
===================1====================
digits= 9
n=3735928559
datatype(n)=NUM
datatype(n,W)=0
16 *-* say 'done as' d2x(n)
REX0093E: Error 93 running /Users/enrico/ztests/t.rx line 16: Incorrect call to method
REX0456E: Error 93.928: D2X value must be a valid whole number; found "3735928559"

• Enrico
2012-04-01

OOPS...
IMHO the error is in the coding ... :-)

seems to me that the DEADBEEF comes from the say... not from the D2X and a wrong NUMERIC DIGITS settings
I tried ..
with
a=d2x(...)
say ... a

and even with the correct nmber of digits ( 10 )