D - complex problems with sqrt
- Helmut Leitner (38/38) Apr 21 2003 This programm
- Walter (6/44) Apr 22 2003 That's true, the various math functions for complex arguments haven't be...
- Helmut Leitner (5/9) Apr 22 2003 No problem. But why do the calls match?
- Walter (4/8) Apr 22 2003 been
- Andy Friesen (4/21) Apr 22 2003 It may be worth the hassle to disallow floating points to be converted
- Helmut Leitner (10/20) Apr 22 2003 I don't understand that. I can't find anything about conversions in the
This programm
import venus.all;
int main (char [][] args)
{
float y=3.14;
PrintLine("y=",y);
cfloat cy=3.14 + 10i;
PrintLine("cy.re=",cy.re);
PrintLine("cy.im=",cy.im);
PrintLine("cy=",cy);
ifloat ix=1.5i;
PrintLine("ix=",ix);
cdouble z=cy*ix;
PrintLine("z=",z);
z=sqrt(z);
PrintLine("sqrt(z)=",z);
z= -1;
PrintLine("z=",z);
z=sqrt(z);
PrintLine("sqrt(z)=",z);
return 0;
}
Will produce the following output:
y=3.140000 ok, only testing
cy.re=3.140000 ok
cy.im=10.000000 ok
cy=3.140000 + 10.000000i ok, testing PrintLine for cfloat
ix=1.500000i ok, ifloat assignment
z=-15.000000 + 4.710000i ok, multiplication
sqrt(z)=2.170253 + 0.000000i nok sqrt
z=-1.000000 + 0.000000i ok, cdouble assignment
sqrt(z)=-nan + 0.000000i nok sqrt
The sqrt values calculated are in error. I don't no why sqrt is called at all.
It seams that Phobos doesn't define a complex version for sqrt. The stdio and
stdlib modules are imported, but they shouldn't match.
--
Helmut Leitner leitner hls.via.at
Graz, Austria www.hls-software.com
Apr 21 2003
That's true, the various math functions for complex arguments haven't been implemented yet. -Walter "Helmut Leitner" <helmut.leitner chello.at> wrote in message news:3EA4439C.135F6C1C chello.at...This programm import venus.all; int main (char [][] args) { float y=3.14; PrintLine("y=",y); cfloat cy=3.14 + 10i; PrintLine("cy.re=",cy.re); PrintLine("cy.im=",cy.im); PrintLine("cy=",cy); ifloat ix=1.5i; PrintLine("ix=",ix); cdouble z=cy*ix; PrintLine("z=",z); z=sqrt(z); PrintLine("sqrt(z)=",z); z= -1; PrintLine("z=",z); z=sqrt(z); PrintLine("sqrt(z)=",z); return 0; } Will produce the following output: y=3.140000 ok, only testing cy.re=3.140000 ok cy.im=10.000000 ok cy=3.140000 + 10.000000i ok, testing PrintLine for cfloat ix=1.500000i ok, ifloat assignment z=-15.000000 + 4.710000i ok, multiplication sqrt(z)=2.170253 + 0.000000i nok sqrt z=-1.000000 + 0.000000i ok, cdouble assignment sqrt(z)=-nan + 0.000000i nok sqrt The sqrt values calculated are in error. I don't no why sqrt is called atall.It seams that Phobos doesn't define a complex version for sqrt. The stdioandstdlib modules are imported, but they shouldn't match. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 22 2003
Walter wrote:That's true, the various math functions for complex arguments haven't been implemented yet. -WalterNo problem. But why do the calls match? -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 22 2003
"Helmut Leitner" <leitner hls.via.at> wrote in message news:3EA56AF0.437F70A hls.via.at...Walter wrote:beenThat's true, the various math functions for complex arguments haven'tBoth are a conversion.implemented yet. -WalterNo problem. But why do the calls match?
Apr 22 2003
Walter wrote:"Helmut Leitner" <leitner hls.via.at> wrote in message news:3EA56AF0.437F70A hls.via.at...It may be worth the hassle to disallow floating points to be converted to integers, in that case. round/floor/truncate functions could fill the gap. (make it/them intrinsic?)Walter wrote:beenThat's true, the various math functions for complex arguments haven'tBoth are a conversion.implemented yet. -WalterNo problem. But why do the calls match?
Apr 22 2003
Walter wrote:"Helmut Leitner" <leitner hls.via.at> wrote in message news:3EA56AF0.437F70A hls.via.at...I don't understand that. I can't find anything about conversions in the language specs that would back that. Anyway nothing that would make a complex number match to the only //intrinsic.d real sqrt(real); I can find. Even if there were something it would be just plain wrong. -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.comWalter wrote:beenThat's true, the various math functions for complex arguments haven'tBoth are a conversion.implemented yet. -WalterNo problem. But why do the calls match?
Apr 22 2003









Andy Friesen <andy ikagames.com> 