D - imaginary types - what for?
- Helmut Leitner (12/12) Apr 10 2003 In a way I fail to understand what the imaginary types
- Ilya Minkov (6/18) Apr 10 2003 IIRC imaginary types are fakes. That is, it's only a type for constants,...
- Olaf Rogalsky (9/15) Apr 10 2003 me too, only Walter can tell.
- Walter (5/17) Apr 10 2003 Having a separate imaginary type is necessary for some calculations that
- Helmut Leitner (6/10) Apr 11 2003 I can't understand "sign of branch cuts".
- Walter (8/14) Apr 11 2003 number
- Helmut Leitner (27/45) Apr 11 2003 Does this a commitment that D will comply with IEEE 754 (or whatever
- J. Daniel Smith (13/58) Apr 11 2003 C# allows the use of "unsafe" code which pretty much lets you do anythin...
- Matthew Wilson (15/19) Apr 11 2003 I can't say I agree with this. The marketing hype squeaks performance, a...
- J. Daniel Smith (10/29) Apr 14 2003 I was trying to counter the notion that you can't get a high performance
- Matthew Wilson (14/50) Apr 14 2003 It's very patchy. Some things it's good at, some not.
- Walter (4/27) Apr 11 2003 Yes, although C99 has come a long way forward in supporting it.
- Ben Hinkle (22/36) Apr 21 2003 I don't (yet) buy Kahan's argument that a new type is needed, though. Th...
- John Reimer (31/43) Apr 15 2003 Separate use of imaginary numbers is often used in complex arithmatic.
In a way I fail to understand what the imaginary types - ifloat - idouble - ireal are for. I have sometimes used complex numbers - though rarely - in my life, but I never came upon applications or mathematical functions that used "pure" imaginary parts of numbers. Could someone explain? -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 10 2003
IIRC imaginary types are fakes. That is, it's only a type for constants, which generates complex. Pure imaginary has also sense, as someone said, because it distinguishes between a positve and a negative zero. -i. Helmut Leitner wrote:In a way I fail to understand what the imaginary types - ifloat - idouble - ireal are for. I have sometimes used complex numbers - though rarely - in my life, but I never came upon applications or mathematical functions that used "pure" imaginary parts of numbers. Could someone explain?
Apr 10 2003
Helmut Leitner wrote:In a way I fail to understand what the imaginary types - ifloat - idouble - ireal are for.me too, only Walter can tell. -- +----------------------------------------------------------------------+ I Dr. Olaf Rogalsky Institut f. Theo. Physik I I I Tel.: 09131 8528440 Univ. Erlangen-Nuernberg I I Fax.: 09131 8528444 Staudtstrasse 7 B3 I I rogalsky theorie1.physik.uni-erlangen.de D-91058 Erlangen I +----------------------------------------------------------------------+
Apr 10 2003
Having a separate imaginary type is necessary for some calculations that need to preserve the sign of branch cuts. Multiplying by an imaginary number doesn't have quite the same semantics as multiplying by 0+yi. "Helmut Leitner" <leitner hls.via.at> wrote in message news:3E953FB0.3761738 hls.via.at...In a way I fail to understand what the imaginary types - ifloat - idouble - ireal are for. I have sometimes used complex numbers - though rarely - in my life, but I never came upon applications or mathematical functions that used "pure" imaginary parts of numbers. Could someone explain? -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 10 2003
Walter wrote:Having a separate imaginary type is necessary for some calculations that need to preserve the sign of branch cuts. Multiplying by an imaginary number doesn't have quite the same semantics as multiplying by 0+yi.I can't understand "sign of branch cuts". Is this an application programming or an implementation issue? -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 11 2003
"Helmut Leitner" <leitner hls.via.at> wrote in message news:3E967152.A99DD24E hls.via.at...Walter wrote:numberHaving a separate imaginary type is necessary for some calculations that need to preserve the sign of branch cuts. Multiplying by an imaginaryHopefully, this will explain it better than I can: http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf A branch cut (simplisticly) is attempting to draw a distinction between +0 and -0. It comes up a lot in complex arithmetic calculations. Prof. Kahan did another paper on that, but unfortunately it isn't online.doesn't have quite the same semantics as multiplying by 0+yi.I can't understand "sign of branch cuts". Is this an application programming or an implementation issue?
Apr 11 2003
Walter wrote:"Helmut Leitner" <leitner hls.via.at> wrote in message news:3E967152.A99DD24E hls.via.at...Does this a commitment that D will comply with IEEE 754 (or whatever the latest of floating point processing standards is), better than If yes, it would be an important addition to <http://www.digitalmars.com/d/comparison.html> for those folks dealing with that black art. BTW I think that there should be another two entries to the comparison: - one is something like "native interface" or "native call interface" which means that you can call a OS function directly without a special interface or thunk converting parameters. a real PITA where you have to create a DLL function for any call you want to make into the native OS libraries. They are a lot of work and they slow down the calls considerably, e. g. from 7 to 40 us for a call to QueryPerformanceCounter (750 Mhz Athlon). nature - they are just as slow as Javas (40 us in the example). small native low level functions when he wants to write software having competitive performance. He must hope that the functions are duplicated in the runtime. Often they aren't. - a point that should IMHO not be hidden is "runtime reflection" -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.comWalter wrote:numberHaving a separate imaginary type is necessary for some calculations that need to preserve the sign of branch cuts. Multiplying by an imaginaryHopefully, this will explain it better than I can: http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf A branch cut (simplisticly) is attempting to draw a distinction between +0 and -0. It comes up a lot in complex arithmetic calculations. Prof. Kahan did another paper on that, but unfortunately it isn't online.doesn't have quite the same semantics as multiplying by 0+yi.I can't understand "sign of branch cuts". Is this an application programming or an implementation issue?
Apr 11 2003
you can do in C++ (i.e., pointers are allowed). high-performance language. If you need absolute performance, use C++ to control over the managed/unmanged interface. Dan "Helmut Leitner" <leitner hls.via.at> wrote in message news:3E96CAD6.6E24AEB4 hls.via.at...Walter wrote:that"Helmut Leitner" <leitner hls.via.at> wrote in message news:3E967152.A99DD24E hls.via.at...Walter wrote:Having a separate imaginary type is necessary for some calculationsimaginaryneed to preserve the sign of branch cuts. Multiplying by an+0numberHopefully, this will explain it better than I can: http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf A branch cut (simplisticly) is attempting to draw a distinction betweendoesn't have quite the same semantics as multiplying by 0+yi.I can't understand "sign of branch cuts". Is this an application programming or an implementation issue?Kahanand -0. It comes up a lot in complex arithmetic calculations. Prof.did another paper on that, but unfortunately it isn't online.Does this a commitment that D will comply with IEEE 754 (or whatever the latest of floating point processing standards is), better than If yes, it would be an important addition to <http://www.digitalmars.com/d/comparison.html> for those folks dealing with that black art. BTW I think that there should be another two entries to the comparison: - one is something like "native interface" or "native call interface" which means that you can call a OS function directly without a special interface or thunk converting parameters. a real PITA where you have to create a DLL function for any call you want to make into the native OS libraries. They are a lot of work and they slow down the calls considerably, e. g. from 7 to 40 us for a call to QueryPerformanceCounter (750 Mhz Athlon). nature - they are just as slow as Javas (40 us in the example). small native low level functions when he wants to write software having competitive performance. He must hope that the functions are duplicated in the runtime. Often they aren't. - a point that should IMHO not be hidden is "runtime reflection" -- Helmut Leitner leitner hls.via.at Graz, Austria www.hls-software.com
Apr 11 2003
high-performance language. If you need absolute performance, use C++ to control over the managed/unmanged interface.I can't say I agree with this. The marketing hype squeaks performance, and high-scalable servers, and all that. with C, C++, D and Java - for WDM (the first instalment goes in in June's issue), and there are a number of areas in which it comes across very well. (And you can take it from me, a committed C++ fan, that I'd not be suggesting this if honesty didn't force me to.) There are also, of course, areas in which it performs very badly. I'm halfway through the series, so it's too early to tell a definitive picture, of course, but it's clear Microsoft have spent a lot of effort in providing competitive efficiency. As regards Managed C++, I think that it's largely a marketing sell to C++ programmers, and to score a psychological blow to "Unmanaged" C++ programmers. I get the argument that it lets one deal with the CLR from C++,
Apr 11 2003
I was trying to counter the notion that you can't get a high performance Dan "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b7817f$296o$1 digitaldaemon.com...contrastinghigh-performance language. If you need absolute performance, use C++ to control over the managed/unmanged interface.I can't say I agree with this. The marketing hype squeaks performance, and high-scalable servers, and all that.with C, C++, D and Java - for WDM (the first instalment goes in in June's issue), and there are a number of areas in which it comes across verywell.(And you can take it from me, a committed C++ fan, that I'd not be suggesting this if honesty didn't force me to.) There are also, of course, areas in which it performs very badly. I'm halfway through the series, so it's too early to tell a definitive picture, of course, but it's clear Microsoft have spent a lot of effort in providing competitive efficiency. As regards Managed C++, I think that it's largely a marketing sell to C++ programmers, and to score a psychological blow to "Unmanaged" C++ programmers. I get the argument that it lets one deal with the CLR fromC++,
Apr 14 2003
It's very patchy. Some things it's good at, some not. "J. Daniel Smith" <J_Daniel_Smith HoTMaiL.com> wrote in message news:b7efic$gi4$1 digitaldaemon.com...I was trying to counter the notion that you can't get a high performancehaveDan "Matthew Wilson" <dmd synesis.com.au> wrote in message news:b7817f$296o$1 digitaldaemon.com...supertohigh-performance language. If you need absolute performance, use C++moreandcontrol over the managed/unmanged interface.I can't say I agree with this. The marketing hype squeaks performance,June'shigh-scalable servers, and all that.contrastingwith C, C++, D and Java - for WDM (the first instalment goes in incourse,issue), and there are a number of areas in which it comes across verywell.(And you can take it from me, a committed C++ fan, that I'd not be suggesting this if honesty didn't force me to.) There are also, ofsoareas in which it performs very badly. I'm halfway through the series,efficiency.it's too early to tell a definitive picture, of course, but it's clear Microsoft have spent a lot of effort in providing competitiveC++As regards Managed C++, I think that it's largely a marketing sell toorprogrammers, and to score a psychological blow to "Unmanaged" C++ programmers. I get the argument that it lets one deal with the CLR fromC++,
Apr 14 2003
"Helmut Leitner" <leitner hls.via.at> wrote in message news:3E96CAD6.6E24AEB4 hls.via.at...Does this a commitment that D will comply with IEEE 754 (or whatever the latest of floating point processing standards is), better thanYes, although C99 has come a long way forward in supporting it.If yes, it would be an important addition to <http://www.digitalmars.com/d/comparison.html> for those folks dealing with that black art. BTW I think that there should be another two entries to the comparison: - one is something like "native interface" or "native call interface" which means that you can call a OS function directly without a special interface or thunk converting parameters. a real PITA where you have to create a DLL function for any call you want to make into the native OS libraries. They are a lot of work and they slow down the calls considerably, e. g. from 7 to 40 us for a call to QueryPerformanceCounter (750 Mhz Athlon). nature - they are just as slow as Javas (40 us in the example). small native low level functions when he wants to write software having competitive performance. He must hope that the functions are duplicated in the runtime. Often they aren't. - a point that should IMHO not be hidden is "runtime reflection"Good ideas.
Apr 11 2003
I don't (yet) buy Kahan's argument that a new type is needed, though. The library should be able to handle any "smarts" that the type would have. Basically, the information you get by declaring a variable to be type "imaginary" is the same as declaring it to be "complex" and testing that it has zero real part. Said differently, you can take any algorithm that works just the way you want on pure imaginary number y*i, call it f(y), and use it in an algorithm, call it g(x,y), that does the same thing on complex numbers of the form 0+y*i by adding the following test: if (x == 0) { f(y) } else { ... } The only difference is that the imaginary class is known at compile time and the zero test is only known at run time. However if you are computing logs and sqrts, which is where branch cuts come up, the test is not going to be significant. -Ben "Walter" <walter digitalmars.com> wrote in message news:b75u4a$rab$1 digitaldaemon.com..."Helmut Leitner" <leitner hls.via.at> wrote in message news:3E967152.A99DD24E hls.via.at...thatWalter wrote:Having a separate imaginary type is necessary for some calculationsnumberneed to preserve the sign of branch cuts. Multiplying by an imaginaryHopefully, this will explain it better than I can: http://www.cs.berkeley.edu/~wkahan/JAVAhurt.pdf A branch cut (simplisticly) is attempting to draw a distinction between +0 and -0. It comes up a lot in complex arithmetic calculations. Prof. Kahan did another paper on that, but unfortunately it isn't online.doesn't have quite the same semantics as multiplying by 0+yi.I can't understand "sign of branch cuts". Is this an application programming or an implementation issue?
Apr 21 2003
Helmut Leitner wrote:In a way I fail to understand what the imaginary types - ifloat - idouble - ireal are for. I have sometimes used complex numbers - though rarely - in my life, but I never came upon applications or mathematical functions that used "pure" imaginary parts of numbers. Could someone explain?Separate use of imaginary numbers is often used in complex arithmatic. A simple example in electronics: Inductive reactance X(L) of 5 ohms is described as 5i (or j5 in engineering notation). Capacitive reactance X(C) of -5 ohms is described as -5i (or -j5 in egineering notation) In both above examples XC and XL could be stored in an ifloat, idouble or ireal. Calculating these imaginary values separately in a circuit is always useful. A case in which a capacitor and inductor are in series would produce a net +,-, or 0 Reactance in the circuit when added together (depending on signal frequency). The complete complex number is made when a resistance is combined with the reactance to produce an impedance Z: 2 ohm resistance + 5 ohm (inductive) reactance: 2 + 5i (complex number) ohm. But manipulating in equations may involve calculating imaginary values separately. This is just basic electronic math (well actually electrical). I imagine other fields will come across similar situations, since reality has so many similar applications for mathematical tools. Looking at Walters answer later, I don't really understand the branch cut thing. I'll have to read the link he gave. While complex reactances above could be stored as 0 + 5i or 0 - 5i to form a full complex number, I don't think that is "proper" syntax in electronics. Mind you, I haven't had any success in recombining these ifloat or idouble values into a whole complex number in D which is eventually necessary. I may be wrong in my understanding of this. Hope that helps a little, Later, John
Apr 15 2003