Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / Help, my computer cant anymore calculate decimals

Author
Message
Tachyon
19
Years of Service
User Offline
Joined: 15th Sep 2005
Location: four-momentum imaginary proper time
Posted: 28th Jun 2006 20:54
Or it might be windows or processor to be more accurate...

Everything went fine, but suddenly I got weird results from DBP. It turned out that it couldnt divide two normal nubers and get proper decimal, for example dividing 11 with 2:

gives me 5. Reinstall (with fragramented HD and cleaned registery) didnt help.

Ok, I thought and made similar program with C++:

Dividing 11 with 2 gives 5, 10 with 3 gives 3...

Ok, what about Java:

I get 5.0 and 3.0

Everything else works, trying same with windows' calculator gives me proper results, but programming languages dont work. Weird.
I have XP home, fragramented HD, cleaned registery, scandisked and everything. My computer is still somehow new, Intel Pentium 4 HT 2,8Ghz so I think it's not likely my math processor exploded.

Any ideas?

Preston C
21
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 28th Jun 2006 21:07 Edited at: 28th Jun 2006 21:08
Add decimals to the end of your values, the program will consider them integers unless you do, and divide them as such, giving you your lack of a decimal place.

A test in Java to show the comparison:



AMD64 X2 3800+ | 1 GB Ram | NVIDIA GeForce 6800 128MB
MSVC++ .Net 2003 | BlueJ | Wings3D | CharacterFX | Gimp v2.0
Formerly NWC_Omega
Tachyon
19
Years of Service
User Offline
Joined: 15th Sep 2005
Location: four-momentum imaginary proper time
Posted: 28th Jun 2006 21:37 Edited at: 28th Jun 2006 21:38
Hmmm, thanks, it works now:
(When it first didnt work in Linux I really thought it was a hardware problem)


Weird thing was that why this suddenly changed so that I needed a decimal place in DBP? Was I needing it all the time and got inaccurate values in all programs? So now it's better to use this style in the future, so thank you much.

hyrichter
20
Years of Service
User Offline
Joined: 15th Feb 2004
Location: Arizona
Posted: 28th Jun 2006 21:48
I'm sure that if your processor couldn't calculate decimals properly, Windows wouldn't even load up.

Good performance is better than a good excuse.
CodeSurge -- DBP Editor for serious programmers.
Jeku
Moderator
21
Years of Service
User Offline
Joined: 4th Jul 2003
Location: Vancouver, British Columbia, Canada
Posted: 28th Jun 2006 22:42
Hahaha---- you reinstalled your comp over that? Wow--- hardcore.


"I understand creative people. After all, I worked with towel designers." - Ray Kassar, former head of Atari
Tachyon
19
Years of Service
User Offline
Joined: 15th Sep 2005
Location: four-momentum imaginary proper time
Posted: 28th Jun 2006 22:51
Oh, sorry I messed up some words (one more reason to start using english language programs).
I tried to say I defragmented my C: partition before install and cleaned the registry (not wiped, but removed false entries etc.)

But good that I gave you laughs.

Login to post a reply

Server time is: 2024-11-17 06:40:56
Your offset time is: 2024-11-17 06:40:56