Post Reply 
Numworks - Question about frac()
03-02-2023, 11:45 PM
Post: #1
Numworks - Question about frac()
Hello,
in the office I use the calculators HP48sx, HP19b and another Casio 4000p (fits so nice in the shirt pocket).

HP48sx:
Input: "4.15" [FP] Display: "0.15"
Input: "-3.95" [FP] Display: "-0.95"

now I accidentally made the input with my seldom used Numworks:

Input: "frac(4.15)" Display: "0.15"
Input: "frac(-3.95)" Display: "0.05"

are FP and frac() 2 different commands?
I am confused.

(Please don't hit me right away, I only had 2 years of math (algebra) as an elective in school).

Thank you

8years elementary school and 2y business school, no bachelor or master;
but always interested in simple mathematics and calculators
Find all posts by this user
Quote this message in a reply
03-03-2023, 08:16 AM (This post was last modified: 03-03-2023 09:14 AM by rkf.)
Post: #2
RE: Numworks - Question about frac()
Obviously, the implementations differ for negative arguments. Unfortunately, I'm unfamiliar with C, but who is, may have a look at the source of Numwork's frac here.

I guess Numwork uses floor C function, which gives -4 when applied to -3.95, and if you subtract -4 from -3.95, you are given 0.05?

Also I guess HP is simply truncating what's on the left hand side of the decimal point, so -0.95 is remaining. HP code aficionados know better for sure.

At the end of the day, mathematically speaking 0.05 and -0.95 are the same modulo 1. :-)
Find all posts by this user
Quote this message in a reply
03-03-2023, 09:35 AM
Post: #3
RE: Numworks - Question about frac()
addendum:

i have in the meantime entered the examples into WolframAlpha, etc:
always the same result; only Numworks differs

WolframAlpha:
Input: "frac(4.15)" Display: "0.15"
Input: "frac(-3.95)" Display: "-0,95"

8years elementary school and 2y business school, no bachelor or master;
but always interested in simple mathematics and calculators
Find all posts by this user
Quote this message in a reply
03-03-2023, 06:03 PM
Post: #4
RE: Numworks - Question about frac()
Bonjour à toutes et tous,

As a French company based in Paris, Numworks mainly targets the French market and its calculator is particularly suitable for the intended use in our schools.

Therefore, the function \( frac(x) \) corresponds to the definition of the fractional part of the number x and should not be confused with the function giving the decimal part of a number.

Therefore, for any real \(x\), positive or negative, its definition corresponds to \( frac(x)= x - \left \lfloor x\right \rfloor \)

The fractional part of the number \(x\) is therefore always a positive number and is zero only when x is an integer.

For negative real numbers \(x\), \( frac(x) \) will therefore be positive and corresponds to the 1's complement of the decimal part of the number \(x\).


Par exemple:
\( \begin{matrix}frac(-3,85)&=&(-3,85)&-&\left\lfloor-3,85\right\rfloor\\&=&(-3,85)&-&(-4)\\&=&(-3,85)&+&4\\&=&4&-&3,85\\&=&0,15\\\end{matrix} \)



In English, frac(x) can designate the decimal part of a number, which explains why sites corresponding to other standards give a different result.

Hope, this help a bit.
C.Ret
Find all posts by this user
Quote this message in a reply
03-03-2023, 11:25 PM
Post: #5
RE: Numworks - Question about frac()
@ C.Ret, your explanation helped me.

Conclusion:
the function frac(x) has a different definition in France than in the (probably!) rest of the world.

Many thanks

(translated with google)

8years elementary school and 2y business school, no bachelor or master;
but always interested in simple mathematics and calculators
Find all posts by this user
Quote this message in a reply
03-04-2023, 07:28 AM (This post was last modified: 03-04-2023 07:35 AM by Didier Lachieze.)
Post: #6
RE: Numworks - Question about frac()
(03-03-2023 11:25 PM)Pälzer Wrote:  Conclusion:
the function frac(x) has a different definition in France than in the (probably!) rest of the world.

Unfortunately it’s another exemple where there is not a universal consensus on the definition of a mathematical notion, and it’s not specific to France.

From Wolfram Mathworld:
Quote: Although Spanier and Oldham (1987) use the same definition as the Wolfram Language, they mention the formula only very briefly and then say it will not be used further. Graham et al. (1994, p. 70), and perhaps most other mathematicians, use the different definition

\( frac(x)= x - \left \lfloor x\right \rfloor \)
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)