(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 2816, 105] NotebookOptionsPosition[ 2244, 82] NotebookOutlinePosition[ 2652, 98] CellTagsIndexPosition[ 2609, 95] WindowFrame->Normal ContainsDynamic->False*) (* Beginning of Notebook Content *) Notebook[{ Cell["\<\ Math 481A California State University Northridge rounding\ \>", "Section"], Cell["\[Copyright]2007 B.E.Shapiro", "Section", CellChangeTimes->{{3.397768660821547*^9, 3.397768661283945*^9}}], Cell[CellGroupData[{ Cell["round", "Section"], Cell[BoxData[ RowBox[{ RowBox[{ RowBox[{ RowBox[{"round", "[", RowBox[{"x_", ",", " ", "n_"}], "]"}], ":=", " ", RowBox[{"Module", "[", RowBox[{ RowBox[{"{", RowBox[{"nx", ",", " ", "s"}], "}"}], ",", " ", "\[IndentingNewLine]", RowBox[{ RowBox[{"nx", " ", "=", " ", RowBox[{"N", "[", "x", "]"}]}], ";", " ", "\[IndentingNewLine]", RowBox[{"s", "=", RowBox[{"10.", "^", RowBox[{"(", RowBox[{ RowBox[{"Floor", "[", RowBox[{"Log", "[", RowBox[{"10.", ",", " ", RowBox[{"Abs", "[", "x", "]"}]}], "]"}], "]"}], "+", "1", "-", "n"}], ")"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"nx", "=", RowBox[{"N", "[", RowBox[{ RowBox[{ RowBox[{"Round", "[", RowBox[{"nx", "/", "s"}], "]"}], "*", "s"}], ",", " ", "n"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Return", "[", "nx", "]"}], ";"}]}], "\[IndentingNewLine]", "]"}]}], ";"}], " "}]], "Input"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"round", "[", RowBox[{ RowBox[{ RowBox[{"-", "4.950507214766713"}], " ", "\[Times]", " ", RowBox[{"10", "^", RowBox[{"-", "47"}]}]}], ",", " ", "3"}], "]"}]], "Input"], Cell[BoxData[ RowBox[{"-", "4.95`*^-47"}]], "Output"] }, Open ]] }, Open ]] }, WindowSize->{520, 740}, WindowMargins->{{466, Automatic}, {Automatic, 143}}, FrontEndVersion->"6.0 for Mac OS X x86 (32-bit) (June 19, 2007)", StyleDefinitions->FrontEnd`FileName[{"Creative"}, "PastelColor.nb", CharacterEncoding -> "UTF-8"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[568, 21, 84, 4, 112, "Section"], Cell[655, 27, 113, 1, 42, "Section"], Cell[CellGroupData[{ Cell[793, 32, 24, 0, 42, "Section"], Cell[820, 34, 1103, 31, 113, "Input"], Cell[CellGroupData[{ Cell[1948, 69, 211, 6, 37, "Input"], Cell[2162, 77, 54, 1, 40, "Output"] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)