473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 1255
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()Public Function IsPositive(target As
anyNumericType) As Boolean

As opposed to having to do this...

<Extension()Public Function IsPositive(target As Short) As
Boolean <Extension()Public Function IsPositive(target As
Integer) As Boolean <Extension()Public Function
IsPositive(target As Long) As Boolean <Extension()Public
Function IsPositive(target As Single) As Boolean <Extension()>
Public Function IsPositive(target As Double) As Boolean <Extension()>
Public Function IsPositive(target 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
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...
52
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....
5
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...
10
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...
2
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...
10
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...
6
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...
2
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...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
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,...
0
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...
0
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...

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.