Diego,

Thanks, you're absolutely right!  Should have remembered the
nomenclature differences.

In answer to your tongue-in-cheek "short answer":  I'm working on a
proof of concept for using NH in our application, and all of the "old
guard" developers who have the authority to OK such a move are hard-
core SQL Server wonks.  If they saw that NH was storing those values
in the database, they'd totally flip out, no matter what ended up on
the screen.

Thanks again!

Brian

On Jan 12, 11:27 pm, Diego Mijelshon <[email protected]> wrote:
> Short answer:
> If it's 0.65 when you store it, and 0.65 when you retrieve it, what is the
> problem anyway? :-)
>
> Long answer:
> This has to do with approximate numeric data types and conversion. A float
> column corresponds to a Double in .NET (real corresponds to Single), so you
> have an unintended conversion there.
> Either change the db type to real, the .net type to double, or both to
> decimal.
>
>    Diego
>
>
>
> On Wed, Jan 13, 2010 at 00:38, Brian Sullivan <[email protected]> wrote:
> > I've got a property on a persistent object that's a float in .NET,
> > mapped as a System.Single via Fluent NH, to a float column in a SQL
> > Server database.  When I save my entity, I get values in this float
> > column that are slightly off.  Say, if the user enters .65, I get
> > 0.649999976158142 stored in the database.  I've checked the value of
> > the .NET property in the debugger, and it's got the exact value the
> > before it's persisted, and also if I retrieve it later.  What's going
> > on here?
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "nhusers" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<nhusers%[email protected] 
> > >
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/nhusers?hl=en.
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.


Reply via email to