Home |
Search |
Today's Posts |
#10
![]() |
|||
|
|||
![]()
Ron Rosenfeld wrote...
On Fri, 19 Nov 2004 23:08:49 -0800, "Harlan Grove" wrote: "Ron Rosenfeld" wrote... ... This UDF written in VBA might help you, at least for positive numbers. ... Presumably all it'd take to handle negative numbers would be IF(x<0,"-","")&SomeUDF(ABS(x),...) but that should be simple enough to add to the udf. That's what I do if I need to outside the UDF. But the OP was talking about binary numbers. My (limited) understanding is that there are several methods of representing negative numbers in binary, including one's complement, two's complement, and, with the fractional part, one can represent it with a signed integer and a positive fractional part. .... All depends on whether negatives would be represented with a negative sign or in some form of binary encoding. Fractional parts would be trivial if one assumes fixed point representation. Maybe it's my prejudices, but exponentiation and logarithms are unnecessary and inefficient for simple base conversion. You are a better judge of efficiency than I. But I prefer numeric approaches. Unnecessary exponentiation and logarithms are PURE EVIL in numeric programming, as you should recall if you were doing numeric programming back in the Dark Ages before FPUs were common in PCs either as co-processors or included on the same chip as the CPU. It's not just the speed performance, it's also the precision that suffers. Take discount calculations, for example. An approach similar to yours v = 1 / 1.05 dv = 0 For i = 0 To N dv = dv + cf(i) * v ^ i Next i may seem like it does a reasonable job, but an approach similar to mine v = 1 / 1.05 dv = 0 For i = N To 0 Step -1 dv = dv * v + cf(i) Next i will do a much better job of preserving precision. But precision isn't really at issue here. Change of radix is a simple procedure. It should have a simple implementation. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
all the cells in excell put 2 decimal points in all numbers no ma. | Excel Discussion (Misc queries) | |||
ROUND DATA TO 2 DECIMAL PLACES | New Users to Excel | |||
decimal point override does not work | Excel Discussion (Misc queries) | |||
Format a worksheet to carry out all calculations to 2 decimal plac | Excel Discussion (Misc queries) | |||
how to convert total hours (HH:MM) into decimal number | Excel Worksheet Functions |