Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Im receiving this output. In assembly x 8 6 How do I fix the - nan Please enter the length of the first side: 1

Im receiving this output. In assembly x86 How do I fix the -nan
Please enter the length of the first side: 12.0
Please enter the length of the second side: 12.0
Please enter the size of the angle in degrees: 153.0
Thank you Erik Williams. You entered 12.000000,12.000000, and 153.000000.
The length of the third side is: -nan
The final time on the system clock is 23456789 tics
Have a good day.
here is my code
segment text
two dq 2.0 ; Define a double - precision floating - point number with the value 2.0
pi dq 3.141592653589793
conversion_factor dq 0.017453292519943295 ; \pi /180
; Get user input and store in xmm15
push qword 0
push qword 0
mov rdi, format_float
mov rsi, rsp
call scanf
movsd xmm15,[rsp]
pop rax
pop rax
; Ask for second side of triangle
mov rax, 0
mov rdi, length_second_side
call printf
; Get user input and store in xmm12
push qword 0
push qword 0
mov rdi, format_float
mov rsi, rsp
call scanf
movsd xmm12,[rsp]
pop rax
pop rax
; Ask for angle
mov rax, 0
mov rdi, angle_prompt
call printf
; Get user input and store in xmm14
push qword 0
push qword 0
mov rdi, format_float
mov rsi, rsp
call scanf
movsd xmm14,[rsp]
pop rax
pop rax
; output newline
mov rdi, newline
call printf
; thank you input
mov rax, 3
mov rdi, thank_you_input
mov rsi, user_name
movq xmm0, xmm15
movq xmm1, xmm12
movq xmm2, xmm14
call printf
; Get user input and store in xmm11
push qword 0
push qword 0
mov rdi, format_float
mov rsi, rsp
movsd xmm11,[rsp]
pop rax
pop rax
movsd xmm1, xmm14 ; Copy degrees into xmm1
mulsd xmm1, qword [conversion_factor] ; xmm1= degrees *(\pi /180)
; Calculate a^2 and store in xmm3
movsd xmm3, xmm15
mulsd xmm3, xmm3
; Calculate b^2 and store in xmm4
movsd xmm4, xmm12
mulsd xmm4, xmm4
; Add a^2 and b^2, result in xmm3
addsd xmm3, xmm4
; Calculate 2ab and temporarily store in xmm4
movsd xmm4, xmm15
mulsd xmm4, xmm12
mulsd xmm4, qword[two] ; [two] should contain the double - precision floating - point value of 2.0
; Calculate 2ab * cos(\theta ) and store in xmm4
mulsd xmm4, xmm14
; Subtract the product from the sum of squares
subsd xmm3, xmm4
; Take the square root of xmm3 to get the length of the third side
sqrtsd xmm0, xmm3 ; The result is now in xmm0
mov rdi, fmt ; Format string for printf
mov rax, 1 ; Indicate that 1 floating - point argument is passed
call printf ; Print the third side length
; Output newline
mov rdi, newline
call printf

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

State the two rules of financial leverage.

Answered: 1 week ago

Question

In Exercises 2934, find the union of the sets. {e, m, p, t, y}

Answered: 1 week ago

Question

What is DDL?

Answered: 1 week ago