mpdecimal for Windows

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
srvaldez
Posts: 2545
Joined: Sep 25, 2005 21:54

mpdecimal for Windows

Postby srvaldez » Jul 01, 2020 1:53

I built the Windows libraries of mpdecimal for anyone interested
Last edited by srvaldez on Jul 03, 2020 11:30, edited 1 time in total.
deltarho[1859]
Posts: 2698
Joined: Jan 02, 2017 0:34
Location: UK

Re: mpdecimal for Windows

Postby deltarho[1859] » Jul 02, 2020 8:08

I had a bit of a struggle to get the required files into a folder so that FB could find them. Anyway, I got there.

FB hasn't got a log base 10 but there is an example in the manual to achieve that and I got log base 10 of 8 as 0.9030899869919434.

Code: Select all

The 'ke!san Online Calculator' gave me 0.9030899869919435856412
Your build (50 sig figs) gave me       0.90308998699194358564121668417347908030456964438633

and we can have arbitrary precision?

I expected mpDecimal-test.exe to take a while but it came in faster than I can blink.

WOW! The mind boggles.

Well done, srvaldez. Image
srvaldez
Posts: 2545
Joined: Sep 25, 2005 21:54

Re: mpdecimal for Windows

Postby srvaldez » Jul 02, 2020 14:37

@deltarho[1859]
thank you for testing :smile:
jdebord
Posts: 529
Joined: May 27, 2005 6:20
Location: Limoges, France
Contact:

Re: mpdecimal for Windows

Postby jdebord » Jul 03, 2020 5:56

Just downloaded. Not yet tested ...

The web site for mpdecimal is here:

http://www.bytereef.org/mpdecimal/index.html

EDIT. Tested now. The two demo programs work well. The DLL too, but the file name (libmpdec.so.2.5.0) cannot be modified.
dodicat
Posts: 6726
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: mpdecimal for Windows

Postby dodicat » Jul 03, 2020 11:24

Hi srvaldez
I keep going to your download link (Dark page with the filename at the top left), but I always get that little win 10 waiting circle going round and round.
Maybe it is because of the slow broadband connection here.
I'll keep trying.
srvaldez
Posts: 2545
Joined: Sep 25, 2005 21:54

Re: mpdecimal for Windows

Postby srvaldez » Jul 03, 2020 11:31

try again, I uploaded it to GitHub and updated the link
dodicat
Posts: 6726
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: mpdecimal for Windows

Postby dodicat » Jul 03, 2020 22:10

Thanks srvaldez.
I'll test it later.
deltarho[]
fb has log10

Code: Select all

 
#include "crt.bi"

print log10f(8)
print log10(8)

sleep
 

I also read this:
Benford’s Law,states that the fractional part of the logarithm of random data is uniformly distributed between 0 and 1.
So, for instance, in a set of figures taken from real life, 1 is by far the most common first digit.
This has a neat application in fraud detection, in that most people ignore Benford’s Law when making up figures, and create their first digits in equal numbers.
deltarho[1859]
Posts: 2698
Joined: Jan 02, 2017 0:34
Location: UK

Re: mpdecimal for Windows

Postby deltarho[1859] » Jul 04, 2020 10:26

dodicat wrote:fb has log10

Thanks for that.
hhr
Posts: 10
Joined: Nov 29, 2019 10:41

Re: mpdecimal for Windows

Postby hhr » Jul 06, 2020 16:53

Code: Select all

''=============================================================================
#include "mpdecimal.bi"

'we need to initialize mpd_context before including the overloded operators
Dim Shared As mpd_context_t mpd_context
mpd_init(@mpd_context, 8)

#include "mpdoverload.bi" 'mpdecimal overloaded operators
''=============================================================================
mpd_context.prec = 32
Dim As mpd summand, sum, n, ten

sum = 0
n = 0
ten = 10

Do ' Bellard's formula
   sum += (-32/(4*n+1)-1/(4*n+3)+256/(10*n+1)-64/(10*n+3)-4/(10*n+5)-4/(10*n+7)+1/(10*n+9)) / (1024^n)
   n += 1
   summand = -(-32/(4*n+1)-1/(4*n+3)+256/(10*n+1)-64/(10*n+3)-4/(10*n+5)-4/(10*n+7)+1/(10*n+9)) / (1024^n)
   sum += summand
   n += 1
Loop While Abs(summand) > ten^(-mpd_context.prec)
sum /= 64

Print sum
Print "press any key to exit ";
Sleep

srvaldez
Posts: 2545
Joined: Sep 25, 2005 21:54

Re: mpdecimal for Windows

Postby srvaldez » Jul 06, 2020 17:46

@hhr
nice example :-)

Return to “Libraries”

Who is online

Users browsing this forum: No registered users and 4 guests