473,782 Members | 2,664 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

base numeric type?

Hi all...

I'm playing around experimenting with Extensions and R&D'ing what's new.

There's a procedure I would like to add to numbers, and I was wondering, is
there any "base" number type, that I could put an extension on, as opposed
to manually adding it to all the numeric types...
decimal, double, single, long, short, etc... ??

Cheers!
Arthur Dent.

Dec 7 '07 #1
2 1274
Arthur,

What is wrong with the for all base type object, normal can from that any
numeric type be converted as long as it does not conflict with the receiving
field? Convert from int to double goes, from double to integer can conflict.

I understand that it is not a direct answer on your question, however I use
in that often the sample of the car I had. It had a square steeringwheel
(Austin Allegro). I found it great, it was something different and probably
from the future. In fact it had only problems; To much to tell here. Square
wheels seldom function, however they are invented again and again and again.

And don't tell converting takes time, all new steering wheels thake behind
the scene probably much more time.

Just my idea reading your message

Cor

Dec 7 '07 #2
"Arthur Dent" <hi************ *********@yahoo .comschrieb
Most important last: What are you trying to do with these types?

Well, for example, take a inanely simple numeric function,
"IsPositive ". I know this is not something you'd actually code,
because it is SO simple, but as an example.

I'd like to take my new function, and be able to do something akin
to

<Extension()Pub lic Function IsPositive(targ et As
anyNumericType) As Boolean

As opposed to having to do this...

<Extension()Pub lic Function IsPositive(targ et As Short) As
Boolean <Extension()Pub lic Function IsPositive(targ et As
Integer) As Boolean <Extension()Pub lic Function
IsPositive(targ et As Long) As Boolean <Extension()Pub lic
Function IsPositive(targ et As Single) As Boolean <Extension()>
Public Function IsPositive(targ et As Double) As Boolean <Extension()>
Public Function IsPositive(targ et As Decimal) As
Boolean

It would be very nice if all the "number" types did implement some
common INumber interface, but as far as I know, they don't, do they?
No, only those that you see in the object browser.

Why not simply use ">0" in this case (without using Extensions)? Or
Math.Sign which is overloaded but already there. What else do you want to do
with "target"?
Armin

Dec 7 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
10095
by: Jeff Wagner | last post by:
Is there a Python module or method that can convert between numeric bases? Specifically, I need to convert between Hex, Decimal and Binary such as 5Ah = 90d = 01011010b. I searched many places but couldn't find a Python specific one. Thanks, Jeff
52
5886
by: Dick Moores | last post by:
I need to figure out how to compute pi to base 12, to as many digits as possible. I found this reference, <http://mathworld.wolfram.com/Base.html>, but I really don't understand it well enough. Could someone show me how to do what I need? Thanks, Dick Moores rdm@rcblue.com
5
2368
by: bandw | last post by:
I am having a problem using Numeric-24.0b2 in conjunction with the NetCDF module from ScientificPython (version 2.4.9). This problem does not surface using Numeric-23.8. The problem arises in using the "min" function on a NetCDF floating array. In 23.8, the "min" function returns a floating scalar, while in 24.0b2 it returns an *array* of length "1". Below I list a simple NetCDF file and a Python script that illustrate the problem. When I...
10
7370
by: Sunny | last post by:
Hi, I have an old problem which I couldn't solve so far. Now I have found a post in that group that gave me an idea, but I can not fully understand it. The problem is: I'm trying to use a Windows.Forms.UserControl in a COM environment, i.e. I want to host that control in a COM host. So far, so good, I can host it, but I can not reach the parent COM object from the control (Parent property is null :( ). I have stopped the control in the...
2
1498
by: Urs Eichmann | last post by:
Hi using VS 2005 Beta 2, I want to define a base class for any type of entity, e.g. customer, item, order etc. The entity could have a key of type String or Integer, so I define the base class as follows: Public MustInherit Class BaseEntity(Of tKey) public Key As tKey ' not using properties for simplicity here Public Name as String ... other fields and methods omitted
10
2783
by: Chet Cromer | last post by:
I am creating a set of base classes and sub classes to use throughout a program I'm developing. The base class represents a generic "lookup table" from my database that contains lists of things like manufacturers, makes, modes, etc. of cars. I have created a generic "datacollection" class and a generic "dataobject" class to represent the table and the rows within that table as a collection of objects with generic properties for...
6
9229
by: M.A. Oude Kotte | last post by:
Hi All, I hope this is the correct mailing list for this question. But neither postgresql.org nor google could help me out on this subject. I did find one disturbing topic on the mailing list archives (http://archives.postgresql.org/pgsql-admin/2000-05/msg00032.php), but since it was quite old I'm posting my question anyway. I'm writing a generic database layer that should support a fixed number of generic numeric types on a number of...
2
1897
by: Dom Jackson | last post by:
Hello - I have a problem where I need to test some numeric code using a variety of built-in integer types: obj_type1 = obj_type2 OP obj_type3; // is obj_type1 correct? If I test with 10 built-in integer types, then I get 1000 permutations of the above statement. If I then test a dozen different operators, I get over 10,000 test operations.
0
2118
by: ronysk | last post by:
Hi, I am posting here to seek for help on type conversion between Python (Numeric Python) and C. Attachment A is a math function written in C, which is called by a Python program. I had studied SWIG and Python/C API a bit. I was able to pass numeric array (Numeric Python) into the C function and access/change these arrays. Problem I am having is that I couldn't quite get the array converted back to some PyObject or something that...
0
9639
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4040
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.