LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #10   Report Post  
Harlan Grove
 
Posts: n/a
Default

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
all the cells in excell put 2 decimal points in all numbers no ma. carroll616 Excel Discussion (Misc queries) 4 December 1st 05 04:01 AM
ROUND DATA TO 2 DECIMAL PLACES roy in sunbury New Users to Excel 1 January 12th 05 03:33 AM
decimal point override does not work Sam Brauen Excel Discussion (Misc queries) 0 January 6th 05 05:29 PM
Format a worksheet to carry out all calculations to 2 decimal plac Phill Barrett Excel Discussion (Misc queries) 4 January 5th 05 01:07 PM
how to convert total hours (HH:MM) into decimal number Greg T Excel Worksheet Functions 1 November 17th 04 03:07 PM


All times are GMT +1. The time now is 08:18 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"