Click here to Skip to main content
15,887,311 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Richard MacCutchan17-Sep-14 5:03
mveRichard MacCutchan17-Sep-14 5:03 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika17-Sep-14 6:37
dilkonika17-Sep-14 6:37 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Richard MacCutchan17-Sep-14 7:23
mveRichard MacCutchan17-Sep-14 7:23 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika17-Sep-14 14:26
dilkonika17-Sep-14 14:26 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak17-Sep-14 17:15
mveDave Kreskowiak17-Sep-14 17:15 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Richard MacCutchan17-Sep-14 20:57
mveRichard MacCutchan17-Sep-14 20:57 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Eddy Vluggen17-Sep-14 7:49
professionalEddy Vluggen17-Sep-14 7:49 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika17-Sep-14 8:04
dilkonika17-Sep-14 8:04 
Quote:
..it is slower than the non-so-precise float


It's very noticeable in a normal PC?

Quote:
Still accounting in cents makes more sense; as it is the mimimal nondivisible amount that the value can change.


ok , but what about values like 2.672 ?
Yes , I have values like this because my application is going to work with multiple currency and the exchange rates .

Quote:
Sadly, the .NET decimal does not fit enterely into a SQL decimal

Can explain with some more words this ?
Thank you !

Desimal re 20 slower than float.
An example :
Module Module1

Sub Main()
Dim f As Single = 123456792.0F
Dim fsw As New Stopwatch
fsw.Start()
For i = 1 To 100000000
f *= 1.00000012F
Next
fsw.Stop()

Dim dsw As New Stopwatch
dsw.Start()
Dim d As Decimal = 123456792.0F
For i = 1 To 100000000
d *= 1.00000012F
Next
dsw.Stop()

Console.WriteLine(f)
Console.WriteLine("Float (ms): " & fsw.ElapsedMilliseconds)
Console.WriteLine(d)
Console.WriteLine("Decimal (ms): " & dsw.ElapsedMilliseconds)
Console.WriteLine("Float is " & dsw.ElapsedMilliseconds / fsw.ElapsedMilliseconds & " faster")

Console.ReadLine()
End Sub

End Module

Results :

7.35348
Float : 306
123456800
Decimal : 6262
Float is 20.4640522875817 faster

modified 17-Sep-14 20:27pm.

GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak17-Sep-14 17:18
mveDave Kreskowiak17-Sep-14 17:18 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika18-Sep-14 4:39
dilkonika18-Sep-14 4:39 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak18-Sep-14 5:41
mveDave Kreskowiak18-Sep-14 5:41 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika18-Sep-14 6:08
dilkonika18-Sep-14 6:08 
QuestionRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Eddy Vluggen18-Sep-14 7:27
professionalEddy Vluggen18-Sep-14 7:27 
AnswerRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika18-Sep-14 13:18
dilkonika18-Sep-14 13:18 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak18-Sep-14 14:23
mveDave Kreskowiak18-Sep-14 14:23 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika18-Sep-14 14:50
dilkonika18-Sep-14 14:50 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak18-Sep-14 15:18
mveDave Kreskowiak18-Sep-14 15:18 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Eddy Vluggen18-Sep-14 22:27
professionalEddy Vluggen18-Sep-14 22:27 
AnswerRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
GuyThiebaut19-Sep-14 2:21
professionalGuyThiebaut19-Sep-14 2:21 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
dilkonika19-Sep-14 4:20
dilkonika19-Sep-14 4:20 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
GuyThiebaut19-Sep-14 4:41
professionalGuyThiebaut19-Sep-14 4:41 
GeneralRe: Vb.net + SQL Server : Speed difference using float vs Decimal Pin
Dave Kreskowiak19-Sep-14 8:19
mveDave Kreskowiak19-Sep-14 8:19 
QuestionCreate desktop shortcut on installation of my app. vb2010 Pin
Member 1108371515-Sep-14 9:26
Member 1108371515-Sep-14 9:26 
AnswerRe: Create desktop shortcut on installation of my app. vb2010 Pin
Richard MacCutchan15-Sep-14 21:31
mveRichard MacCutchan15-Sep-14 21:31 
QuestionAsync Help Pin
byka15-Sep-14 6:13
byka15-Sep-14 6:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.