Bevo
Nah
+718|6677|Austin, Texas
anyone here got programming experience in c++? I'm running into issues with my dowhile loop and I have no idea why
Vilham
Say wat!?
+580|6922|UK
I do, but its been a while.
Bevo
Nah
+718|6677|Austin, Texas
The code compiles, I just get the wrong answer. Running a for loop for x number of times gets me the correct one, but when I change it to a dowhile and set the percent change between iterations to be .1%, it spits out "1.09297" every time (regardless of what I set the percent change to).
Code: do { x2 = g(x1); x1 = x2; } while (( abs((x2-x1))/x2) > 0.001); cout << "x = " << x1 << endl; return 1;g(x) is my function and it's supposed to be a fixed point iteration which brings me to a root. Like I said, it works when I run a for loop 10 times, but this do-while seems to fail terribly.


edit: which I notice is only a single iteration of the fixed point method. It's running one loop and then quitting. But x2-x1/x2 is much greater than .001. fffffff


i'm a complete idiot

disregard

Last edited by Bevo (2011-02-09 12:29:56)

Vilham
Say wat!?
+580|6922|UK
lol
Ultrafunkula
Hector: Ding, ding, ding, ding...
+1,975|6630|6 6 4 oh, I forget

Printing out table card numbers. Printing out program details. Printing out the church program details. Print print print print...
tuckergustav
...
+1,590|6070|...

What a good little groom you are!
...
Ultrafunkula
Hector: Ding, ding, ding, ding...
+1,975|6630|6 6 4 oh, I forget

tuckergustav wrote:

What a good little groom you are!
*purrr*
.Sup
be nice
+2,646|6609|The Twilight Zone

Macbeth wrote:

http://o.onionstatic.com/images/article … -large.jpg
From an onion article. How anyone couldn't find Filipino girls to be gorgeous is beyond me.

she's :3
your opinion is based on a single photo?
https://www.shrani.si/f/3H/7h/45GTw71U/untitled-1.png
Ultrafunkula
Hector: Ding, ding, ding, ding...
+1,975|6630|6 6 4 oh, I forget

G'nite. I'm off to sleep. And do stuff. And get married. See ya next week if I'm not on the run after escaping from the church
tuckergustav
...
+1,590|6070|...

Good Luck! and Congrats!
...
Toilet Sex
one love, one pig
+1,775|6728

goodnight, have fun
FFLink
There is.
+1,380|6847|Devon, England
Good luck
liquidat0r
wtf.
+2,223|6783|UK
pics
NooBesT
Pizzahitler
+873|6625

Ultrafunkula wrote:

Printing out table card numbers. Printing out program details. Printing out the church program details. Print print print print...
You forgot to print my invitation.
https://i.imgur.com/S9bg2.png
liquidat0r
wtf.
+2,223|6783|UK
That's because you're easy to forget. In fact I don't even remember who you are.
tuckergustav
...
+1,590|6070|...

yeah...noobest.  more like whobest.







...
NooBesT
Pizzahitler
+873|6625

More like your brain is subconsciously blocking the memories because you're so ashamed.
https://i.imgur.com/S9bg2.png
Mekstizzle
WALKER
+3,611|6777|London, England
there's that other person with noob in their name that i get confused with, fucking noobs
m3thod
All kiiiiiiiiinds of gainz
+2,197|6827|UK
how could you ever forget noobmurderer you spacker
Blackbelts are just whitebelts who have never quit.
Toilet Sex
one love, one pig
+1,775|6728

who knew sugar and puffs go so well together
AussieReaper
( ͡° ͜ʖ ͡°)
+5,761|6309|what

Charles Darwin?
https://i.imgur.com/maVpUMN.png
alexb
<3
+590|6096|Kentucky, USA

Charge 1: RECKLESS DRIVING

This vehicle passed unmarked police car at speed in excess of 100mph and was weaving in and out of traffic.
ROGUEDD
BF2s. A Liberal Gang of Faggots.
+452|5545|Fuck this.
way to go alex. lay of the sauce already
Make X-meds a full member, for the sake of 15 year old anal gangbang porn watchers everywhere!
Toilet Sex
one love, one pig
+1,775|6728

alexb wrote:

Charge 1: RECKLESS DRIVING

This vehicle passed unmarked police car at speed in excess of 100mph and was weaving in and out of traffic.
thank god you had a spoiler to keep you on the road
alexb
<3
+590|6096|Kentucky, USA

Toilet Sex wrote:

alexb wrote:

Charge 1: RECKLESS DRIVING

This vehicle passed unmarked police car at speed in excess of 100mph and was weaving in and out of traffic.
thank god you had a spoiler to keep you on the road
wot?

I drive an MK4 Jetta, no spoiler.

Board footer

Privacy Policy - © 2024 Jeff Minard