Subject: ldiv problem
To: None <netbsd-help@netbsd.org>
From: Claude Marinier <claude.marinier@dreo.dnd.ca>
List: netbsd-help
Date: 06/11/2001 11:10:13
Hi,
I would like to use ldiv but it does give me the result I expect. I have
reduced the problem to the following code. This produces the correct
result on Alpha/VMS with the DEC (Compaq) compiler and on SPARC64/Solaris
with the Sun and gcc 2.95.2 compilers. I do 'cc -o test-ldiv test-ldiv.c'
with no other switches. What am I missing? Thanks.
#include <stdio.h>
#include <stdlib.h>
void main( void )
{
long i, j;
ldiv_t result;
printf( "Test ldiv\n\n" );
i = 25; j = 6;
result = ldiv( i, j );
printf( " dividing %d by %d\n", i, j );
printf ( " quotient is %d, and remainder is %d\n",
result.quot, result.rem );
return;
}
--
Claude Marinier, Information Technology Group claude.marinier@dreo.dnd.ca
Defence Research Establishment Ottawa (DREO) (613) 998-4901 FAX 998-2675
3701 Carling Avenue, Ottawa, Ontario K1A 0Z4 http://www.dreo.dnd.ca