delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/20/05:33:13

Date: Tue, 21 Jan 1997 12:18:58 +0100 (MET)
From: Miguel Murillo <mmurillo AT ideafix DOT cps DOT unizar DOT es>
To: Michael R Weholt <awnbreel AT panix DOT com>
cc: djgpp AT delorie DOT com
Subject: Re: modulus operation with floats requires emulator?
In-Reply-To: <5br7o7$p2e@news1.panix.com>
Message-ID: <Pine.LNX.3.95.970121121454.13782B-100000@ideafix.cps.unizar.es>
MIME-Version: 1.0


On Sat, 18 Jan 1997, Michael R Weholt wrote:

>         I'm using Win95 on a pentium.  Norton Utilities reports that 
> "Math Support is on chip".
> 
>         When I try to use the modulus operation, I can only get it to 
> work using integers, not floats.  When I try it with floats, the 
> debugger reports: "Error: invalid operands to binary %".  I get this 
> message even when I try including math.h, or adding the -lm link 
> option.
> 
>         Does this mean I have to get the 387 emulator and use it?
> 
>         I'm just learning C, so I suppose I could have something wrong 
> with the source.  The following gets the debug message described 
> above:
> 
> #include <stdio.h>
> #include <math.h>
> 
> float   mod;
> 
> main()
> {
>     mod = 9.0 % 5.0;
> 
>     (void) printf("modulus: %f\n", mod);
>     return(0);
> }
> 
> Michael R Weholt
>  http://www.panix.com/~mrw/
> 

a%b  for a,b integer is remainder of a/b 
     for a,b real ??????? non-defined


					MIGUEL MURILLO


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019