Skip to content

Commit ae1a39f

Browse files
authored
Merge pull request #46491 from jbsauvan/hgc-tpg-fix-vfe-compression
[HGCAL trigger] Fix rounding in floating point compression
2 parents 39fa1fd + a151aa8 commit ae1a39f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

L1Trigger/L1THGCal/src/HGCalVFECompressionImpl.cc

+3-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ void HGCalVFECompressionImpl::compressSingle(const uint64_t value,
4949
const uint32_t floatval = (exponent << mantissaBits_) | mantissa;
5050

5151
// we will never want to round up maximum code here
52-
if (!rounding_ || floatval == saturationCode_) {
52+
// Also, rounding doesn't apply if exponent==1 since there is no actual compression
53+
// from the conversion to floating point in that case
54+
if (!rounding_ || floatval == saturationCode_ || exponent <= 1) {
5355
compressedCode = floatval;
5456
compressedValue = ((1ULL << mantissaBits_) | mantissa) << (exponent - 1);
5557
} else {

0 commit comments

Comments
 (0)