Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
DoubleToBigInteger.cs
1using System;
2using System.Numerics;
5
7{
12 {
16 public Type From => typeof(double);
17
21 public Type To => typeof(BigInteger);
22
29 public object Convert(object Value)
30 {
31 if (Value is double d)
32 {
33 BigInteger i = (BigInteger)d;
34 if (((double)i) == d)
35 return i;
36 else
37 return null;
38 }
39 else
40 throw new ArgumentException("Expected BigInteger value.", nameof(Value));
41 }
42
50 public IElement ConvertToElement(object Value)
51 {
52 if (Value is double d)
53 {
54 BigInteger i = (BigInteger)d;
55 if (((double)i) == d)
56 return new Integer(i);
57 else
58 return null;
59 }
60 else
61 throw new ArgumentException("Expected double value.", nameof(Value));
62 }
63 }
64}
Integer-valued number.
Definition: Integer.cs:13
Converts a double number to a BigInteger, if possible.
IElement ConvertToElement(object Value)
Converts the object in Value to an object of type To, encapsulated in an IElement.
object Convert(object Value)
Converts the object in Value to an object of type To.
Type To
Converter converts objects to this type.
Type From
Converter converts objects of this type.
Basic interface for all types of elements.
Definition: IElement.cs:20
Converts an object of one type to an object of another type.