Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [chemclipse-dev] Overflowing problem of Calculations.getSum(int[] values)

Hi all,

definitely agree. Summing up intensity values can easily overflow int.

MSqBAT even uses BigInteger for such cases, since number overflows are impossible with this type.

Best

Alex

~~~~~~~~~~~~~~~~~~~~~~~~
OpenChrom - the open source alternative for chromatography / mass spectrometry
Dr. Alexander Kerner » Software developer » alexander.kerner@xxxxxxxxxxxxx » http://www.openchrom.net
~~~~~~~~~~~~~~~~~~~~~~~~
On 09/30/2016 09:20 AM, Trig Chen wrote:
In org.eclipse.chemclipse.numeric.statistics.Calculations, the getSum(int[] values) method returns a integer. 
public static int getSum(int[] values)

In some cases, such as a 10000 points scan with 10000 times accumulation. the summation of this scan's total signal might overflow.

How about does this method return a double value? The callers can cast it to float or int as they need.

Best regards,

Trig


_______________________________________________
chemclipse-dev mailing list
chemclipse-dev@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/chemclipse-dev


Back to the top