On Tue, 2009-06-16 at 09:51 +0200, Giacomo Tesio wrote:

> ReadTests_Math.Log01() Fail with an exception, and it's not [Explicit]
> on SqlServer

It works for me.  What's the exception that's thrown and its stack
trace?

> And the worse is that it's producing sql semantically different from
> the linq query.
> 
> SELECT COUNT(*)
> FROM [dbo].[Order Details]
> WHERE ((LOG(([Discount] + 1))/LOG(2,71828182845905)) > 0)
> 
> while the linq was
> 
>             var q = from c in db.OrderDetails
>                     where Math.Log((double)(c.Discount + 1)) > 0.0
>                     select c;

That is very weird.  However, it's not semantically different.
Math.Log(Math.E) == 1, so the division is actually dividing by 1, thus
the SQL is actually equivalent to:

        SELECT COUNT(*)
        FROM [dbo].[Order Details]
        WHERE (LOG([Discount] + 1) > 0)

which is semantically correct.  I'd still like to know why we're
inserting a division in there, though.  That's very weird...

 - Jon


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DbLinq" 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/dblinq?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to