Subject: Re: ldiv problem
To: Claude Marinier <claude.marinier@dreo.dnd.ca>
From: Luke Mewburn <lukem@wasabisystems.com>
List: netbsd-help
Date: 06/12/2001 01:20:19
On Mon, Jun 11, 2001 at 11:10:13AM -0400, Claude Marinier wrote:
> 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;
> }
On which NetBSD platform and release?
There is a known problem with ldiv(3) on NetBSD/i386 in the 1.5
release. (I discovered it whilst trying to debug a third-party
package). It has been fixed -current. I believe the fix was
pulled up to the netbsd-1-5 CVS branch, and if that's the case,
NetBSD 1.5.1 will have the fix.