octave: recognize Python __float__ numeric conversion operator
This commit is contained in:
parent
697a1b7c9d
commit
000ab753df
4 changed files with 31 additions and 0 deletions
|
|
@ -26,4 +26,9 @@
|
|||
ComplexVal __paren__(int j) {
|
||||
return ComplexVal($self->re()*j,$self->im()*j);
|
||||
}
|
||||
|
||||
double __float__() {
|
||||
return (double) $self->re();
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,3 +24,7 @@ printf("a(3)= %s\n",disp(a(3)));
|
|||
|
||||
# friend operator
|
||||
printf("2*a = %s\n",disp(2*a));
|
||||
|
||||
# conversions
|
||||
printf("single(a) = %g\n", single(a));
|
||||
printf("double(a) = %g\n", double(a));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue