Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- includelib libcmt.lib
- includelib libvcruntime.lib
- includelib libucrt.lib
- includelib legacy_stdio_definitions.lib
- extern printf_s: proc, scanf_s: proc, getchar: proc, log10: proc, log: proc, exp: proc
- .data
- prompt byte "Enter a number x > 0 : ", 0
- inputFormatString byte "%lf", 0
- invalidInputMessage byte "Error: Invalid Input.", 10, 13, 0
- formatString1 byte "x = %2.6lf", 10, 0
- formatString2 byte "log10(x) = %2.6lf", 10, 0
- formatString3 byte "ln(x) = %2.6lf", 10, 0
- formatString4 byte "e^x = %2.6lf", 10, 0
- ZERO real8 0.0
- .data?
- num real8 ? ;
- .code
- main proc
- push rbp
- mov rbp, rsp
- sub rsp, 32
- lea rcx, [prompt] ;
- call printf_s ;
- lea rdx, [num] ; scanf_s("lf", &num);
- lea rcx, [inputFormatString] ;
- call scanf_s ;
- movsd xmm0, qword ptr [num]
- comisd xmm0, ZERO
- jle error
- mov rdx, [num]
- lea rcx, [formatString1]
- call printf_s
- movsd xmm0, num
- call log10
- movq rdx, xmm0
- lea rcx, [formatString2]
- call printf_s
- movsd xmm0, num
- call log
- movq rdx, xmm0
- lea rcx, [formatString3]
- call printf_s
- movsd xmm0, num
- call exp
- movq rdx, xmm0
- lea rcx, [formatString3]
- call printf_s
- jmp terminate
- error:
- lea rcx, [invalidInputMessage]
- call printf_s
- terminate:
- xor rax, rax
- leave
- main endp
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement