Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Precision Math Software
#11
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--
Reply
#12
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
Reply
#13
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)
Reply
#14
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
Reply
#15
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.
Reply




Users browsing this thread: 4 Guest(s)