C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Adding safe saturated floating-point to integer cast to C++26

From: Thiago Macieira <thiago_at_[hidden]>
Date: Tue, 08 Apr 2025 08:17:13 -0700
On Tuesday, 8 April 2025 07:32:10 Pacific Daylight Time Tiago Freire via Std-
Proposals wrote:
> You can write a proposal.
> Although I don't see why this couldn't easily be done as a library.

We have std::saturate_cast for integers. It should be easy to extend it to
take FP inputs.

The proposal should discuss what happens to a NaN input.

-- 
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
  Principal Engineer - Intel DCAI Platform & System Engineering

Received on 2025-04-08 15:17:16