Recent

Author Topic: Making 'powers' into human readable decimal representations  (Read 18746 times)

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Re: Making 'powers' into human readable decimal representations
« Reply #15 on: March 30, 2011, 06:21:32 pm »
Yes Fab, you were :-)

Well, it's finished. In the end, having tried and failed at using some of the generously donated code snippets, I "went back to the drawing board", sat back and thought - "Right, what do I need to do and in what order?". I then just coded it all, section by section, almost entirely on my own (apart from with some help from FabienWang as detailed below) so I am quite pleased:

A) Created a form with 4 buttons and associated OnClick procedures, then

1) Calculated each of my 4 relevant powers using the power(X^X) function and stored the value as a string

2) Read the string left to right until I found 'E'

3) Read the values to the right of E, converted to an int and stored it in a var

4) Created a number of zeroes dictated by that previously generated int and stored them in a var (max size was 177 zeroes so easily done). I had to make a loop for that - couldn't think of a better way.

5) Then I divided the var holding all the zeroes by 9 (for billion) or 12 (for trillions)

7) Then created another loop (with the help of FabienWang) to convert those groupings from a number of zero groups into "billion" or "trillion" until there was less than 9 zeroes in the loop.

8) Converted it all to strings and pieced it together into Label.Captions

And the result is in the attached Screenshots.

A proud day for me. Seemingly more complex than I first thought but a very enjoyable and productive learning experience.


« Last Edit: March 30, 2011, 06:28:17 pm by tedsmith »

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: Making 'powers' into human readable decimal representations
« Reply #16 on: March 30, 2011, 08:02:38 pm »
At the first look, i read BigTits lol but no... that can't be, i looked again and it was clear :D
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Re: Making 'powers' into human readable decimal representations
« Reply #17 on: March 30, 2011, 10:31:17 pm »
Fabien

It's sneakily deliberate, for comic value. A bit tongue in cheek, so to speak.

fabienwang

  • Sr. Member
  • ****
  • Posts: 449
  • Lazarus is the best
    • My blog
Re: Making 'powers' into human readable decimal representations
« Reply #18 on: March 30, 2011, 11:41:18 pm »
Fabien

It's sneakily deliberate, for comic value. A bit tongue in cheek, so to speak.

ohhh happy to know that i'm not the only one to have a dirty mind ^^
I'm using Arch Linux.
Known for: CPickSniff, OpenGrabby
Contributed to: LazPaint

 

TinyPortal © 2005-2018