MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: DisplayForm changes precission

  • To: mathgroup at smc.vnet.net
  • Subject: [mg47572] Re: DisplayForm changes precission
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Fri, 16 Apr 2004 05:20:49 -0400 (EDT)
  • Organization: Universitaet Leipzig
  • References: <c5lk0f$d4a$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

try

GridBox[Map[ToString, 
      NRound[array /. Obj`CompResItem -> List, 2], {2}]] // DisplayForm

Regards
  Jens

Mario Drobics wrote:
> 
> I am trying to create a GridBox to display some numbers. When applying
> GridBox, however, the precission changes and the output gets unreadable.
> Any ideas why this is happening?
> 
>  Code:
> (* round to prec digits *)
> NRound[x_, prec_Integer:0] := MapAll[If[NumericQ[#],
>      N[Round[#*10^prec]/(10^prec)], #] &, x];
> 
> (* everything ok here *)
> NRound[array, 2] // FullForm
> List[List[
>    7.`, 0.`, 11.`, 18.`, 34.`, 1.`, 0.13`], List[7.`, 0.`, 11.`, 18.`,
> 34.`,
>      1.`, 0.13`], List[
>    9.`, 0.`, 25.`, 34.`, 18.`, 1.`, 0.17`], List[26.95`, 7.95`, 7.05`,
> 34.`,
>      18.`, 0.77`, 0.52`], List[29.`, 11.5`, 5.`, 34.`, 18.`, 0.72`, 0.56`],
>      List[31.`, 11.5`, 3.`, 34.`, 18.`, 0.73`, 0.6`]]
> 
> (* this also works *)
> NRound[array /. Obj`CompResItem -> List, 2] // TableForm
> \!\(\*
>    TagBox[GridBox[{
>          {"7.`", "0.`", "11.`", "18.`", "34.`", "1.`", "0.13`"},
>          {"7.`", "0.`", "11.`", "18.`", "34.`", "1.`", "0.13`"},
>          {"9.`", "0.`", "25.`", "34.`", "18.`", "1.`", "0.17`"},
>          {"26.95`", "7.95`", "7.05`", "34.`", "18.`", "0.77`", "0.52`"},
>          {"29.`", "11.5`", "5.`", "34.`", "18.`", "0.72`", "0.56`"},
>          {"31.`", "11.5`", "3.`", "34.`", "18.`", "0.73`", "0.6`"}
>          },
>        RowSpacings->1,
>        ColumnSpacings->3,
>        RowAlignments->Baseline,
>        ColumnAlignments->{Left}],
>      Function[ BoxForm`e$,
>        TableForm[ BoxForm`e$]]]\)
> 
> (* this does not work!!! *)
> GridBox[
>      NRound[array /. Obj`CompResItem -> List, 2]
>      ] // DisplayForm
> \!\(\*
>    TagBox[GridBox[{
>          {"7.", "0.0", "11.", "18.", "34.", "1.", ".13"},
>          {"7.", "0.0", "11.", "18.", "34.", "1.", ".13"},
>          {"9.", "0.0", "25.", "34.", "18.", "1.", ".17000000000000001"},
>          {"26.949999999999999", "7.9500000000000002",
> "7.0499999999999998", "
>          34.", "18.", ".77000000000000002", ".52000000000000002"},
>          {"29.", "11.5", "5.", "34.
>            ", "18.", ".71999999999999997", ".56000000000000005"},
>          {"
>            31.", "11.5", "3.", "34.", "18.", ".72999999999999998", \
> ".59999999999999998"}
>          }],
>      DisplayForm]\)


  • Prev by Date: Re: DisplayForm changes precission
  • Next by Date: Re: Critical memory leak with J/Link
  • Previous by thread: Re: DisplayForm changes precission
  • Next by thread: undocumented function: StringQ