Skip to content

Fix rounding of some x87 instructions#951

Merged
ptitSeb merged 13 commits intoptitSeb:masterfrom
Hagb:rounding
Apr 14, 2024
Merged

Fix rounding of some x87 instructions#951
ptitSeb merged 13 commits intoptitSeb:masterfrom
Hagb:rounding

Conversation

@Hagb
Copy link
Contributor

@Hagb Hagb commented Apr 14, 2024

The rounding is not very precise, because of the implement of math functions of gibc. It should be better than nothing though.
Trigonometric instructions (FSIN, FCOS, FSINCOS and FPTAN) still use the default rounding mode, for sin, cos and tan of glibc don't follow the current rounding mode.

@ptitSeb
Copy link
Owner

ptitSeb commented Apr 14, 2024

Why are setting the round mode for each float operation? what software requires that? For example, I don't expact any software to relly on the rounding mode for an Addition between 2 float numbers.

@Hagb
Copy link
Contributor Author

Hagb commented Apr 14, 2024

Why are setting the round mode for each float operation? what software requires that? For example, I don't expact any software to relly on the rounding mode for an Addition between 2 float numbers.

Touhou 12.3 Hisoutensoku requires it. Its netplay dependents of the accuracy of computing (mainly the four basic math operations) and converting of float. Even the tiny difference caused by a different rounding mode can lead to desynchronization in netplay.

@ptitSeb
Copy link
Owner

ptitSeb commented Apr 14, 2024

I see. Well, all those set/unset of the rounding will slow down stuff for many games that don't need it. Can you put this new code behind BOX64_DYNAREC_FASTROUND?

@Hagb
Copy link
Contributor Author

Hagb commented Apr 14, 2024

Can you put this new code behind BOX64_DYNAREC_FASTROUND?

yes of course

@Hagb
Copy link
Contributor Author

Hagb commented Apr 14, 2024

Can you put this new code behind BOX64_DYNAREC_FASTROUND?

done

@ptitSeb ptitSeb merged commit 35ea6fd into ptitSeb:master Apr 14, 2024
@Hagb
Copy link
Contributor Author

Hagb commented Apr 14, 2024

Oops messages of all these commits were included in the 35ea6fd. Is this ok?

@ptitSeb
Copy link
Owner

ptitSeb commented Apr 14, 2024

Oops messages of all these commits were included in the 35ea6fd. Is this ok?

Yeah, I that's fine

Hagb added a commit to Hagb/box64 that referenced this pull request Jan 8, 2025
Hagb added a commit to Hagb/box64 that referenced this pull request Jan 8, 2025
Ported from ptitSeb/box86#951. The original pull
request and this commit also contain some improvements on precision of
`F2XM1` and `FYL2XP1`.
ptitSeb pushed a commit to ptitSeb/box64 that referenced this pull request Jan 8, 2025
* Port rounding of some x87 instructions from Box86

Ported from ptitSeb/box86#951. The original pull
request and this commit also contain some improvements on precision of
`F2XM1` and `FYL2XP1`.

* Run fpu_rounding test with dynarec only for ARM64

They have been implemented on dynarec only for ARM64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants