Re: nan/inf behaviour in ROOT

From: Axel Naumann <Axel.Naumann_at_cern.ch>
Date: Thu, 11 Mar 2010 22:03:44 +0100


Hi Philip,

good point! Now fixed in the trunk.

Cheers, Axel.

On 2010-03-11 11:51, Philip Rodrigues wrote:
> It probably won't affect you, but there's a weird corner case when
> floating exceptions are turned on:
>
> root [0] gSystem->SetFPEMask(kInvalid)
> (Int_t)0
> root [1] 1e99
> (const double)9.99999999999999967e+98
>
> *** Break *** floating point exception
>
>
> The reason is because TCint::ProcessLine returns the return value of the
> command executed (ie 1e99) cast to an int. In this case it overflows an
> int, which is fine with FPEs off (the int value just wraps), but crashes
> with FPEs turned on.
>
> Anyway, it's not really a bug, but it is something one might run into
> with FPEs turned on.
>
> Phil
>
> Vito Di Benedetto wrote:

>>   Hi Axel,
>>
>> Axel Naumann wrote:
>>> Hi Vito,
>>>
>>> see http://root.cern.ch/root/html/TSystem#TSystem:SetFPEMask
>>
>> This is what I need :-)
>>
>> Thank you,
>>     Vito
>>
>>
>>> Cheers, Axel.
>>>
>>> Vito Di Benedetto wrote on 03/11/2010 09:51 AM:
>>>>   Dear ROOT experts,
>>>>
>>>>  I'm using ROOT 5.26.00. In this ROOT version I have an unexpected
>>>> behaviour in handling float numbers.
>>>>
>>>> If I type the following instruction
>>>>
>>>> root [0] Float_t a = 0.
>>>> root [1] Float_t b = 10.
>>>> root [2] b/a
>>>> (double)inf
>>>> root [3] Float_t c = -10.
>>>> root [4] TMath::Sqrt(c)
>>>> (const double)nan
>>>>
>>>>
>>>>  I don't get exception. I have just inf or nan.
>>>>
>>>>  The same happen on my framework based on ROOT. I prefer to get
>>>> floating
>>>> point exception instead of inf/nan. In this way I can check better
>>>> in my
>>>> framework if there some "strange Physics effect".
>>>>
>>>>  Please, there is some way to get back floating point exception?
>>>>
>>>> Cheers,
>>>>     Vito
>>>>
>>>>
>>>>
>>

>
>
Received on Thu Mar 11 2010 - 22:03:50 CET

This archive was generated by hypermail 2.2.0 : Fri Mar 12 2010 - 05:50:02 CET