Skip to content

An implementation of 32 bit floating point arithmetic in C#

Notifications You must be signed in to change notification settings

godxkey/SoftFloat

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

# SoftFloat floating point library
Certain network architectures require deterministic math. Since the normal `Single`/`Double` classes in .net can beave differently on different hardware they can't be used. Thus I decided to write a software implementation of 32 bit floating points.

The `SoftFloat` struct contains a 32 bit integer whose value conforms to the `binary32` datatype from IEEE 754. This means reinterpret casts to `Single`/`float` are possible. SubNorms, infinities and `NaN`s are supported.

The results for the basic operations should be within one step of the correct result(i.e. there may be small rounding errors). The complex operations may have larger errors.

Performance is an important goal. So if you see a way to make it faster, please contact me.

While I'm using a permissive license, I'd still be happy if you contributed back any improvements you make.

About

An implementation of 32 bit floating point arithmetic in C#

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%