urzur 0 Newbie Poster

Hello, I'm trying to convert a double (3.16) and take its integer part (3). However I'm encountering problems doing this. Can someone pleeease help me out ?

Here is my code:

main:

li $v0, 7 #asking the user for a double

syscall

mov.d $f2, $f0

cvt.s.d $f4, $f2 #converting from double to single precision. I have a
                        #also tried to convert to word

li $v0, 3  #print the value

mov.d $f12, $f4  #move da converted value (ie.from 3.1 to 3) to f12

syscall

All I want is to convert 3.16 to 3 so I can then only have the floating part of this (ie. 3.16 -3 = .16). The problem I'm having is getting that 3

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.