Author Topic: logarithmic instructions in fpu  (Read 10367 times)

jalvarado

  • Guest
logarithmic instructions in fpu
« on: May 31, 2012, 02:34:52 PM »
can anybody bring me information and examples of logarithmic  instructions in floating point unit (FPU)

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: logarithmic instructions in fpu
« Reply #1 on: May 31, 2012, 02:51:48 PM »
Ray's library and tutorial...

http://www.ray.masmcode.com/fpu.html

jalvarado

  • Guest
Re: logarithmic instructions in fpu
« Reply #2 on: June 09, 2012, 02:52:51 AM »
thanks is very useful.  :icon14: anyone can bring me more especific examples of using  logarithmic  instructions in fpu??

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: logarithmic instructions in fpu
« Reply #3 on: June 09, 2012, 02:59:09 AM »
what are you trying to do ?

many times, log values are converted to log base 2, "worked" on, then converted back
so - one of the first things you might want to learn would be converting logs between bases

logb(a) = logc(a) / logc(b)

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: logarithmic instructions in fpu
« Reply #4 on: June 09, 2012, 03:11:12 AM »
thanks is very useful.  :icon14: anyone can bring me more especific examples of using  logarithmic  instructions in fpu??
              What do you mean with "more especific examples" ?
              What do you mean with "using logaritmic instructions" ?
              What do you want to do ?

jalvarado

  • Guest
Re: logarithmic instructions in fpu
« Reply #5 on: June 09, 2012, 03:31:46 AM »
so im trying to find another example like this http://www.ray.masmcode.com/tutorial/fpuchap13.htm , to understand the logic of the program using  logarithmic  instructions

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: logarithmic instructions in fpu
« Reply #6 on: June 09, 2012, 03:36:45 AM »
Rui is a good guy to help you, here
he has recently been doing a lot with logs and the FPU

jalvarado

  • Guest
Re: logarithmic instructions in fpu
« Reply #7 on: June 09, 2012, 03:48:37 AM »
Ok thanks.

Rui, Can you help me?

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: logarithmic instructions in fpu
« Reply #8 on: June 09, 2012, 04:10:03 AM »
What did you not understand: the mathematics or it's implementation?
MREAL macros - when you need floating point arithmetic while assembling!

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: logarithmic instructions in fpu
« Reply #9 on: June 09, 2012, 04:15:13 AM »
so im trying to find another example like this http://www.ray.masmcode.com/tutorial/fpuchap13.htm , to understand the logic of the program using  logarithmic  instructions

Hi jalvarado,
           Sorry but the best person to explain that example is the author
           Raymond.

           Meanwhile one simple problem can be this: how do you know the
exponent y if you know z and x and the equation z=x^y ?

jalvarado

  • Guest
Re: logarithmic instructions in fpu
« Reply #10 on: June 09, 2012, 04:20:11 AM »
What did you not understand: the mathematics or it's implementation?

 it's implementation

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: logarithmic instructions in fpu
« Reply #11 on: June 09, 2012, 04:32:03 AM »
logb(a) = logc(a) / logc(b)
Code: [Select]
fld FP8(0.301029995663981) ; 1/log2(10)
fld FP8(0.001) ; test value = 10^-3
fyl2x
fstp realVar ; = log(0.001) = log2(0.001)/log2(10) = -3

;OR: log(x) = log10(2)*log2(x)
fldlg2
fld FP8(0.001)
fyl2x
fstp realVar
« Last Edit: June 09, 2012, 08:22:44 AM by qWord »
MREAL macros - when you need floating point arithmetic while assembling!

RuiLoureiro

  • Member
  • ****
  • Posts: 819
Re: logarithmic instructions in fpu
« Reply #12 on: June 09, 2012, 06:14:59 AM »
jalvarado,
Based on logb(a) = logc(a) / logc(b) given by Dave,

dont forget this 2 important formulas:

            log10(x)= log2(x). (1/log2(10))

            ln(x)      = log2(x). (1/log2(e))

If we have y=(e^x-e^-x)/2, to find x=f(y) we need to use logarithms.