# [Mesa-dev] [GSoC2016] Interested in implementing "Soft" double precision floating point support

Ian Romanick idr at freedesktop.org
Wed Mar 9 22:51:24 UTC 2016

```On 03/09/2016 02:25 AM, tournier.elie wrote:
> Hi everyone.
>
> My name is Elie TOURNIER, I am enrolled in a French Engineering school
> (Telecom Physique Strasbourg) specialized in Medical ICT.
> I'm interested in implementing "Soft" double precision floating point
> support [1].
> Taking this subject seem to be a good way to get my feet wet in the Mesa
> code and discover how some of its components works.
>
> I come to you in order to become know but also to retrieve valuable
> information for the success of this project.
>
> I would like to know more about the following things to understand your
> requirements :
> 1- "/Each double precision value would be stored in a uvec2/" The IEEE
> double precision floating point standard representation requires a 64
> bit: 1 for sign, 11 for exponent and the others for fraction [2].
> -> How double precision value must be stored?

As Emil mentioned, on GLSL 1.30, a uvec2 consists of two, 32-bit
unsigned integers.  Each double precision value would be stored in a uvec2.

> 2- Where can I find |GL_ARB_gpu_shader_fp64 |documentation|?
> |
>
>
> This is my first exposure to Mesa. Please excuse me if I am asking basic
> questions.

For this particular project, you wouldn't need Mesa at all for quite
some time.  All of the initial project should be done in "raw" GLSL
1.30, and any OpenGL implementation capable of GLSL 1.30 can be used.
You would implement (and test!) a library of functions like 'uvec2
addDouble(uvec2 a, uvec2 b)' that would provide all of the required
double precision operations.

The set of required functions should be pretty small.  I think:

- negate
- absolute value
- multiply
- reciprocal
- convert to single precision
- convert from single precision
- pow (maybe?)
- exp (maybe?)
- log (maybe?)

I think everything else could be implemented using those functions.

Like I mentioned in the project description, there are quite a few
existing C implementations of these functions.  Finding one of those
that you can understand and that has a compatible license is probably
the best place to start.

> Please point me to the right resources so that I can better understand
> the project. I would also be happy to fix a bug to familiarize myself
> with the source code. Any suggestions on bugs that are relevant to the
> project will be of great help.
>
> Regards,
> Elie
>
> [1]
> http://www.x.org/wiki/SummerOfCodeIdeas/#softdoubleprecisionfloatingpointsupport
> [2] http://steve.hollasch.net/cgindex/coding/ieeefloat.html#storage
>
> PS: If you have any questions, please don't hesitate to contact me.
>
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev

```