[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

*Subject*: **Re: [office-formula] (from Bryce L Nordgren) Fwd: Use case; multi-radix & romannumeral formatting**

*From*:**robert_weir@us.ibm.com***To*: office-formula@lists.oasis-open.org*Date*: Mon, 21 Aug 2006 14:56:48 -0400

I like the idea of a formatting in a different number base. But we would need to define what this means for non-natural numbers. How is -1 displayed in binary? Two-complement? Or just -1? What about decimals? Binary-coded decimal or IEEE floating point?

I think Roman numerals leads to other questions. How do you represent numbers greater than MMM ? How do you represent decimals? How to you indicate zero? The word "Nullus"?

We'd also want to keep in mind that the set of allowable output formats also sets expectations for parsing of input and automatic string to number conversions.

-Rob

> The following message is from Bryce L Nordgren,

> who posted to the public list "office-comment at lists.oasis-open.org".

> Since not everyone reads that list, I'm reposting here.

>

> His comment involves all the base conversion functions;

> instead of having all those functions, he suggests adding a

> new "format" that can force a number to be displayed in new

> ways (various bases, roman numerals).

>

> My initial thought is that we still need the functions (e.g., when doing

> string-based manipulations), but this might be a useful addition.

> It's certainly worthy of dicussion. In any case, I wanted to make

> sure that everyone had a chance to discuss the idea, and make sure

> that the mailing list record included this. Here it is...

>

> --- David A. Wheeler

>

> ======================================

>

>

> > > I think you just need to add a "radix" numeric field to the "general"

> > > number format. Everything else is the same. We add no data types, as

> > > "number" is used for everything (hex, roman, oct, base 20).

> >

> > Wow, I'm lost. Can you explain that? It's probably simple, but

> > I don't get it.

>

> Most of the problem is probably that I have a rather sketchy notion of

> OpenDocument, and hence I don't express things in terms of OpenDocument

> concepts very well.

>

> This is long. Keep the "implications" in mind as you read. Also, this is

> not a near-term solution, but must wait until OpenDocument 1.1 (or

> whatever's next.)

>

> Implications:

> + All table cells, all fields, may format numbers as Octal, Hex, Binary or

> Roman numeral in addition to percentage, currency, scientific, etc.

> + No special treatment is required once a numeric value is obtained: all

> numbers are interchangeable!

> + "Numeric format conversion" is a service provided by the system's number

> formatter, not by wierd spreadsheet functions. :)

> + Enter the number you want, expressed in the radix you want.

>

> So here's the use case:

>

> I type the number "15" in cell A1.

>

> Now I want to view this number as hexadecimal. I envision a solution

> where, in OpenOffice Calc, I go to Format -> Cells, click on the "Numbers"

> tab, select "Number" from the "Category" list, and under "options" there

> appears a "Radix" box with up/down arrows. The default value in the Radix

> box is "10" (i.e. "decimal"!), so to make the number appear as hexidecimal,

> I click on the "up" arrow until the box reads 16.

>

> Clicking OK makes A1 display "F"

>

> Octal would involve making the Radix box read "8". This would cause A1 to

> display 17. Judicious use of the format code box could make this read

> "017" to avoid confusing the casual reader.

>

> Binary would involve making the Radix box read "2". A1 now displays 1111.

> The format code box could cause this to be displayed as 1111b to avoid

> confusion.

>

> Now in A2, I type the formula "=A1+3" and get 18. (apologies if syntax is

> not openformula compliant.)

>

> NOTE: the plus operator just CORRECTLY added a binary and decimal number

> with no special fanfare and with no spreadsheet functions. This is an

> extension of how you can now add numbers formatted as currency with numbers

> formatted as percent, then choose how the result should be formatted.

>

> Now fractional values. I want to change the value of A1 to 0.5. A1 is

> currently formatted as radix 2 (binary). I type 0.1 and hit return. A1

> recalculates to 3.5. Note that I have to enter numbers in the current

> format. Or maybe I always enter them in decimal--that could be left up to

> the application.

>

> Did I really change the value to 0.5? Change the Radix box back to 10 and

> click OK. Whew. All is well.

>

> What is 0.5 in hexadecimal? Good question! Change the radix of cell A1

> back to 16 and viola: 0.8 appears.

>

> Now, save the file out to junk.ods, I _believe_ the cell A1 should have

> <office:value-type>float</office:value-type>

> <office:value>0.5</office:value>

> <text:p>0.8</text:p>

>

> as well as TBD formatting information.

>

> Note that in the OpenDocument XML file, the content of <office:value/>

> should always be base 10.

>

> I'm not sure of the best way to make the cell display the number as a Roman

> numeral. Add a Roman Locale? Add a "Roman numeral" format category right

> beside currency, percentage and number?

>

> Regardless, so long as the cell content is a positive integer, I should be

> able to somehow specify Roman Numeral formatting in my cell so that the

> original "15" value will be displayed as "XV", and A2 recalculates to 18.

>

> Is this clearer, or was I just more longwinded?

>

> Bryce

>

>

>

> ----- End Forwarded Message -----

**Follow-Ups**:**Re: [office-formula] (from Bryce L Nordgren) Fwd: Use case; multi-radix& roman numeral formatting***From:*"David A. Wheeler" <dwheeler@dwheeler.com>

**References**:**(from Bryce L Nordgren) Fwd: Use case; multi-radix & romannumeral formatting***From:*"David A. Wheeler" <dwheeler@dwheeler.com>

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]