Math & ScienceWhole and Fractional part symbols?

Information and discussion about LaTeX's math and science related features (e.g. formulas, graphs).
Post Reply
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Whole and Fractional part symbols?

Post by Singularity »

Are there a symbols (and how do you make them) for taking the whole part and the fractional part of a number?

In other words, if the number is
98.546742209631728045325779036827

the whole part (not necessarily the floor) would be
98

and the fractional part would be
.546742209631728045325779036827.

Thanks,
A formerly stupid user.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Re: Whole and Fractional part symbols?

Post by Singularity »

I understand the difference. I'm not looking for a something which will do the calculations, I want to know if there is a symbol which represents the functions described and, if so, how to make that symbol in Latex.
User avatar
justdeath
Posts: 69
Joined: Mon Sep 05, 2011 10:27 am

Whole and Fractional part symbols?

Post by justdeath »

I guess you need the "mod" and "div" operators. If I am not mistaken:

Code: Select all

7 div 3 = 2
7 mod 3 = 1
http://en.wikipedia.org/wiki/Mod_operator
http://www.artofproblemsolving.com/Wiki ... X:Commands

Then:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[ x \div{y} = 98 \]
\[ x \mod{y} = 546742209631728045325779036827 \]
\end{document}
Nikolay
Singularity
Posts: 156
Joined: Sat Jan 22, 2011 9:55 pm

Whole and Fractional part symbols?

Post by Singularity »

justdeath wrote:I guess you need the "mod" and "div" operators. If I am not mistaken:

Code: Select all

7 div 3 = 2
7 mod 3 = 1
http://en.wikipedia.org/wiki/Mod_operator
http://www.artofproblemsolving.com/Wiki ... X:Commands

Then:

Code: Select all

\documentclass{article}
\usepackage{amsmath}

\begin{document}
\[ x \div{y} = 98 \]
\[ x \mod{y} = 546742209631728045325779036827 \]
\end{document}
Nikolay
Well, the homework is to calculate the remainder, but not using div or mod (the next step is learning div and mod), so I don't think I can use them.

The students (I'm the TA writing up the answers) are to calculate the remainder using the equation:

Code: Select all

remainder=b \cdot fractional part (\frac{a}{b})
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Whole and Fractional part symbols?

Post by kaiserkarl13 »

To quote the Wikipedia's "Floor and ceiling functions" article:

"The floor and ceiling function are usually typeset with left and right square brackets where the upper (for floor function) or lower (for ceiling function) horizontal bars are missing, and, e.g., in the LaTeX typesetting system these symbols can be specified with the \lfloor, \rfloor, \lceil and \rceil commands in math mode."

So you could say,

Code: Select all

  R = a - b\lfloor \frac a b \rfloor & a, b \ge 0
Note that it makes very little sense to refer to a remainder if either a or b is negative without defining the modulo operator somehow. For example, Fortran defines TWO such functions---mod() preserves the sign of the dividend, while modulo() preserves the sign of the divisor.
Post Reply