Thread: Developing a naive matrix multiplication algorithm for 53 bits

  1. #1
    Registered User
    Join Date
    Mar 2014
    Posts
    2

    Developing a naive matrix multiplication algorithm for 53 bits

    Hi all,

    I am actually working on IEEE Arithmetic especially the IEEE 754 specification where the IEEE double only have 53 bits of precision. I am working on Z/nZ matrix multiplication that works on 53 bits specs. I just wish someone could give me a pointer on how to write a matrix multiplication algorithm that works well on 53 bits IEEE precision standard.


    Thanks,
    Tchoubis

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    37,968
    How about initialising a double variable to the value 1.0, then copy over your 53 bits (which will give you a value in the range [1..2) ), then you can do your maths as regular floating point operations.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,750
    Quote Originally Posted by Salem View Post
    How about initialising a double variable to the value 1.0, then copy over your 53 bits (which will give you a value in the range [1..2) ), then you can do your maths as regular floating point operations.
    Good idea. In some implementations of the C standard library I've seen they use unsigned constants for doubles (i.e. their bit representation) where precision is absolutely necessary (or desired)

  4. #4
    Registered User
    Join Date
    Apr 2013
    Posts
    1,656
    Quote Originally Posted by Salem View Post
    How about initialising a double variable to the value 1.0, then copy over your 53 bits (which will give you a value in the range [1..2) ), then you can do your maths as regular floating point operations.
    The most significant bit is not stored and assumed to be 1, so the copied bits would be the 52 bit fractional part (xxxxx ...) of a binary fixed point number (1.xxxxx ...). Zero is a special case. Wiki article:

    Double-precision floating-point format - Wikipedia, the free encyclopedia

    It's not clear to me what the goal of the matrix multiplication is. Is the goal to reproduce how a processor does floating point math using custom math functions, or is the goal to optimize matrix multiplication using the processor's double precision math?

  5. #5
    Registered User
    Join Date
    Mar 2014
    Posts
    2
    The primary aim is to write a matrix multiplication algorithm in 53 bits then incorporate this into a 64 bits program

  6. #6
    Registered User
    Join Date
    Apr 2013
    Posts
    1,656
    Why not just implement this using 64 bit integers? You can check for a result greater than 2^52 afterwards.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. MxN Matrix Multiplication with Strassen algorithm
    By vishnudath in forum C Programming
    Replies: 0
    Last Post: 03-06-2014, 06:01 AM
  2. naive print bits function
    By monkey_c_monkey in forum C++ Programming
    Replies: 15
    Last Post: 08-05-2012, 03:06 PM
  3. Replies: 6
    Last Post: 05-14-2011, 09:28 AM
  4. Replies: 2
    Last Post: 02-18-2010, 11:17 AM
  5. Replies: 1
    Last Post: 10-15-2006, 05:17 AM