Skip to content

Commit d64b399

Browse files
committed
SymbolicExpression: NumberValue properties less strict
1 parent 03dac77 commit d64b399

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/Symbolics/SymbolicExpression.fs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,18 @@ type SymbolicExpression(expression:Expression) =
5858
| Approximation (Approximation.Real fp) -> fp
5959
| Constant Pi -> Constants.Pi
6060
| Constant E -> Constants.E
61-
| _ -> failwith "Not a rational number"
61+
| Number n -> float n
62+
| _ -> failwith "Not a real number"
6263

6364
member this.ComplexNumberValue =
6465
match expression with
6566
| Approximation (Approximation.Complex fp) -> fp
67+
| Approximation (Approximation.Real fp) -> complex fp 0.0
6668
| Constant I -> Complex.ImaginaryOne
67-
| _ -> failwith "Not a rational number"
69+
| Constant Pi -> complex Constants.Pi 0.0
70+
| Constant E -> complex Constants.E 0.0
71+
| Number n -> complex (float n) 0.0
72+
| _ -> failwith "Not a complex number"
6873

6974
member this.VariableName =
7075
match expression with

0 commit comments

Comments
 (0)