Author Topic: Arbitrary Precision  (Read 3210 times)

0 Members and 1 Guest are viewing this topic.

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Arbitrary Precision
« on: September 18, 2021, 12:40:06 am »
every now and then someone asks about high precision arithmetic/math functions to be used in QB64, I came across a package that's in 4 includes http://www.hvks.com/Numerical/arbitrary_precision.html, here's the license
Quote
Copyright & License Information's

Copyright (c) 2020 Henrik Vestermark

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Furthermore if you want to be granted sublicense, and/or sell copies of the Software even when the software is only included as a library for another application, that will require a one-time fee of 1,000USD to be granted sublicense and selling right.

Please use the contact form for any inquiries about Copyright and License information's.
so as long as you don't want to sell your programs that incorporate this code you are good to go
I have tested the code a bit in g++ and it seems OK, it should be possible to call it from QB64, and there's no need to compile to a library for you to use it, the only thing you need to be aware of is to link against gomp via -lgomp (it stand for gnu open mp)
« Last Edit: September 18, 2021, 12:41:09 am by jack »

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Arbitrary Precision
« Reply #1 on: September 18, 2021, 01:48:10 pm »
Well, like the old Tonight Sow gag, when Johnny Carson was running the sow... How high is it?

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Arbitrary Precision
« Reply #2 on: September 18, 2021, 03:33:46 pm »
Pete, do you mean how high is the precision?
I have not tested it much but I ran the pi_brent_salamin to 100,000 in less than 8 seconds, that's clearly not the fastest but it's not too bad

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Arbitrary Precision
« Reply #3 on: September 18, 2021, 05:17:22 pm »
I checked out the website.  "How high is it?"

Well over 'my' head... lol

I am glad that we have clever people, like you guys, when it comes to understanding this stuff.
Logic is the beginning of wisdom.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Arbitrary Precision
« Reply #4 on: September 18, 2021, 05:36:41 pm »
I checked out the website.  "How high is it?"

Well over 'my' head... lol

Three puffs, two snorts, and eight chugs high!
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline johnno56

  • Forum Resident
  • Posts: 1270
  • Live long and prosper.
    • View Profile
Re: Arbitrary Precision
« Reply #5 on: September 18, 2021, 07:05:10 pm »
Not sure of the meaning of that... lol  But at least it does to someone, right? lol
Logic is the beginning of wisdom.

Offline SMcNeill

  • QB64 Developer
  • Forum Resident
  • Posts: 3972
    • View Profile
    • Steve’s QB64 Archive Forum
Re: Arbitrary Precision
« Reply #6 on: September 18, 2021, 10:54:25 pm »
Not sure of the meaning of that... lol  But at least it does to someone, right? lol

Three puffs of weed, two snorts of coke, and eight shots of whiskey!  I’ll leave to to you to decide “how high is that?”  ;D
https://github.com/SteveMcNeill/Steve64 — A github collection of all things Steve!

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Arbitrary Precision
« Reply #7 on: September 18, 2021, 11:27:44 pm »
I suppose I could program String Math could do 100,000 digits, but I'd have to party all night at Steve's house to be motivated enough. Nay, I probably be to too strung out to do it.

Pete
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline jack

  • Seasoned Forum Regular
  • Posts: 408
    • View Profile
Re: Arbitrary Precision
« Reply #8 on: September 19, 2021, 12:18:30 am »
believe it or not, the author of the afore mentioned bignum routines uses C++ string to store the number, not only that but as far as I can tell he uses base 10
it could be significantly faster if he used a larger base like 10000

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
Re: Arbitrary Precision
« Reply #9 on: September 19, 2021, 03:10:28 am »
Base 10, base 1000, what difference does it make? As long as he uses SCREEN 0!

Pete :D

See my latest release, Base 10 digits for uz dum idgits!
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/