comp.lang.ada
 help / color / mirror / Atom feed
From: Sven Nilsson <emwsvni@emw.ericsson.se>
Subject: Re: Integer? float? confused...
Date: Fri, 23 Mar 2001 08:07:23 +0100
Date: 2001-03-23T08:07:23+01:00	[thread overview]
Message-ID: <3ABAF62B.29D79A22@emw.ericsson.se> (raw)
In-Reply-To: 99eg1q$19j27@tech.port.ac.uk

The problem is the line

 Sin_Result := Num - (Num ** 3) / 6 + (Num ** 5) / 120;

where you have a lot of integer arithmetic and expect a float in the
end. If you write it like this:

 Sin_Result := float(Num) - float(Num ** 3.0) / 6.0 + float(Num **
5)/120.0;

That should work. Now we've upcasted all the integers to floats and
perform only float arithmetic, which means that the end result is a
float as well.

-Sven



  reply	other threads:[~2001-03-23  7:07 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-03-20 21:31 Integer? float? confused WM
2001-03-23  7:07 ` Sven Nilsson [this message]
  -- strict thread matches above, loose matches on Subject: below --
2001-03-20 21:31 WM
2001-04-05 18:30 ` mark
2001-03-20 21:31 WM
2001-03-20 22:55 ` chris.danx
2001-03-20 22:59 ` EtienneB
2001-03-21  1:32 ` Ken Garlington
2001-03-23 12:08 ` dis00109
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox