# Floating point arithmetic.

From: Amit Bhatia (bhatia2_at_nospam.com)
Date: 07/11/04

```Date: Sat, 10 Jul 2004 23:08:01 -0500

```

Hi there.
I am cross posting this on comp.lang.c as well: sorry for same.
The problem I am facing is as follows:
For example:
double a= 0.15;
double b=2.4;
const double VERYTINY =1.e-10;
I know b/a = 16 and hence the remainder is zero; but I am not
able to find any suitable thing to encode it into in c.
for example (fmod(b,a)>VERYTINY) returns true!
Now for this particular instance, (fmodf(b,a)>VERYTINY)
does return false.
But now if
a=0.15;
b=4.5;
then fmodf and fmod both don't help...

any suggestions on this?
I was pointed to a reference on floating point arithmetic, where they talk
of ulps etc, but is there a small function or fix to deal with this problem
available somewhere?

thanks,
amit.

## Relevant Pages

• Re: Floating point arithmetic.
... > I am cross posting this on comp.lang.c as well: ... > The problem I am facing is as follows: ... > of ulps etc, but is there a small function or fix to deal with this problem ...
(comp.lang.cpp)
• Re: Floating point arithmetic.
... > I am cross posting this on comp.lang.c as well: ... > The problem I am facing is as follows: ... Maybe use a bigger value for VERYTINY. ... There is not easy answer to the problem of floating point rounding errors. ...
(comp.lang.cpp)
• hangs in gss_accept_sec_context call on Windows with krb5-1.9.5 libs
... I am facing the similar problem with ... When I debugged the code I could get following is the call stack: ... gssapi32.dll!acquire_cred(unsigned int * minor_status, const ...
(comp.protocols.kerberos)