Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 29 May 2024 11:13:12 -0400
From: James Y Knight <>
Cc: Nikolaos Chatzikonstantinou <>
Subject: Re: Re: Implementing csqrtl()

On Wed, May 29, 2024 at 8:58 AM Rich Felker <> wrote:

> existing
compilers all just wrongly reorder things with respect to fenv access
> and break it and don't care to fix this (probably because it would

hurt their benchmarks to fix it the right way).

FWIW (not that it changes the recommendation in this instance), Clang has
put a bunch of work into addressing this and other floating-point
compliance issues over the past decade. It *is* considered an important
thing to implement correctly, and I believe it generally is working on the
common architectures, since a few years ago. Unfortunately it's not yet
implemented on every architecture.

There is no impact on benchmarks by implementing fenv correctly, because,
per the C standard, it is undefined behavior to access the floating-point
status flags or to execute any code with non-default floating-point control
modes in effect unless "fenv_access" is enabled -- either using "#pragma
STDC FENV_ACCESS ON" in the code, or via an implementation-defined
mechanism to set the default to on (in clang, the command-line option
"-ffp-model=strict"). Because it's opt-in, only the code which actually
requires it takes the performance hit.

Content of type "text/html" skipped

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.