potential floating point error propagation in set shower scale

Bug #1729726 reported by Sung Hak Lim
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
MadGraph5_aMC@NLO
Fix Released
Low
Paolo Torrielli

Bug Description

Dear MG5 team,

MG5 version: 2.6.0

I just noticed that NLO shower scale setter has a potential floating point error propagation.

In function emscainv in montecarlocounter.f, they return a rescaled random number in [0,1] by

(r - Sqrt[(r - r^2)])/(2 r - 1)

This expression is 0/0 form at r=0.5, therefore precision loss happen when we pick up r value near 0.5.

If this part give us crazy number, it seems it will be cured internally in other subroutine, such as taking scalemax instead in set_shower_scale in fks_singular.f. However, this will break smooth random number choice so I think it may generate unwanted flaws.

Isn't it better to use floting point arithmetic safe expression, like

Sqrt[r]/(Sqrt[r] + Sqrt[1 - r])

Best wishes,
Sung Hak

Changed in mg5amcnlo:
assignee: nobody → Paolo Torrielli (paolotorriell)
Revision history for this message
Paolo Torrielli (paolo-torrielli) wrote : Re: [Bug 1729726] [NEW] potential floating point error propagation in set shower scale

Dear Sung Hak,

it seems you opened a ticket, even it was already answered.
As I wrote, I think what you say is are fine. Just notice that
this did not produce instabilities because we explicitly set
emscainv =1/2 if r=1/2.
Anyway, your proposal is perfectly fine.
Cheers.
Paolo

> On 3 Nov 2017, at 09:15, Launchpad Bug Tracker <email address hidden> wrote:
>
> Olivier Mattelaer (olivier-mattelaer) has assigned this bug to you for MadGraph5_aMC@NLO:
>
> Dear MG5 team,
>
> MG5 version: 2.6.0
>
> I just noticed that NLO shower scale setter has a potential floating
> point error propagation.
>
> In function emscainv in montecarlocounter.f, they return a rescaled
> random number in [0,1] by
>
> (r - Sqrt[(r - r^2)])/(2 r - 1)
>
> This expression is 0/0 form at r=0.5, therefore precision loss happen
> when we pick up r value near 0.5.
>
> If this part give us crazy number, it seems it will be cured internally
> in other subroutine, such as taking scalemax instead in set_shower_scale
> in fks_singular.f. However, this will break smooth random number choice
> so I think it may generate unwanted flaws.
>
> Isn't it better to use floting point arithmetic safe expression, like
>
> Sqrt[r]/(Sqrt[r] + Sqrt[1 - r])
>
> Best wishes,
> Sung Hak
>
> ** Affects: mg5amcnlo
> Importance: Undecided
> Assignee: Paolo Torrielli (paolotorriell)
> Status: New
>
> --
> potential floating point error propagation in set shower scale
> https://bugs.launchpad.net/bugs/1729726
> You received this bug notification because you are a bug assignee.

Revision history for this message
Sung Hak Lim (sunghak-lim) wrote :

Dear Paolo,

Sorry, I didn't get your reply when I was writing this ticket.

I think setting emscainv=1/2 at r=1/2 doesn't help to solve this precision loss but it seems that impact is minimal so it seems fine.

Thanks a lot for answers!

Best wishes,
Sung Hak

Revision history for this message
Olivier Mattelaer (olivier-mattelaer) wrote :

Hi Paolo,

Can you close this bug report with the correct status?

Thanks,

Olivier

Revision history for this message
Paolo Torrielli (paolotorriell) wrote :

Hi all,
I finally implemented the suggestion, it will be available from 2.6.2 on.
Thanks again, I'll now close the thread.
Cheers.
Paolo

Changed in mg5amcnlo:
status: New → Fix Committed
importance: Undecided → Low
Changed in mg5amcnlo:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.