Elemental arithmetics; about Sqr(x^2)

For everything that's not in any way related to PureBasic. General chat etc...
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Elemental arithmetics; about Sqr(x^2)

Post by Piero »

NicTheQuick wrote: Sat Sep 16, 2023 1:04 pm For all of you that are interested: I converted the Python fsum function to Purebasic: viewtopic.php?t=82457
Interesting! Thanks

I worked a lot with """very low level""" programming LONG time ago (assembly, C, C++ etc...) but then, often seeing poor human beings (colleagues working with desktop publishing) doing repetitive, machine-like stuff for the most part of the working day, I become very interested in "automation", like applescript.........

This floats/doubles thing is for me just a curiosity I had forgotten, but made me remember when I used "very large numbers math libraries" because I was curious about primes...

If I wasn't so old, I bet I would call some of you "superfast assembly maniacs"... :wink:

PS: this also reminds me I can ask mk-soft questions about prime numbers (to send him to psychiatric hospital) :mrgreen:
jack
Addict
Addict
Posts: 1358
Joined: Fri Apr 25, 2003 11:10 pm

Re: Elemental arithmetics; about Sqr(x^2)

Post by jack »

NicTheQuick wrote: Sat Sep 16, 2023 1:04 pm For all of you that are interested: I converted the Python fsum function to Purebasic: viewtopic.php?t=82457
that thread has a couple of links which eventually led me to the HP Forums where the sum problem was posted, but what I found interesting is the website of one of the members Druzyek that was inquiring about the CORDIC method https://www.hpmuseum.org/forum/thread-12180.html his website is interesting and loaded with calculator related projects http://joldosh.blogspot.com/
BarryG
Addict
Addict
Posts: 4173
Joined: Thu Apr 18, 2019 8:17 am

Re: Elemental arithmetics; about Sqr(x^2)

Post by BarryG »

Piero wrote: Wed Sep 13, 2023 1:38 pm

Code: Select all

Define b.d = 0.4
Define c.d = 0.8
Debug b+c
1.2000000000000001776356839
That's the correct internal result for calculations. When it comes time to display the result, you need to format it:

Code: Select all

Define b.d = 0.4
Define c.d = 0.8
Debug StrD(b+c) ; 1.2
User avatar
Piero
Addict
Addict
Posts: 923
Joined: Sat Apr 29, 2023 6:04 pm
Location: Italy

Re: Elemental arithmetics; about Sqr(x^2)

Post by Piero »

BarryG wrote: Sun Dec 24, 2023 2:45 amyou need to format it
Interesting! Thanks!
(I know: I'm being repetitive)
Post Reply