digitalmars.D.learn - exponent operator/library function
- Michael P. <baseball.mjp gmail.com> Aug 04 2008
- BCS <ao pathlink.com> Aug 04 2008
- Michael P. <baseball.mjp gmail.com> Aug 04 2008
- BCS <ao pathlink.com> Aug 04 2008
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Aug 04 2008
- BCS <ao pathlink.com> Aug 04 2008
- "Jarrett Billingsley" <kb3ctd2 yahoo.com> Aug 04 2008
- Michael P. <baseball.mjp gmail.com> Aug 05 2008
Quick question: What do you have to use to do something like, 10 to the power of 3? Something in std.math, a built-in operator? That's all. -Michael P.
Aug 04 2008
Reply to Michael P.,Quick question: What do you have to use to do something like, 10 to the power of 3? Something in std.math, a built-in operator? That's all. -Michael P.
iirc its.math.pow(base,exp);
Aug 04 2008
Content-Type: text/plain BCS Wrote:Reply to Michael P.,Quick question: What do you have to use to do something like, 10 to the power of 3? Something in std.math, a built-in operator? That's all. -Michael P.
iirc its.math.pow(base,exp);
Unfortunately, those didn't work( because of type issues). So I made my own integer one. :) Anyways, somewhat unrelated question: I have attached a file that includes a simple program that I've made for keeping the brain fit, with memory. I've also made one that let's you do simple addition. :D Anyways, everything is compiling fine, but I get an ArrayOutOfBounds error on line 125 or something. Okay, it's function createArray, which is called by memoryTest. Line 114, 115. The file is attached. Does anyone know I'm getting these array errors? -Michael P.
Aug 04 2008
Reply to Michael P.,Anyways, everything is compiling fine, but I get an ArrayOutOfBounds error on line 125 or something.
line 125: for ( int i = arrayToConvert.length; i > 0; i-- ) that should be: for ( int i = arrayToConvert.length - 1; i > 0; i-- ) this is because arr[arr.length] is the elemant after the last element.
Aug 04 2008
"BCS" <ao pathlink.com> wrote in message news:55391cb32ff418cac458bee9a3c8 news.digitalmars.com...Reply to Michael P.,Anyways, everything is compiling fine, but I get an ArrayOutOfBounds error on line 125 or something.
line 125: for ( int i = arrayToConvert.length; i > 0; i-- ) that should be: for ( int i = arrayToConvert.length - 1; i > 0; i-- )
You mean i >= 0, I suppose. ;)this is because arr[arr.length] is the elemant after the last element.
No offense BCS, but for someone so well-spoken and intelligent, I'm kind of shocked at how poor/inconsistent your spelling is. "elemant" and "element" in the same sentence?
Aug 04 2008
Reply to Jarrett,"BCS" <ao pathlink.com> wrote in message news:55391cb32ff418cac458bee9a3c8 news.digitalmars.com...Reply to Michael P.,Anyways, everything is compiling fine, but I get an ArrayOutOfBounds error on line 125 or something.
that should be: for ( int i = arrayToConvert.length - 1; i > 0; i-- )
that as wellthis is because arr[arr.length] is the elemant after the last element.
kind of shocked at how poor/inconsistent your spelling is. "elemant" and "element" in the same sentence?
Keep (gently) needling me on that. I need to do better. OTOH I have on occasion wondered if I'm borderline dyslexic (My mind just doesn't seem to "see" spelling errors). I've never bothered to get tested so I can't claim it as a reason and even if I did get tested I can't claim it as an excuse*. Really what I need to do is figure out how to get a spell checker plugged into my NG reader :b * there is a fun debate in that fine distinction
Aug 04 2008
"Michael P." <baseball.mjp gmail.com> wrote in message news:g77tc7$2fkr$1 digitalmars.com...Unfortunately, those didn't work( because of type issues). So I made my own integer one. :)
cast(int)std.math.pow(10, j) ...Okay, it's function createArray, which is called by memoryTest. Line 114, 115. The file is attached. Does anyone know I'm getting these array errors?
int[] memoryList; for ( int i = 0; i < lengthOfList; i++ ) { memoryList[i] = rand() % 10; ... Maaaaybe you can see it now. Hint: how long is memoryList?
Aug 04 2008
Jarrett Billingsley Wrote:"Michael P." <baseball.mjp gmail.com> wrote in message news:g77tc7$2fkr$1 digitalmars.com...Unfortunately, those didn't work( because of type issues). So I made my own integer one. :)
cast(int)std.math.pow(10, j)Okay, it's function createArray, which is called by memoryTest. Line 114, 115. The file is attached. Does anyone know I'm getting these array errors?
int[] memoryList; for ( int i = 0; i < lengthOfList; i++ ) { memoryList[i] = rand() % 10; ... Maaaaybe you can see it now. Hint: how long is memoryList?
Oh. I just thought it dynamically allocated memory for each new element. Anyways, I put memoryList.length = lengthOfList above the for statement. Anyways, thanks for the help. :) -Michael P.
Aug 05 2008









BCS <ao pathlink.com> 