Subject: Re: ldiv problem
To: None <netbsd-help@netbsd.org>
From: Peter Seebach <seebs@plethora.net>
List: netbsd-help
Date: 06/11/2001 10:31:32
In message <Pine.NEB.4.31.0106111105070.16088-100000@behemoth.dreo.dnd.ca>, Cla
ude Marinier writes:
>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.

A description of what you expected to happen, and what you got.

>void main( void )

This is incorrect.  main() returns int.

>	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 );

If you're getting large negative numbers, me too!

-s