octave: recognize Python __float__ numeric conversion operator

This commit is contained in:
Karl Wette 2016-02-07 16:27:25 +01:00
commit 000ab753df
4 changed files with 31 additions and 0 deletions

View file

@ -26,4 +26,9 @@
ComplexVal __paren__(int j) {
return ComplexVal($self->re()*j,$self->im()*j);
}
double __float__() {
return (double) $self->re();
}
};

View file

@ -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));