Code Monkey home page Code Monkey logo

eefloat's Introduction

eefloat

Emulating PS2's Emotion Engine floats. Converts the single-precision floating points of PS2 to double-precision floating points, and perform double arithmetic.

Why?

PS2's floating points are not IEEE754 compliant:-

Exponent Mantissa In IEEE754 In the PS2
+128 >0 NaN Normalized Value
+128 0 Infinity Normalized Value
-127<E<128 Any Normalized Value Normalized Value
-127 >0 Subnormal Value 0
-127 0 0 0

Therefore, some large floats in the PS2 are not emulatable in x86 due to Infinity/NaN propagation. By doing a single<->double conversion, the +128 exponent is freed up (1024 is used for Inf/NaNs in doubles).

How?

  1. Manually cast the float into a double (usual way of casting causes NaN propagation)
  2. Perform the arithmetic
  3. Manually cast the double back into a float (if EXP>255, return 0xFFFFFFFF; if EXP<=0, return 0x0)

eefloat's People

Contributors

hch12907 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

aomsin2526

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.