Eros, I unzipped it and ran it from the folder I unzipped too and got a crash. Should I move the dll some place special? I thought it would read it from the same place as the script?
In response to Sandy question about rounding problems found into calculator gui examples ... http://community.thinbasic.com/index.php?topic=1406.0
I was searching for a library able to make calculations with arbitrary precision and able to output results with the wanted precision into a string.
I found GMP library at http://gmplib.org/
and the corresponsing compiled DLL (version 4.1.2 at http://www.cs.nyu.edu/exact/core/gmp/)
Made some tests and attached you can find what I was able to get so far. Adding new exported functions to the script is quite easy but I stopped for a while in order to better understand the library.
In the attached file you will find the following files to be placed into a testing directory you like:
- gmp.dll (dll library)
- gmp.h (C header file used to understand sub/functions declares)
- gmp.tbasic (thinBasic example)
- gmp-man-4.2.2.pdf (manual)
Have fun with it.
I will work on it more in new year because it seems a good starting.
Ciao
Eros
_________________________________________________
PS:
GMP library works on integer, rational and floating point numbers. It has 323 exported functions! I just declared few of them working on floating point numbers in order to test the possibility to have this library as standard in one of the next thinBasic distribution. Tests went fine so the possibility to have GMP as thinBasic standard is quite high.
If someone succede in declaring more functions (using C header file and PDF maual), please post them here and I will add into final thinBasic include file. Thanks.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Eros, I unzipped it and ran it from the folder I unzipped too and got a crash. Should I move the dll some place special? I thought it would read it from the same place as the script?
Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server
Same here
Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370
Same here. I tried moving the dll to Lib but this didn't make any difference.
Thanks
Sandy
I was playing around with the script and got an error message I don't understand.
You are right.
Seems it is working only on my development laptop while on other computer I have I get GPF too.
I will check what's the problem. Sorry about that.
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Stupid me. I changed the way BYREF strings (both dynamic and ASCIIZ) are passed to external DLLs, so I needed also to distribute thinCore.dll
Please find attached to first post the latest thinCore.dll as separated file so you do not have to download again all.
Put thinCore.dll into thinBasic installation directory replacing current one.
All the rest can be placed into a sample script directory. If experiments will go fine, in one of the next future release GMP will be incorporated as standard library with a dedicated include file.
Let me know.
Eros
www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000
Thanks Eros, I hope I find some spare minutes to check this out.
hi
thanks for introducing us to GMP math Library, and as suggested i have added another functions so the available now for mpf (+ - * / sqrt pow), i have copied the form from textbox examples, but i need to know how to change the font type and font size of the textboxes.
from site :
ftp://deltatrinity.dyndns.org/gmp-4....Libs/pentium4/
a more recent gmp dll v 4.2.1 called libgmp-3.dll rename it to gmp.dll
and about precision there is in the site:
http://www.nabble.com/Re:-about-prec...-p5313487.html
someone said that if we choose precision 2048 then the number of digits at the right of the mantissa is 2048*log10(2) = 616.51 digits.
so the precision used here 2048
try pow 2.2 , 3 will produce 10.647999...up to digit 616 from the period
second question: can we color the period and make it a bigger size so we can discriminate the left integer side and the right fractional side especially if the period is located somewhere far in a big number
the calculator_2 example in samplescripts by Psch, is excellent, i may borrow it's structure once i have more functions, clicking on buttons are easier than typing
one drawback of the GMP library is the lacking of Logarithm function, i think it is available in mpfr library
another notice: is that the pow function is restricted to an integer exponent
regards
Hi Zak,
very interesting code.
I attach version, where:
- operations presented in form of combobox
- controls are getting bigger when resizing
- integer and floating point part of the result have different colors
- dialog is handled via callback - much less CPU intensive script
Hope you like it ,
Petr
UPDATED ATTACHEMENT
Learn 3D graphics with ThinBASIC, learn TBGL!
Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB
yes Petr it is a fantastic code , full of ideas and inventions, i will spend some time in studying it. in the next month (next year) i will try to add the integer numbers (MPZ) because they have the primality checking, and the next_prime function.
you missed to delete the line number 143 in the subtraction code,it gives an error.
thanks very much
and thanks for Eros for his ideas and declarations.
Bookmarks