File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/LightcyclerSampleSheet Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 2
2
3
3
namespace MLL \Utils \LightcyclerSampleSheet ;
4
4
5
+ use Illuminate \Support \Number ;
5
6
use MLL \Utils \Microplate \Coordinates ;
6
7
use MLL \Utils \Microplate \CoordinateSystem12x8 ;
7
8
@@ -43,10 +44,10 @@ public static function formatConcentration(?int $concentration): string
43
44
return '' ;
44
45
}
45
46
46
- $ formatted = sprintf ('%.2E ' , $ concentration );
47
+ $ exponent = (int ) floor (log10 (abs ($ concentration )));
48
+ $ mantissa = $ concentration / (10 ** $ exponent );
47
49
48
- // Remove the + sign from positive exponents to match Lightcycler format (4.00E2 instead of 4.00E+2)
49
- return str_replace ('E+ ' , 'E ' , $ formatted );
50
+ return Number::format ($ mantissa , 2 ) . 'E ' . $ exponent ;
50
51
}
51
52
52
53
/** @return list<string> */
You can’t perform that action at this time.
0 commit comments