troubleshooting Question

Floating Point calculation

Avatar of luna621
luna621 asked on
Assembly
16 Comments1 Solution792 ViewsLast Modified:
On to the next section: floating point calculation.  I'm a bit confused on how to do this.  I wanted to find the volume of a sphere.  Obviously, it's 3/4 PI r^3.  So, I attempted to do this:

      EXTRN      getfp: NEAR, putfp: NEAR
      include mymacros.txt
      .MODEL      SMALL
      .586
      .STACK      100h

      .DATA
      radius      dd ?
      volume  dd 1
      .386

      .CODE
SPHERE      PROC
      startup
      display      "Please enter a radius: "
      infp

      fld      st                        ; load user input
      fmul
      fldpi      
      fmul
      fmul
      fmul      4
      fdiv      3

      display "The volume of the sphere is: "      
      outfp

      endup
SPHERE      ENDP

END      SPHERE
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 16 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 16 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros