1 Replies - 551 Views - Last Post: 21 November 2012 - 11:55 AM

#1 townerj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 10
  • Joined: 20-February 12

adding and multiplying floating points

Posted 21 November 2012 - 10:13 AM

I am having trouble converting a floating point array into a logical 2-d array. I know its a number times the width plus the height but i am having trouble with the fpu register instructions for the stack. Can someone show me how to properly add and multiply floating point values i am new to floating point instructions and dont understand the fpu ST(0), ST(1) stack and how numbers are added or multiplied on the stack. Here is what i have, all three are real8 variables i created.

fld randomFloat
fmul arrayWidth
fadd arrayHeight 




Then after these instructions, where is the float stored ST(0)?

Thanks for the help

Is This A Good Question/Topic? 0
  • +

Replies To: adding and multiplying floating points

#2 ishkabible  Icon User is offline

  • spelling expret
  • member icon





Reputation: 1618
  • View blog
  • Posts: 5,707
  • Joined: 03-August 09

Re: adding and multiplying floating points

Posted 21 November 2012 - 11:55 AM

you load 'randomFloat' into st0 then you conceptually load 'arrayWidth' into st1. st1 is then multiplied by st0 and the result is stored in st0. you then conceptually load 'arrayHeight' into st1 and add it with st0 then store the result in st0. so what did looks right to me

this said, why are you trying to use floating point to index elements of an array? you should be using integers for that, something more like...

mov eax, randomIndex
mul eax, arrayWidth
add eax, arrayHeight


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1