QB64 Phoenix Edition
Precision Math Software - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3)
+---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10)
+---- Thread: Precision Math Software (/showthread.php?tid=1600)

Pages: 1 2


RE: Precision Math Software - dISP - 04-03-2023

Jack, just a couple of kinda dumb questions. 

1) What is the "c =" for in the the calculation c = mpfr_log10(y, x, MPFR_RNDN)?   "c" does not appear to be a typical variable you are setting a value to.  I surmise that the native language for mpfr is C programming and the "c =" has something to do with using mpfr in basic/qb64?

2) While I down loaded the PDF manual for mpfr I still do not quite understand the purpose of the mpfr_set_si statement.
In your first sample program you have c= mpfr_set_si(x, i, MPFR_RNDN) prior to the log10 calc statement above.

I probably need to find a practical user manual versus the GNU mpfr technical library manual I found.

Thx--


RE: Precision Math Software - Jack - 04-03-2023

1: the functions in mpfr return an int as success/fail value
2: mpfr_set_si(x, i, MPFR_RNDN) simply means set x to the signed integer that's in the variable i


RE: Precision Math Software - dISP - 04-04-2023

Ok, I see.   Once a variable, say a floating decimal variable for example, is in the mpfr world, is there a function that can send the value of that variable back to the raw program.  Such that the value can be assigned to a non mpfr variable?

Basically the opposite transition of this:
d1=.52118
Call mpfr_init2(x, 166)
c = mpfr_set_flt(x, d1, 166)


RE: Precision Math Software - Jack - 04-04-2023

yes, you have
f!=mpfr_get_flt (x, MPFR_RNDN)
d1#=mpfr_get_d (x, MPFR_RNDN)
df##=mpfr_get_ld(x, MPFR_RNDN)
n&=mpfr_get_si (x, MPFR_RNDN)
n~&=mpfr_get_ui (x, MPFR_RNDN)
and if you look in the include you will see that there are counterparts of these


RE: Precision Math Software - dISP - 04-04-2023

Completely awesome.  I had looked at the 'get' function but, I didn't quite figure it out and came to the wrong conclusions on it's use.

I think I pretty much see the whole picture for what I need now.


Thanks Jack - you  are amazing and have been a great help.