# The Wiert Corner – irregular stream of stuff

• ## Email Subscription

Join 2,947 other followers

# Archive for the ‘ARM’ Category

Posted by jpluimers on 2022/08/18

If you like working with STM32 and want to try out a new simulator for it (by [Wayback/Archive] Wokwi (@WokwiMakes)), then sign up at

–jeroen

## When floating point code suddenly becomes orders magnitudes slower (via C++ – Why does changing 0.1f to 0 slow down performance by 10x? – Stack Overflow)

Posted by jpluimers on 2022/01/26

When working with converging algorithms, sometimes floating code can become very slow. That is: orders of magnitude slower than you would expect.

A very interesting answer to [Wayback] c++ – Why does changing 0.1f to 0 slow down performance by 10x? – Stack Overflow.

I’ve only quoted a few bits, read the full question and answer for more background information.

Welcome to the world of denormalized floating-point! They can wreak havoc on performance!!!

Denormal (or subnormal) numbers are kind of a hack to get some extra values very close to zero out of the floating point representation. Operations on denormalized floating-point can be tens to hundreds of times slower than on normalized floating-point. This is because many processors can’t handle them directly and must trap and resolve them using microcode.

If you print out the numbers after 10,000 iterations, you will see that they have converged to different values depending on whether `0` or `0.1` is used.

Basically, the convergence uses some values closer to zero than a normal floating point representation dan store, so a trick is used called “denormal numbers or denormalized numbers (now often called subnormal numbers)” as described in Denormal number – Wikipedia:

In a normal floating-point value, there are no leading zeros in the significand; rather, leading zeros are removed by adjusting the exponent (for example, the number 0.0123 would be written as 1.23 × 10−2). Denormal numbers are numbers where this representation would result in an exponent that is below the smallest representable exponent (the exponent usually having a limited range). Such numbers are represented using leading zeros in the significand.

Since a denormal number is a boundary case, many processors do not optimise for this.

–jeroen

## Compiler Explorer – how various C++ compilers translate code into various machine code targets

Posted by jpluimers on 2017/01/03

The first implementation of Compiler Explorer supports many versions of the gcc, clang and icc compilers on ARM, ARM64, AVR and x86 targets.

On the left you type your C++ code, on the right you see the resulting assembler code optionally with byte code and colorised so you can correlate the C++ lines with the assembly.

A great way to start the year: learning new things!

Related:

–jeroen

via:

Some videos:

## ARM-Based Windows 10 Portable PCs!? Hell Yes! – Thurrott.com

Posted by jpluimers on 2016/12/08

Windows 10 on ARM will supply a long-rumored feature: The ability to run 32-bit Win32/x86 desktop applications—Apple iTunes, Adobe Photoshop, Google Chrome, whatever—directly on the system, unchanged.

Wow, just wow.

Via:

## 20 years ago today: Here’s a nickel kid. Go buy yourself a real computer.

Posted by jpluimers on 2015/06/24

An eternal Dilbert strip that is based on the tiny Here’s a nickel kid. Go buy yourself a real computer fragment from single.h:

```#if _FP_W_TYPE_SIZE < 32 #error "Here's a nickel kid. Go buy yourself a real computer." #endif```