CARDINAL and INTEGER number in Mod-2 
Author Message
 CARDINAL and INTEGER number in Mod-2

I have just started taking a class in modula-2 and on our first project I
noticed a small quirk with CARDINAL and INTEGER numbers.  When you are reading
in a number from the keyboard it seems to work on all types of numbers and
characters.  In doing some further research I found that when a negative number
was put into a CARDINAL field then it would return a 0 and the program would
still keep going.  When a decimal number such as 9.87 or a series of characters
were entered then it would return a number between 2014 and 2020 and again it
kept on running.  I was trying my hardest to crash my program with invalid
input and I couldn't do it no matter how hard I tried.  Does anyone out there
know why this was happening and how you can check to make sure that the number
inputted is really a CARDINAL or INTEGER number and then have an error message
This same problem happened to the whole class and no one  knows why.    

Thanks in advance for any help that you can give.

Ann Schwab

Wed, 17 Feb 1993 23:38:00 GMT  
 CARDINAL and INTEGER number in Mod-2
What version of Modula-2 are you using!!!??? These symptoms sound suspiciously
like the Compiler is freely plugging the floating point into the CARDINAL
or some such rubbish.

-Mark Gooderum

P.S.  Both of these conditions should cause a run time error, or at least
        a retry if your ReadCard was written robustly.

Wed, 17 Feb 1993 03:07:00 GMT  
 [ 2 post ] 

 Relevant Pages 

1. (in)compatibility between INTEGER and CARDINAL

2. (Copy) (in)compatibility between INTEGER and CARDINAL


4. Cardinal numbers

5. Cardinal numbers or unsigned int..

6. Cardinal number output

7. Binary number -> Integer number

8. awk's mod operator % question (application: log base2 non-integer result)

9. mod from 2 64bit Integer

10. Fastest way to mod(ulo) as number in floating point instructions

11. ifort switches for mod files and line-number output

12. MOD and /MOD with Pygmy Forth


Powered by phpBB® Forum Software