Giter VIP home page Giter VIP logo

bf16-arithmetic-and-casting-operations's Introduction

BF16 Arithmetic and Casting Operations

This project implements a set of arithmetic and casting operations for the bfloat16 floating-point format in C, focusing on bit-level manipulations without the use of floating-point data types and their arithmetic operations. The bfloat16 format is a 16-bit floating point that represents a subset of the IEEE 754 single-precision floating-point standard, offering reduced precision while maintaining the same exponent range.

Features

  • Conversion Functions: Converts integers and standard float data types to bfloat16, and vice versa, ensuring accurate representation within the bfloat16 format's constraints.
  • Arithmetic Operations: Implements basic arithmetic operations (addition, multiplication) between two bfloat16 numbers, utilizing bit-level manipulation to handle the operations.

Implementation

The implementation is structured around the bf16.c file, which includes detailed implementations of the following functions:

  • int2bf16: Converts an integer to bfloat16.
  • bf162int: Converts a bfloat16 value back to an integer.
  • float2bf16: Converts a standard IEEE 754 single-precision floating point number to bfloat16.
  • bf162float: Converts a bfloat16 number back to a standard float.
  • bf16_add: Performs addition between two bfloat16 numbers.
  • bf16_mul: Performs multiplication between two bfloat16 numbers.

Learning Outcomes

Through this project, I deepened my understanding of:

  • The binary representation of integers and floating-point numbers.
  • Bitwise operations in C for manipulating data at the bit level.
  • The intricacies of floating-point arithmetic and precision trade-offs in computer systems.

bf16-arithmetic-and-casting-operations's People

Contributors

jongheon1 avatar

Watchers

 avatar

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.