|
 |
"Kenneth" <kdw### [at] gmail com> wrote:
> Yes, it works and is quite elegant, although it's a bit beyond my mental grasp
> as to how. I haven't used logarithms since my college days, ha.
log(N) = 10^exponent
which gives you some (usually) non-integer exponent.
But you only want the integer part of that.
then you raise 10 to that power, and divide your original number by that.
That obviously gives you the number to multiply that power of 10 by.
Then you just cobble it all together with concat.
> Although: For fractional values like .000794, it returns 0.794e-3. Shouldn't it
> return 7.94e-4 instead?
I don't have my laptop at hand because "reasons" - so I'm just doing this in
Excel.
Excel has a weird Floor format, so I used Int.
Try using floor(). Or ceil. Or maybe POV-Ray does weird things and you need to
test your value and then conditionally use one or the other.
I would love an online parser. :)
- bw
Post a reply to this message
|
 |