Search code examples
floatingmips32exponentqtspim

How to store a very small float type number in MIPS? (I.e 1x2^-18)


I want to store 1.23211e-18 to a float variable. Here is how I would do it for a value that can be written without an exponent:

.data number: .float 2.43221

But how to do it for a very small value like 1.23211e-18.


Solution

  • Chapter 4 of the MIPS Assembly Language Programmer's Guide (a web search will find many copies of a PDF of that book if you don't already have a copy) describes the format of floating-point constants. It says you should be able to write that value exactly as you did in the question:

        .float 1.23211e-18