Hello
what am i doing wrong?
class MyModel(models.Model):
name = models.CharField(max_length=100, verbose_name=_("Name"), blank=False, null=False)
rating = models.DecimalField(max_digits=2, decimal_places=2, default=0)
id i do something like that:
average = count/len(votes)
mymodel.rating = average
mymodel.save()
count is the...
If I have a value in an "f" register in MIPS, how do I truncate this down to X.YZ from X.YZDEF? Supposedly, you must convert from the float to two ints and display those... How is this done?
...
Hui folks,
I need to be able to store numbers like 3.5 in my table. So I've used the decimal type field. But if I enter 3.5 it round it up to 4. Am I being stupid or is it not the point of decimal to have a decimal point?
Thanks,
Jonesy
...
can anyone explain why I am getting the following results?
Dim badDecimal As Decimal = 54.50327999999999
Dim expectedDecimal As Decimal = CDec("54.50327999999999")
badDecimal = 54.50328D, while expectedDecimal = 54.50327999999999D. My understanding is that badDecimal should contain the value of expectedDecimal (the fact that expected...
Hello
A have price data stored like this: 10.25
And percentage data like this 1.1100 (1.00%)
I need a function that accurately multiplies the price by the percentage. (in php)
Thanks
...
Is there a mature library for doing decimal-based math, possibly arbitrary-precision, in JavaScript?
Edit: I want this information for a reference page on floating-point-related problems and alternatives to use when binary floating-point is inappropriate: http://floating-point-gui.de/
...
I'm trying to write an insert statement for a SQL Server table that inserts the value 1 into a decimal field. The field is of the type decimal(10, 10) which, as far as I understand, means that it can have up to 10 digits altogether, and up to 10 of those digits can be after the decimal point. But, when I try to run the insert statement I...
Hi,
I have written a small program where the program works differently on different operating systems (xp, win7) The problem is the program reads some float numbers such 2,686.
One operating system (win7) convert it to float true, but on xp it goes wrong and print it 2686. How can I understand which symbol the operation system uses fo...
Hi not sure if this is the right forum for this but does anyone know the formula for converting decimal time in to hours and minutes ?
IE 1.4 = 1hr 24mins
thanks for any help and sorry if its the wrong forum
...
I want to generate a graph with a large decimal number like -106.63633167743683 or 52.132235169410706. But whenever I'm entering the value in Excel sheet it is giving me value like -106.63633167743600 (as I have formatted cell with 15 decimal places). It is replacing the value of last two digits by 0.
Can anyone help regarding this plea...
Hey guys,
Just wondering on how I would go about converting binary to hexadecimal??
Would I first have to convert the binary to decimal and then to hexadecimal??
For example, 101101001.101110101010011
How would I go about converting a complex binary such as the above to hexadecimal?
Thanks in advance
...
I have a table with a column of type decimal. There is a ESQL/C structure that represents the table. It has a member of type decimal. I also have a normal C structure for equivalent for the same table. The type of the above mentioned field is a float.
Since we use memcpy to copy data to and from ESQL/C structure to C structure, there is...
Lua's tonumber function is nice but can only convert unsigned integers unless they are base 10. I have a situation where I have numbers like 01.4C that I would like to convert to decimal.
I have a crummy solution:
function split(str, pat)
local t = {}
local fpat = "(.-)" .. pat
local last_end = 1
local s, e, cap = str:find...
I noticed that .NET has some funky/unintuitive behavior when it comes to decimals and trailing zeros.
0m == 0.000m //true
0.1m == 0.1000m //true
but
(0m).ToString() == (0.000m).ToString() //false
(0.1m).ToString() == (0.1000m).ToString() //false
I know about necessity to comply to the ECMA CLI standard.
However I would like to kn...
I am writing a custom totaling method for a grid view. I am totaling fairly large numbers so I'd like to use a decimal to get the total. The problem is I need to control the maximum length of the total number. To solve this problem I started using float but it doesn't seem to support large enough numbers, I get this in the totals column(...
There is a task to output some data taken from database using XSLT. The application current locale is ru_RU, so decimal separator is comma. It looks like
<data>
<row>
<date value="28.04.2010"/>
<clicks value="281"/>
<depth value="1,7"/>
<row>
<row>
<date value="29.04.2010"/>
<clicks value="15"/>
<depth valu...
I am doing some custom serializing, and in order to save some space, i want to serialize the decimals as int, if possible value wise. Performance is a concern, since i am dealing with a high volume of data. The current method i use is:
if ((value > Int32.MinValue) && (value < Int32.MaxValue) && ((valueAsInt = Decimal.ToInt32(value)) == ...
Is there an easy way to present time (hh:mm) as a decimal value?
Example, 01:08 should become 1,13.
I have an asp:textbox masked (ajax) as time with the mask format "99:99". Next to this box I need to present the entered value as decimal.
<asp:TextBox ID="time" runat="server" /> hh:mm ([time in decimal format])
<ajaxToolkit:MaskedEdi...
My IIS 7 server uses a C#.NET codefile to read from an MS SQL database (on another machine) and presents it on the web. I made a similar posting before, but the problem has resurfaced and I've not been able to fix it.
In this regard I've had a problem with my Norwegian Windows Server running IIS 7. It reads the columns from a database w...
Hello you all! I just made an application which purpose is to find an x result using the rule of three. It runs fine and everything but there is a small problem. I am using WinXP Europpean Spanish version. As we all know, in many europpean countries the decimal dot is changed by a " , " comma. When I use my application, it turns out that...