Skip to content

Commit f87799b

Browse files
committed
Merge pull request #3 from jjcat/master
optimize convert from decimal
2 parents bed330d + 20a54ac commit f87799b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Fix8.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ public static explicit operator decimal(Fix8 value) {
9999
}
100100

101101
public static explicit operator Fix8(decimal value) {
102-
var nearestExact = Math.Round(value * 16m) * 0.0625m;
103-
return new Fix8((sbyte)(nearestExact * One.m_rawValue));
102+
var nearestExact = Math.Round(value * 16m);
103+
return new Fix8((sbyte)(nearestExact ));
104104
}
105105

106106
public static Fix8 operator +(Fix8 x, Fix8 y) {

0 commit comments

Comments
 (0)