Re: implementation of DACOSD
- From: Rich Townsend <rhdt@xxxxxxxxxxxxxxxxxxx>
- Date: Fri, 27 May 2005 08:36:31 -0400
Michel OLAGNON wrote:
>
> Damien MATTEI wrote:
>
>
>>in a way as simple as dsind and dcosd can be implemented:
>>
>>* *****************************************************************
>> real*8 FUNCTION DSIND( angle )
>>* *****************************************************************
>> implicit none
>> real*8 angle
>> real*8 pi
>>
>> if( angle .eq. 180.0 ) then
>> dsind = 0.
>> else
>> pi=acos(0.)*2
>> dsind = dsin( angle * pi / 180.0 )
>> endif
>> return
>> end
>>
>>* *****************************************************************
>> real*8 FUNCTION DCOSD( angle )
>>* *****************************************************************
>> implicit none
>> real*8 angle
>> real*8 pi
>>
>> if( angle .eq. 90.0 ) then
>> dcosd = 0.
>> else if( angle .eq. 270.0 ) then
>> dcosd = 0.
>> else
>> pi=acos(0.)*2
>> dcosd = dcos( angle * pi / 180.0 )
>> endif
>> return
>> end
>>
>
>
>
>
> By the way, those functions are very bad implementations.
>
> Hint: real*8 pi
> real*8 zero
> zero = 0.0
> pi = 2 * acos(zero)
>
I would even prefer
pi = ACOS(-1.D0)
cheers,
Rich
.
- References:
- implementation of DACOSD
- From: Damien MATTEI
- Re: implementation of DACOSD
- From: Michel OLAGNON
- implementation of DACOSD
- Prev by Date: Re: implementation of DACOSD
- Next by Date: Re: Troubles with some IMSL routines (eg EVLRG, and some other)
- Previous by thread: Re: implementation of DACOSD
- Next by thread: Re: implementation of DACOSD
- Index(es):