We have some code which is reading data in string form from a file, which was dumped out of an Oracle DB, using as much precision as the database could support. So, for example:
`var o = OracleNumber.Parse("3.1415926535897932384626433832795028842E0")`
However, there's some truncation going on because `o.Value = 3.14159265358979` (only the first ten bytes of o.BinData are populated). I can't find much information around `OracleNumber.Parse(string, format)` and whether that could be a solution?
Truncation in OracleNumber.Parse()
Re: Truncation in OracleNumber.Parse()
Truncation occurs because the number is in scientific format, with an ordering sign ("E"). Precision will be preserved if you do not use the order sign. For example:
Result:
Max Precision is presented by the value OracleNumber.MaxPrecision (=38)
See the documentation about OracleNumber:
https://www.devart.com/dotconnect/oracl ... mbers.html
Alternatively, if you want to use the input in exactly this scientific format, you can use the "format" parameter like so:
Note that the "format" parameter will work only if you have installed an Oracle client with the same bitness as your application.
The format is the same as TO_NUMBER function uses. The description of the format can see here:
https://docs.oracle.com/en/database/ora ... 1399F2897C
Code: Select all
OracleNumber pi = OracleNumber.Parse("3,1415926535897932384626433832795028842");
Console.WriteLine(pi);
Code: Select all
3,1415926535897932384626433832795028842
See the documentation about OracleNumber:
https://www.devart.com/dotconnect/oracl ... mbers.html
Alternatively, if you want to use the input in exactly this scientific format, you can use the "format" parameter like so:
Code: Select all
OracleNumber pi = OracleNumber.Parse("3.1415926535897932384626433832795028842E0", "9.99999999999999999999999999999999999999999999999999EEEE");
Console.WriteLine(pi);
The format is the same as TO_NUMBER function uses. The description of the format can see here:
https://docs.oracle.com/en/database/ora ... 1399F2897C