Page 2 of 5

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 9:38 am
by Shield
Yeah, never heard of a 300 digit type before either.
However, .NET features a native 128 bit fixed point data type to do currency calculations.

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 10:40 am
by c4s
Hi there, I've read some controversial stuff about your homepage and what you're doing. It included that you really like to back-link to your homepage (for SEO reasons?!)... Anyway, it isn't forbidden but I hope that you're not going to flood every post with it :wink:
Ion Saliu's signatur wrote:BASIC Software Developer
About your need for big numbers:
Besides the recommended GMP library (discussions: here, here and here: search) you can even find something written in PureBasic:
- http://www.purebasic.fr/english/viewtop ... 12&t=39842
- http://purebasic.fr/german/viewtopic.php?f=8&t=22466 (http://www.jasik.de/downloads/purebasic/bigdecimal.pb)
- http://www.purebasic.fr/german/viewtopi ... 27#p262227 (http://data.unionbytes.de/Decimal.pbi)

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 5:10 pm
by Ion Saliu
I said CURRENCY, when, in fact, I was referring to the VB data type known as DOUBLE (precision). Here is what the MSDN Library writes (serves as the help facility for all Visual Studio components). I posted about it in another programming forum in 2008. I copied and pasted from MSDN Library (as of June 2000):
“DOUBLE = 8 bytes ~ A double-precision floating-point value with a range of – 1.79769313486232E308 to – 4.94065645841247E-324 for negative values, 4.94065645841247E-324 to 1.79769313486232E308 for positive values, and 0.

The highest positive value of a Double data type is 1.79769313486232D+308, or about 1.8 times 10 to the 308th power.”
Maybe it fooled me! MSDN Library (June 2000 was the last edition I have) says clearly: 1.8 times 10 to the 308th power. Now, I believe my math is correct: 10 to the 10th power equals 10,000,000,000 (1 followed by 10 zeros). Shouldn’t 10 to the 308th power equal 1 followed by 308 zeros?

Sorry, if you thought my intent was to backlink! I was only interested in a 64-bit Basic compiler — I’m glad I found it here. Matter of fact, I will post soon in my forum a linkback to this forum and site. There are programmers in my forum. We have written quite a bit about compilers and data types, etc. I’m sure some of the programmers will find your compiler very useful.

As of those third-party mathematical libraries, I thank you all again. There is, however, one point I stressed and there has been no answer: VALIDATION. I haven’t found a single math library, free or paid, that was validated by IEEE. Perhaps Microsoft was wrong — many programmers in that forum disputed my quoted excerpt.

Now, I do need time to figure out PureBasic. Definitely, I must do a lot of rewriting of my source code, besides the trusted search-and-replace.

Best of luck to you all!

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 6:07 pm
by wilbert
PureBasic has the double type also.
You are right that it can hold very large values but the precision is limited to 53 bits (about 16 digits).
I assumed you were looking for something with more accuracy.

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 6:50 pm
by Blood
What the holy f**k: http://saliu.com/Ion_Saliu.html ???

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 6:55 pm
by luis
wilbert wrote:I'm a bit confused about the currency type that is mentioned. Where are the 300 digits ?
All I can find is that currency is an 8-byte number with fixed decimal point that can hold values from –922,337,203,685,477.5808 to 922,337,203,685,477.5807 .
I don't understand that either, I used VB6 for a job years ago, I remember Currency as a big integer of a sort with fixed precision to the fourth decimal. I believe it was an integer internally to VB, then divided by the appropriate number (10000 ?) at the moment of the output.


EDIT: oh, sorry I replied to wilbert's post and I didn't see there was a second page of posts already :?

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 8:30 pm
by Zach
Blood wrote:What the holy f**k: http://saliu.com/Ion_Saliu.html ???
A little eccentric, but he appears to be a mathematician / statistician of some sort. Interesting reading!

I remember reading through a back issue of Run! (C64 Magazine) some code for a lottery program someone wrote. I'd always been fascinated with the idea, but assumed I'd never have the understanding to write something even marginally accurate. I guess that's what hes doing :mrgreen:

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Wed Oct 26, 2011 11:10 pm
by Shield
@Ion Saliu:
PureBasic does also have the value type 'double', however this data type is not accurate at all (and it's not even designed to be accurate).
The bigger the value gets (or the more decimal points it needs to hold), the more inaccurate results appear.
So if you want to do "precise" operations, double clearly is the wrong way to go. Double is optimized for speed, not precision.

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 2:27 am
by Ion Saliu
Blood wrote:What the holy f**k: http://saliu.com/Ion_Saliu.html ???
You would say correctly:

“What the Bloody f**k!”

@Shield - As of huge numbers, I seem to be out of luck! I suggest the PureBasic team to take a look at the Japanese UBasic. It was created by an academic — he should be a more reasonable human than regular programmers. I suggest you contact him and maybe ask for permission to incorporate in PureBasic his HUGE NUMERIC data type. The programming samurai claims 2600-digt precision in his numbers!!! Hard to believe! But, hopefully, there will be cooperation with a programming musketeer :)

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 3:26 am
by netmaestro
take a look at the Japanese UBasic. It was created by an academic — he should be a more reasonable human than regular programmers.

Sounds perfect for you. Thanks for stopping by and good luck with your quest for numerizing luck, unfortunately that's pretty much not what we do here.

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 6:44 am
by Danilo
- Ion Saliu is the fastest human in history to write a BigNum library.

- Ion Saliu is the fastest human in history to write a compiler for high precision math.

- Ion Saliu is the fastest grandpa-superman in history.

If you are a bit serious, Ion Saliu, you should already know about Intel C++ and Fortran Compilers
and its high performance math libraries.
With Intel C++/Fortran & MKL (Math Kernel Library) & IPP (Integrated Performance Primitives) &
TBB (Threading Building Blocks) you should be able to write everything you want and it is compiled
by one of the best optimizing compilers in the world. It is not expensive.
Introducing the Intel(R) Math Kernel Library
The Intel(R) Math Kernel Library (Intel(R) MKL) enables improving performance of scientific, engineering, and financial software that solves large computational problems. Intel MKL provides a set of linear algebra routines, fast Fourier transforms, as well as vectorized math and random number generation functions, all optimized for the latest Intel(R) processors, including processors with multiple cores (see the Intel(R) MKL Release Notes for the full list of supported processors). Intel MKL also performs well on non-Intel processors.

Intel MKL provides the following major functionality:
  • Linear algebra, implemented in LAPACK (solvers and eigensolvers) plus level 1, 2, and 3 BLAS, offering the vector, vector-matrix, and matrix-matrix operations needed for complex mathematical software. If you prefer the FORTRAN 90/95 programming language, you can call LAPACK driver and computational subroutines through specially designed interfaces with reduced numbers of arguments. C interface to LAPACK routines is also available.
  • ScaLAPACK (SCAlable LAPACK) with its support functionality including the Basic Linear Algebra Communications Subprograms (BLACS) and the Parallel Basic Linear Algebra Subprograms (PBLAS). Available with Intel MKL for Linux* and Windows* operating systems.
  • Direct sparse solver, an iterative sparse solver, and a supporting set of sparse BLAS (level 1, 2, and 3) for solving sparse systems of equations.
  • Multidimensional discrete Fourier transforms (1D, 2D, 3D) with a mixed radix support (not limited to sizes of powers of 2). Distributed versions of these functions are provided for use on clusters on the Linux* and Windows* operating systems.
  • A set of vectorized transcendental functions called the Vector Math Library (VML). For most of the supported processors, the Intel MKL VML functions offer greater performance than the libm (scalar) functions, while keeping the same high accuracy.
  • The Vector Statistical Library (VSL), which offers high performance vectorized random number generators for several probability distributions, convolution and correlation routines, and summary statistics functions.
Intel MKL is thread-safe and extensively threaded using the OpenMP* technology.

For details see the Intel(R) MKL Reference Manual.
Of course it's 32bit and 64bit native compilers and libraries.

I recommend Intel C++ Studio XE 2011 which includes:
  • Intel C++ Compiler
  • Intel Integrated Performance Primitives
  • Intel Threading Building Blocks
  • Intel Math Kernel Library
  • Intel VTune Performance Analyzer
  • Intel Thread Checker
It's about US$ 1,500 / 900 Euro initial product price for the complete suite,
but only US$ 600 / 360 Euro per year for support and upgrades.

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 7:47 am
by Ramihyn_
Ion Saliu wrote:@Shield - As of huge numbers, I seem to be out of luck! I suggest the PureBasic team to take a look at the Japanese UBasic. It was created by an academic — he should be a more reasonable human than regular programmers. I suggest you contact him and maybe ask for permission to incorporate in PureBasic his HUGE NUMERIC data type. The programming samurai claims 2600-digt precision in his numbers!!! Hard to believe! But, hopefully, there will be cooperation with a programming musketeer :)
You can have arbitrary precision math with different libraries if you actually read the link i gave you two days ago. Thats more than 2600-digit precision ;)

And if you are really serious about validation by IEEE, then maybe you should ask them if and which library they ever validated?

ps: http://en.wikipedia.org/wiki/Computational_science

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 5:11 pm
by Ion Saliu
Danilo:
It's about US$ 1,500 / 900 Euro initial product price for the complete suite, but only US$ 600 / 360 Euro per year for support and upgrades.
Now, that’s affordable :lol: In all fairness, however, I would trust Intel the most, by far. Intel makes the CHIP!

Thanks for the info, really. It is absolutely the best tip I got here. “PureBasic” is only a collectible item for me from now on … Like QuickBasic, Basic PDS, VBDOS, Visual Basic — I paid for them more than what Intel charges upfront …

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 5:19 pm
by Ion Saliu
Zach:
I remember reading through a back issue of Run! (C64 Magazine) some code for a lottery program someone wrote. I'd always been fascinated with the idea, but assumed I'd never have the understanding to write something even marginally accurate.
Forget about it! PureBasic is ill-suited for lottery programming. “PureBasic” is, actually, an oxymoron: There is not Basic in it anymore! It should be called “Hybrid CBasic”. It looks a lot like C. And because C is so much more error-prone than Basic, C is ill-suited for lottery programming. Lottery requires a lot of logical constructs and it is very easy to make mistakes. I have made errors in my software but it has been easy to fix them. C would require a big programming team.

I believe the “Non-Pure Basic” team went too far in changing Basic. They removed all Basic statements and replaced them by C-like functions. Problem is, C uses far shorter names. Un-Pure Basic uses longer function names which definitely affect the performance. You won’t notice that in “Hello, world!” programs, but you will de definitely shocked in lottery programs. Lottery software checks millions and millions of combinations and prints them to screen or file. It is much faster to PRINT #1, than using the PureBasic cumbersome functions.

Actually, you can’t print directly to files. You must first create arrays and then dump them to file. Unfortunately, writing to an array uses the now hidden REDIM PRESERVE — one of the slowest commands of real (traditional) Basic. Do it for millions of iterations — you are out of time!

“PureBasic” should have preserved the traditional Basic statements that make really Basic … basic and easy to use. CLS, COLOR a,b, LOCATE X,Y, PRINT “text”, OPEN “filename” FOR INPUT/OUTPUT/APPEND, PRINT #n, a;b;c;d, etc. Of course, should have also offered the “PureBasic” commands (oops … functions!) — supposedly better-performing …

I offered free source code to generate lotto numbers (see the link in a previous post). Adapt it to “PureBasic”. Generate a few thousand 6/49 lotto combinations to file. Compare to the compiled program in PBCC. The 64-bit “PureBasic” is slower than the 32-bit PBCC. I thought the 64-bit would be faster by an order of magnitude! NOT!

This is a too-nerdy product. It will find a place in my collection only. Not for real use. The author of the PDF “book” is to be commended. But a non-Basic compiler like this needs a very big book for … Basic programmers!

Best of luck to you all, nerds, geeks and the like — I am one of you!

Re: True 64-bit Applications in PureBasic and Huge Numeric T

Posted: Thu Oct 27, 2011 5:37 pm
by skywalk
Wow... :shock:
This nerd thinks you protest far in excess of any real knowledge of PureBasic. :?
And why would $1500 be of any concern to someone who can produce winning lottery numbers? :lol: