diff src/ov-scalar.cc @ 7789:82be108cc558

First attempt at single precision tyeps * * * corrections to qrupdate single precision routines * * * prefer demotion to single over promotion to double * * * Add single precision support to log2 function * * * Trivial PROJECT file update * * * Cache optimized hermitian/transpose methods * * * Add tests for tranpose/hermitian and ChangeLog entry for new transpose code
author David Bateman <dbateman@free.fr>
date Sun, 27 Apr 2008 22:34:17 +0200
parents 39930366b709
children f336dd8e96d0
line wrap: on
line diff
--- a/src/ov-scalar.cc
+++ b/src/ov-scalar.cc
@@ -37,6 +37,7 @@
 #include "oct-obj.h"
 #include "oct-stream.h"
 #include "ov-scalar.h"
+#include "ov-float.h"
 #include "ov-base.h"
 #include "ov-base-scalar.h"
 #include "ov-base-scalar.cc"
@@ -45,6 +46,7 @@
 #include "pr-output.h"
 #include "xdiv.h"
 #include "xpow.h"
+#include "ops.h"
 
 #include "ls-oct-ascii.h"
 #include "ls-hdf5.h"
@@ -55,6 +57,20 @@
 
 DEFINE_OV_TYPEID_FUNCTIONS_AND_DATA (octave_scalar, "scalar", "double");
 
+static octave_base_value *
+default_numeric_demotion_function (const octave_base_value& a)
+{
+  CAST_CONV_ARG (const octave_scalar&);
+
+  return new octave_float_scalar (v.float_value ());
+}
+
+octave_base_value::type_conv_fcn
+octave_scalar::numeric_demotion_function (void) const
+{
+  return default_numeric_demotion_function;
+}
+
 octave_value
 octave_scalar::do_index_op (const octave_value_list& idx, bool resize_ok)
 {