Soft Floating Point Calculation Errors of Mono Runtime for MIPS

Okhunjon 0 Reputation points
2023-01-20T11:06:52.9966667+00:00

As we have been facing some issues with Mono project pertaining to the MIPS architecture, I wanted to ask a question.

We have Mediatek MT7628AN mipsel-24kec processor(32 bit), and the example program written in C# is to check the preciseness of floating-point calculations on target(MIPS)(no HFPU). The generated output by mcs is working fine on the host(x86) with mono runtime(v 6.12.0.122), meaning that the floating point calculations are precise enough(2 pow 0=1...).

However, for the case of MIPS, the output is rather strange(2 pow 0=0 ...). After tracing the program execution in MIPS, the problem is two-sided. The first is math.pow(a,b) is always returning b itself instead of a^b. The second issue is about Console.WriteLine for double and float. This method cannot even print a double or float value properly. Instead, it is printing some random different numbers.

Even after changing the cross-toolchain option for MIPS(enable-decimal-float), the first issue has not been addressed. Also, I have tried to utilize sdb , and gdb to debug mono runtime ,but not much information since I could not get into CLI functions. When I tried floating point calculations with just C code not using CLI, it is working fine, meaning that the kernel and system can handle the soft floating point calculations. However, when it comes to mono runtime, this error has been facing. 

If you have any idea to tackle these issues or know someone relates to them, I really appreciate your sharing.

Community Center Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anna Xiu-MSFT 31,056 Reputation points Microsoft External Staff
    2023-01-23T03:40:18.9633333+00:00

    Hi @Okhunjon ,

    Welcome to Microsoft Q&A! 

    You issue is more related to Mono, please ask it in dedicated Mono forum.

    Thanks for your understanding.

    Sincerely,

    Anna


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". 
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.