Skip to content

Commit 2c0ca5b

Browse files
committed
ImgMath: NumberSource as precise as possible, considering that
the output type will mostly be a FloatType.
1 parent b913404 commit 2c0ca5b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/net/imglib2/algorithm/math/execution/NumericSource.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,10 @@ public class NumericSource< O extends RealType< O > > implements OFunction< O >
1111
public NumericSource( final O scrap, final Number number )
1212
{
1313
this.value = scrap;
14-
this.value.setReal( number.doubleValue() );
14+
if ( number instanceof Float )
15+
this.value.setReal( number.floatValue() );
16+
else
17+
this.value.setReal( number.doubleValue() );
1518
}
1619

1720
@Override

0 commit comments

Comments
 (0)