Pokazywanie postów oznaczonych etykietą floating point. Pokaż wszystkie posty
Pokazywanie postów oznaczonych etykietą floating point. Pokaż wszystkie posty

wtorek, 29 grudnia 2015

Fast conversion of floating-point values to string

The conversion to string could be 15 times faster than sprintf. Read more...

niedziela, 30 listopada 2014

Conversion int and double to string - comparison

Milo Yip has compared different itoa and dtoa implementations on Core i7, including my itoa algorithm 2, that use SSE2 instructions.

Results for itoa are interesting: SSE2 version is not as good as it seemed to be. Tricky branchlut algorithm is only 10% slower, moreover is perfectly portable. One obvious drawback of this method is using lookup-table - in real environment where is a big pressure on cache, memory access could be a bottleneck.

niedziela, 26 stycznia 2014

Penalties of errors in SSE floating point calculations

SSE provides not widely known control register, called MXCSR. This register plays three roles:
  1. controls calculations:
    • flag "flush to zero" (described later)
    • flag "denormals are zeros" (described later)
    • rounding mode (not covered in this text)
  2. allow to mask/unmask floating-point exceptions
  3. save information about floating-point errors - these flags are sticky, i.e. the programmer is responsible for clearing them.
Floating point errors may cause significant slowdown, some of the flags can silence errors makes a program faster. Read more ...

niedziela, 29 grudnia 2013

Calculate floor value without FPU/SSE instruction

Presented algorithm works properly for any normalized floating point value, examples are given for double precision numbers (64-bit). Read more ...

piątek, 27 grudnia 2013

Convert float to int without FPU/SSE

This short note shows how normalized floating point value could be safely converted to integer value without assistance of FPU/SSE. Only basic bit and arithmetic operations are used. Read more ...