Boost logo

Boost Users :

Subject: Re: [Boost-users] Numeric Cast from integer to floating point
From: Richard (legalize+jeeves_at_[hidden])
Date: 2014-09-12 18:06:50


[Please do not mail me a copy of your followup]

Antony Polukhin <antoshkka_at_[hidden]> spake the secret code
<CAKqmYPa8aHVeYYB7ZwyLTO7twjnJ_XoohcZ3TXC4eng9pkQ=uA_at_[hidden]> thusly:

>2014-09-08 17:53 GMT+04:00 <dariomt_at_[hidden]>:
>> [...]
>> because that integer cannot be represented in double precision
>>
>> Is there something in Boost to help here?
>>
>That's an interesting question. numeric_cast function was designed to
>detect positive and negative overflows, not precision loss.

Robert Ramey's "Safe Numerics" is designed to allow the cast to proceed
when no precision is lost and do something else when precision is
lost.

<http://rrsd.com/blincubator.com/bi_library/safe-numerics/?gform_post_id=426>

-- 
"The Direct3D Graphics Pipeline" free book <http://tinyurl.com/d3d-pipeline>
     The Computer Graphics Museum <http://computergraphicsmuseum.org>
         The Terminals Wiki <http://terminals.classiccmp.org>
  Legalize Adulthood! (my blog) <http://legalizeadulthood.wordpress.com>

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net