PC Review


Reply
Thread Tools Rate Thread

Default value for a double

 
 
Jon
Guest
Posts: n/a
 
      28th Nov 2008
I've read that I can use a default value to avoid a nullable type in some situations.

Is this a good idea for a double? I'm a bit worried that one normally should not use if
(valDoub==???) due to the slightly inexact way that doubles are defined.


 
Reply With Quote
 
 
 
 
Gregory A. Beamer
Guest
Posts: n/a
 
      29th Nov 2008
Not a big deal if you are default to something without a huge amount of
precision, like 0.0. Floating points are more problematic when you have many
digits to the right of the decimal point.

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
"Jon" <-> wrote in message news:(E-Mail Removed)...
> I've read that I can use a default value to avoid a nullable type in some
> situations.
>
> Is this a good idea for a double? I'm a bit worried that one normally
> should not use if
> (valDoub==???) due to the slightly inexact way that doubles are defined.
>
>


 
Reply With Quote
 
William Vaughn \(MVP\)
Guest
Posts: n/a
 
      30th Nov 2008
True, but I'm in the "default to 'we don't know what the value is' " (NULL)
camp. It takes even less space.

--
__________________________________________________________________________
William R. Vaughn
President and Founder Beta V Corporation
Author, Mentor, Dad, Grandpa
Microsoft MVP
(425) 556-9205 (Pacific time)
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
____________________________________________________________________________________________



"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:3A8C2558-E83A-4CBB-B08C-(E-Mail Removed)...
> Not a big deal if you are default to something without a huge amount of
> precision, like 0.0. Floating points are more problematic when you have
> many digits to the right of the decimal point.
>
> --
> Gregory A. Beamer
> MVP: MCP: +I, SE, SD, DBA
>
> Blog:
> http://feeds.feedburner.com/GregoryBeamer
>
> ********************************************
> | Think Outside the Box! |
> ********************************************
> "Jon" <-> wrote in message news:(E-Mail Removed)...
>> I've read that I can use a default value to avoid a nullable type in some
>> situations.
>>
>> Is this a good idea for a double? I'm a bit worried that one normally
>> should not use if
>> (valDoub==???) due to the slightly inexact way that doubles are defined.
>>
>>

>

 
Reply With Quote
 
Gregory Beamer
Guest
Posts: n/a
 
      30th Nov 2008
I was just answering the question, but I would agree that NULL is a better
option that defaulting null objects. But that comes from my understanding of
how null is used in a database. ;-)

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think outside the box! |
********************************************

"William Vaughn (MVP)" <(E-Mail Removed)> wrote in message
news:E7CF857B-9240-4EDB-93A0-(E-Mail Removed)...
> True, but I'm in the "default to 'we don't know what the value is' "
> (NULL) camp. It takes even less space.
>
> --
> __________________________________________________________________________
> William R. Vaughn
> President and Founder Beta V Corporation
> Author, Mentor, Dad, Grandpa
> Microsoft MVP
> (425) 556-9205 (Pacific time)
> Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
> ____________________________________________________________________________________________
>
>
>
> "Gregory A. Beamer" <(E-Mail Removed)> wrote in message
> news:3A8C2558-E83A-4CBB-B08C-(E-Mail Removed)...
>> Not a big deal if you are default to something without a huge amount of
>> precision, like 0.0. Floating points are more problematic when you have
>> many digits to the right of the decimal point.
>>
>> --
>> Gregory A. Beamer
>> MVP: MCP: +I, SE, SD, DBA
>>
>> Blog:
>> http://feeds.feedburner.com/GregoryBeamer
>>
>> ********************************************
>> | Think Outside the Box! |
>> ********************************************
>> "Jon" <-> wrote in message news:(E-Mail Removed)...
>>> I've read that I can use a default value to avoid a nullable type in
>>> some situations.
>>>
>>> Is this a good idea for a double? I'm a bit worried that one normally
>>> should not use if
>>> (valDoub==???) due to the slightly inexact way that doubles are defined.
>>>
>>>

>>


 
Reply With Quote
 
Jon
Guest
Posts: n/a
 
      1st Dec 2008
Thanks for your reply Gregory.

I wouldn't be using 0.0 as the default since this can occur naturally in my data. I might consider
using something like 1e30.

Jon


"Gregory A. Beamer" <(E-Mail Removed)> wrote in message
news:3A8C2558-E83A-4CBB-B08C-(E-Mail Removed)...
Not a big deal if you are default to something without a huge amount of
precision, like 0.0. Floating points are more problematic when you have many
digits to the right of the decimal point.

--
Gregory A. Beamer
MVP: MCP: +I, SE, SD, DBA

Blog:
http://feeds.feedburner.com/GregoryBeamer

********************************************
| Think Outside the Box! |
********************************************
"Jon" <-> wrote in message news:(E-Mail Removed)...
> I've read that I can use a default value to avoid a nullable type in some
> situations.
>
> Is this a good idea for a double? I'm a bit worried that one normally
> should not use if
> (valDoub==???) due to the slightly inexact way that doubles are defined.
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default Double-click action =?Utf-8?B?R0JvdXdlcg==?= Windows XP Photos 7 19th Aug 2008 12:01 AM
Default double click action =?Utf-8?B?REM=?= Windows XP Help 1 3rd Mar 2006 12:16 AM
My footnotes will sometimes default to double spacing. =?Utf-8?B?TWl0Y2hlbGw=?= Microsoft Word New Users 2 1st Dec 2005 01:35 PM
Double-Click a record on a subform and use the ID as default =?Utf-8?B?aHV6emxlcHV6emxl?= Microsoft Access Form Coding 2 16th Jun 2005 10:00 PM
Double-click default for .dot files JimJah Microsoft Word Document Management 2 8th Apr 2005 04:21 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:46 AM.