Bad start on complex tests
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
Bad start on complex tests         


Author: James Van Buskirk
Date: May 16, 2008 02:24

C:\gfortran\james\intrinsics\func1>type abs.f90
program abstest
complex(10) c10

c10 = ( 1.7951958020513104220_10, 2.6457513110645905904_10 )
write(*,*) 'Alive to here'
write(*,*) abs(c10)
write(*,*) 'Survived the ordeal'
end program abstest

C:\gfortran\james\intrinsics\func1>gfortran abs.f90 -oabs

C:\gfortran\james\intrinsics\func1>abs
Alive to here

C:\gfortran\james\intrinsics\func1>

--
write(*,*) transfer((/17.392111325966148d0,6.5794487871554595D-85, &
6.0134700243160014d-154/),(/'x'/)); end
16 Comments
Re: Bad start on complex tests         


Author: Steven G. Kargl
Date: May 16, 2008 07:21

In article comcast.com>,
"James Van Buskirk" comcast.net> writes:
> C:\gfortran\james\intrinsics\func1>type abs.f90
> program abstest
> complex(10) c10
>
> c10 = ( 1.7951958020513104220_10, 2.6457513110645905904_10 )
> write(*,*) 'Alive to here'
> write(*,*) abs(c10)
> write(*,*) 'Survived the ordeal'
> end program abstest
>
> C:\gfortran\james\intrinsics\func1>gfortran abs.f90 -oabs
>
> C:\gfortran\james\intrinsics\func1>abs
> Alive to here
>
> C:\gfortran\james\intrinsics\func1>
>
Show full article (0.78Kb)
no comments
Re: Bad start on complex tests         


Author: Anony
Date: May 16, 2008 07:43

"Steven G. Kargl" troutmask.apl.washington.edu> wrote in message
news:g0k59r$1c5$1@gnus01.u.washington.edu...
> This one works for me on FreeBSD with versions 4.2.3 and
> 4.4.0. I suspect your version of mingw or win64 has a broken
> printf/scanf in libc with long doubles.
>
> --

This is not a problem with printf/scanf. The problem is on the function
"abs" on mingw-w64. On mingw32, everything is fine. See the following:

C:\TEMP>type james.f90
program abstest
complex(10) c10

c10 = ( 1.7951958020513104220_10, 2.6457513110645905904_10 )
write(*,*) 'Alive to here'
write(*,*) abs(c10)
write(*,*) 'Survived the ordeal'
end program abstest

C:\TEMP>gfortran -o james.exe james.f90
Show full article (1.26Kb)
no comments
Re: Bad start on complex tests         


Author: Anony
Date: May 16, 2008 08:00

"Anony" equation.com> wrote in message
news:O4hXj.8$HJ5.6@trnddc01...
>
> However, on mingw-w64, the program dies when calling the function abs().
If
> we modify james' program as:
>
> program abstest
> complex(10) c10
> complex(10) cc
>
> c10 = ( 1.7951958020513104220_10, 2.6457513110645905904_10 )
> write(*,*) 'Alive to here'
> cc = abs(c10)
> write(*,*) 'Survived the ordeal'
> end program abstest
>
Show full article (1.02Kb)
no comments
Re: Bad start on complex tests         


Author: Steven G. Kargl
Date: May 16, 2008 08:13

In article ,
"Anony" equation.com> writes:
>
> "Steven G. Kargl" troutmask.apl.washington.edu> wrote in message
> news:g0k59r$1c5$1@gnus01.u.washington.edu...
>> This one works for me on FreeBSD with versions 4.2.3 and
>> 4.4.0. I suspect your version of mingw or win64 has a broken
>> printf/scanf in libc with long doubles.
>>
>
> This is not a problem with printf/scanf. The problem is on the function
> "abs" on mingw-w64. On mingw32, everything is fine. See the following:

(snip)
Show full article (1.71Kb)
no comments
Re: Bad start on complex tests         


Author: FX
Date: May 16, 2008 08:32

> So mingw-w64 or win64 don't supply a funtion cabsl() funtion?

win64 doesn't, but mingw does. The problem has to be there. (If there
simply weren't any cabsl function available, the program wouldn't link.)
> Try the following.

That will indeed help. James, can you also run the following modified
program?

#include
#include
#include
int main(void)
{
long complex z;
long double x;
z = 1. + 2 * I;
x = __builtin_cabsl(z);
printf("cabsl(%%Le,%%Le) = %%Le\n", creall(z), cimagl(z), x);
return 0;
}
Show full article (0.56Kb)
no comments
Re: Bad start on complex tests         


Author: Anony
Date: May 16, 2008 09:35

"Steven G. Kargl" troutmask.apl.washington.edu> wrote in message
news:g0k8bm$4de$1@gnus01.u.washington.edu...
> So mingw-w64 or win64 don't supply a funtion cabsl() funtion?
> Try the following.
>
> #include
> #include
> #include
> int main(void)
> {
> long complex z;
> long double x;
> z = 1. + 2 * I;
> x = cabsl(z);
> printf("cabsl(%%Le,%%Le) = %%Le\n", creall(z), cimagl(z), x);
> return 0;
> }
>

I think you are right. I run your example on W64. The result is as:
Show full article (0.96Kb)
no comments
Re: Bad start on complex tests         


Author: Anony
Date: May 16, 2008 09:37

"FX" alussinan.org> wrote in message
news:g0k9et$1s2$1@nef.ens.fr...
> That will indeed help. James, can you also run the following modified
> program?
>
> #include
> #include
> #include
> int main(void)
> {
> long complex z;
> long double x;
> z = 1. + 2 * I;
> x = __builtin_cabsl(z);
> printf("cabsl(%%Le,%%Le) = %%Le\n", creall(z), cimagl(z), x);
> return 0;
> }
>
> --
Show full article (0.88Kb)
no comments
Re: Bad start on complex tests         


Author: Steven G. Kargl
Date: May 16, 2008 09:48

In article ,
"Anony" equation.com> writes:
>
> I think you are right. I run your example on W64. The result is as:
>
> C:\temp\c>type kargl.c
> #include
> #include
> #include
> int main(void)
> {
> long complex z;
> long double x;
> printf("I am at A.\n");
> z = 1. + 2 * I;
> printf("I am at B.\n");
> x = cabsl(z);

What happens if you change the above line to

x = hypotl(creall(z), cimagl(z));
Show full article (0.66Kb)
no comments
Re: Bad start on complex tests         


Author: James Van Buskirk
Date: May 16, 2008 09:59

"FX" alussinan.org> wrote in message
news:g0k9et$1s2$1@nef.ens.fr...
>> So mingw-w64 or win64 don't supply a funtion cabsl() funtion?
> win64 doesn't, but mingw does. The problem has to be there. (If there
> simply weren't any cabsl function available, the program wouldn't link.)
>> Try the following.
> That will indeed help. James, can you also run the following modified
> program?
Show full article (1.47Kb)
no comments
 
1 2