From: "Candida Ferreira" <cferreira@seehomepage.com>
Subject: Re: C fmod function
Date: Wed, 12 Apr 2006 19:38:55 GMT
Date: 2006-04-12T19:38:55+00:00 [thread overview]
Message-ID: <jHc%f.38628$8Q3.32927@fe1.news.blueyonder.co.uk> (raw)
In-Reply-To: kk9%f.233449$zk4.160702@fe3.news.blueyonder.co.uk
I was finally able to test it and Ada's Remainder is not the same as C++
fmod. C++ fmod can be expressed by the generic form fMod(x,y) = ((x / y) -
(Sign(x / y) * Floor(Abs(x / y)))) * y.
Candida
"Candida Ferreira" <cferreira@seehomepage.com> wrote in message
news:kk9%f.233449$zk4.160702@fe3.news.blueyonder.co.uk...
> Dmitry A. Kazakov wrote:
>>> Is there in Ada a built-in function equivalent to the fmod function in
>>> C++?
>>
>> Yes. See Annex A.5.3, Remainder attribute defined for floating-point
>> types.
>
> Thanks, Dmitry. I was aware of the Remainder attribute, but having read
> the definition I wasn't sure if it corresponded exactly to the C++ fmod
> function which can be represented by the generic expression fMod(x,y) =
> ((x / y) - (Sign(x / y) * Floor(Abs(x / y)))) * y.
>
> Best wishes,
> Candida
>
> ---
> Candida Ferreira, Ph.D.
> Chief Scientist, Gepsoft
> http://www.gene-expression-programming.com/author.asp
>
> GEP: Mathematical Modeling by an Artificial Intelligence
> (Springer Verlag edition 2006)
> http://www.gene-expression-programming.com/Books/index.asp
> Online Version:
> http://www.gene-expression-programming.com/GepBook/Introduction.htm
>
> Modeling Software:
> http://www.gepsoft.com/
>
>
next prev parent reply other threads:[~2006-04-12 19:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-12 14:10 C fmod function Candida Ferreira
2006-04-12 15:39 ` Dmitry A. Kazakov
2006-04-12 15:49 ` Candida Ferreira
2006-04-12 19:23 ` Dmitry A. Kazakov
2006-04-12 19:38 ` Candida Ferreira [this message]
2006-04-13 9:36 ` Candida Ferreira
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox