Hiya Ed,
My sister says to me – when in doubt, take Microsoft as the word.
Then I got your letter and started laughing.
I said to her - Ed just wrote that Microsoft can’t make up its mind.
Best, Linda
For java, BigDecimal should be used. You can choose the scale, precision and rounding mode with a math context !
Also, java offer a strict float mode.
But, for precision, always use BigDecimal !
As an example 1/5 can't be represented using double or float.
Things like (1/5)*5 wouldn't be equal to 1!
So, BigDecimal in java is the way to go.
Kind regards,
Christian
NB: The following should NOT be done in front of the children: Teachers who want to be perverse might ask about how to round complex numbers or multidimensional vectors. Should you round each element separately, or should you move to the nearest Gaussian vector in n-space?JOHN BIBBY
Everytime I design an access system, I have 3 base states :
- Granted
- Refused
- Indeterminate
And I do a treatment for each case wheee Indeterminate is synonyms of "system failure and lock down".
(eg. You forgot to cover a case in your security rule)
Doing so, the administrator can quickly see that something is wrong.
We should do the same with rounding. Forgot to specify it and the language should throw an exception or issue a clear warning.(Java does)
"sensible defaults" are a myth.
Kind regards,
Christian
--
<< snip >>
> We should do the same with rounding. Forgot to specify it and the language
> should throw an exception or issue a clear warning.(Java does)
>
> "sensible defaults" are a myth.
>
> Kind regards,
> Christian
>
Do you think "sensible defaults" are a myth in general, like in
ordinary acting out / behavior, or are you referring more specifically
to the realm of computer language design?
Kirby
"sensible defaults" are a myth.
"*sensible defaults* should be understood as culture matching. Some have, in their culture, rounding one way or another. Binding to a software is culture defining." |
"Sensible defaults" are nonsense. It suggest cultural mismatching, not logical for cultural betterment. To default means we have given up the ability to make a choice, or having it taken from us. There is nothing senseable about default when one is put at disadvantage unless there is agreement by ALL involved to abide by default. Now about zero. How is it we have a symbol for nothing? I understand symbols to represent something. Nothing is a concept of non existence, similar to sensible defaults. So here we are discussing how to round something of value off to nothing simple because of a symbol without value. Wall Street had this figured out years ago. Brad --- On Mon, 10/10/11, Paul Libbrecht <pa...@hoplahup.net> wrote: |
|
Bradford got the point.
"Sensible defaults" are nonsense. It suggest cultural mismatching, not logical for cultural betterment."*sensible defaults* should be understood as culture matching.Some have, in their culture, rounding one way or another.Binding to a software is culture defining."
To default means we have given up the ability to make a choice, or having it taken from us. There is nothing senseable about default when one is put at disadvantage unless there is agreement by ALL involved to abide by default.
Now about zero. How is it we have a symbol for nothing? I understand symbols to represent something. Nothing is a concept of non existence, similar to sensible defaults. So here we are discussing how to round something of value off to nothing simple because of a symbol without value. Wall Street had this figured out years ago.
Brad
One of the bests practice in software engineering is to NOT rely on defaults values.
Let say that the Python team decide to change the space separator with a coma. What happens ? Software break !
Another example, SQLServer takes into account the locale of his host.
When you issue a select statement involving currencies they get formatted in a lot of funny formats.
Eg :
1 000.01
1,000.01
1.000,01
1000.01
1000,01
So, if you want to make good queries, you've first to tell which locale you want.
We do the same in maths, when symbols aren't obvious like :
P[x], A|B or C(n,k)
Even N* may require some explanations.
Kind regards,
Christian
One of the bests practice in software engineering is to NOT rely on defaults values.
Let say that the Python team decide to change the space separator with a coma. What happens ? Software break !
Paul, I suspect the history you have met is not far different than the history I have met, filled with assumptions and bias manipulations of facts which are not always true. We choose to accept it by default because we were not there or we chose not to accept it. Ah the picking and choosing to figure out the difference between something of value and nothing. PS: Acceptance without betterment (growth) is by default non growth and therefore nonproductive, no betterment. |
> In GeoGebra round(-1.5) = -1 (rounds "up")
>
> In Excel round(-1.5) = -2 (rounds away from zero)
>
> What do we teach our kiddies these days? What does your favorite
> program do?
> Thanks for your help!
> Linda
>
round
- round to integer (returns double
), rounding halfway
cases away from zero" which reflects the usage in Excel,
LibreOffice, Kspread, etc. -- ------------------------- Algot Runeman 47 Walnut Street, Natick MA 01760 508-655-8399 algot....@verizon.net Web Site: http://www.runeman.org Twitter: http://twitter.com/algotruneman/ sip:algot....@ekiga.net Open Source Blog: http://mosssig.wordpress.com MOSS SIG Mailing List: http://groups.google.com/group/mosssig2
One of the bests practice in software engineering is to NOT rely on defaults values.
I wonder where you put this kind of education in a computer science curriculum.I do not think HCI is the right place.
The opportunity in a math context is to show that arbitrary (not
necessarily sensible) conventions do play a big role.
One of the conventions I fight is this bias in favor of cubes, making
all volume measures with respect to this unit.
Students get through school without ever learning of alternative ways
of thinking, about 3rd powering, about non-rectilinear space-filling
ala XYZ.
At least when they're in *my* classes, they get to experience some
"defaults" they were never aware of before, because they were taken
for granted as not modifiable.
And what we learn in math applies elsewhere, when it comes to removing
blinders, and realizing new freedoms.
Kirby
This is not agreed to by those to whom it does matter, the numerical
analysts. I have posted their solution in a separate e-mail to this group.
> but the convention is to round to
> the nearest, and when two are equidistant then round towards zero".
>
> NB: The following should NOT be done in front of the children: Teachers
> who want to be perverse
This is not perverse. It is fundamental in the study of error-correcting
codes, to give just one example.
> might ask about how to round complex numbers or
> multidimensional vectors. Should you round each element separately, or
> should you move to the nearest Gaussian vector in n-space?
The ISO/ANSI APL standard defined complex floor and ceiling functions in
the 1980s, giving the basis for rounding functions. Common LISP and Ada
followed its lead on the definitions of all complex-valued functions. The
formal definition requires that you know a fair amount of complex
arithmetic and APL both, more than I can explain in an e-mail.
For a complex argument, the definition of <. is modelled by:
floor=: j./@(ip+(c2>c1),c1+:c2)
'`c1 c2 fp ip'=:(1:>+/@fp)`(>:/@fp)`(+.-ip)`(<.@+.)
As developed by McDonnell [10], this function has the following properties:
Convexity: If (<.z1)=(<.z2) and z3 lies on the line between z1 to z2,
then (<.z3)=(<.z1) .
Translatability: If z4 is a Gaussian integer, then (z4+<.z5)=(<.z4+z5) .
Compatibility: (<.x j.0)=((<.x)j.0) and (<.0 j.x)=(0 j.(<.x))
McDonnell, E.E., Complex Floor, APL Congress 73, North-Holland/American
Elsevier.
The basic idea is that we define a square for each Gaussian integer in the
complex plane, giving the set mapped to that point by floor. The region is
tilted at 45 degrees, with the given point on the bottom left side. These
regions are marked out by lines from upper left to lower right through
joining Gaussian integers, and from upper right to lower left going midway
between them. We then round using floor(z+0.5*(1+i)).
> JOHN BIBBY
>
> The important thing is to stress that this is a convention, not a
> mathematical "truth" (which not all programs follow)
Correct.
> On 9 October 2011 18:38, Christian Baune <progr...@gmail.com> wrote:
>
>> For java, BigDecimal should be used. You can choose the scale, precision
>> and rounding mode with a math context !
>>
>> Also, java offer a strict float mode.
>>
>> But, for precision, always use BigDecimal !
>>
>> As an example 1/5 can't be represented using double or float.
>> Things like (1/5)*5 wouldn't be equal to 1!
>>
>> So, BigDecimal in java is the way to go.
>>
>> Kind regards,
>> Christian
>> Le 9 oct. 2011 17:09, "Edward Bujak" <edward...@hotmail.com> a �crit
>> :
>>
>> TI-Nspire CAS handheld
>> calculator<http://education.ti.com/calculators/products/US/Nspire-Family/>("away
>> from 0")
>>> round(-1.5,0) = -2
>>> round(1.5,0) = 2
>>>
>>> Excel 2003 ("away from 0")
>>> ROUND(-1.5,0) = -2
>>> ROUND(1.5,0) = 2
>>>
>>> Mathematica <http://www.wolfram.com/mathematica/> ("away from 0")
>>> Round[-1.5] yields -2
>>> Round[1.5] yields 2
>>>
>>> Microsoft Mathematics
>>> 4<http://www.microsoft.com/download/en/details.aspx?id=15702>(free
>>> computer software)
>>> round(-1.5) = -1
>>> round(1.5) = 2
>>>
>>> Alice 2.2b <http://alice.org/> programming environment (free computer
>>> software)
>>> round(-1.5) = -1
>>> round(1.5) = 2
>>>
>>> Processing <http://processing.org/> programming environment (Java)
--
Edward Mokurai
(默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر
ج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://wiki.sugarlabs.org/go/Replacing_Textbooks
In our school, it's important to question the cube, the shape itself, as the
defacto best or only shape to use, for describing units of volume.
Why a cube?
There's actually a lot one could say on this point.
However, picture something like a Montessori school kit or "job"
made of hollow vessels, each of a specific shape and dimension.
Water or grains, salt, other ingredients used in cooking, may
be poured from shape to shape, like measuring cups.
We're used to unit cups, unit teaspoons, that are anything
but cubical.
Likewise our unit volume tetrahedron: it's pointy and has only
four corners instead of six.
The other shapes weigh in with their relative volumes (relative
to this one) with the cube reappearing in the Volume 3 position.
It's a different game, but important for all the hooks it gives
us, to related mathematical topics, and also to lore.
Kirby
We're used to unit cups, unit teaspoons, that are anything
but cubical.
Good point. However the standard units of volume in the metric system
tend to be cube shaped, just as in the Anglo-American system.
Imagine having a small unit tetrahedron of sugar or salt, and then
expanding that tetrahedron by quadrupling each edge. Each
edge is now 4x the original unit. By how much has volume increased?
What's maybe not made sufficiently clear in some curricula is the
linear : areal : volumetric change rates are 1st, 2nd, 3rd power
respectively so the new volume is 4 to the 3rd power or 64.
Imagine living in a culture where every time you saw "3rd power"
you spontaneously thought more in terms of a tetrahedron than
a cube, that would be strange (weird, alien seeming).
On the other hand, your space-filling rhombic dodecahedron,
with diamond faces, might be logically sized to contain six of
your units. The octahedron: four. Already, that's more whole
number thinking than we expect from the polyhedrons, based
on the time-honored cube-based approach.
Kirby
Really? I never heard of that. Can you give me a link?
> Binding to a software is culture defining."
>
> "Sensible defaults" are nonsense. It suggest cultural mismatching, not
> logical for cultural betterment.
>
> To default means we have given up the ability to make a choice, or having
> it taken from us.
No, a default means that one can make a choice, but if one doesn't, things
won't break. Some value will be available to use.
> There is nothing sensible about default when one is put
> at disadvantage unless there is agreement by ALL involved to abide by
> default.
You can't get 100% agreement that the sky is blue. Because, of course, it
can't be blue over more than half the Earth at the same time. What we do
have is agreement to disagree, using the locale mechanism, on how to
represent time, dates, money, and numbers more generally, and agreement
that programmers will not use hard-coded representations of any of them.
> Now about zero. How is it we have a symbol for nothing?
How is it that you did not learn that this is one of the greatest
intellectual achievements of all time, comparable with turning the rocks
over and chipping the edges from both sides?
> I understand
> symbols to represent something. Nothing is a concept of non existence,
This was the argument of the Catholic Church when Fibonacci introduced
Hindu-Arabic numerals and methods of calculation to Europe during the
period of the Crusades. The use of 0 was denounced as blasphemy against
the Creator.
It is the reason why the initial hour of the day has been 12, or rather
XII, for the last millennium since cathedral clocks were invented. It only
became 0 with the advent of the 24-hour clock cycle, which incidentally
allows us to tell for sure that 00:00 is the beginning of the following
day, not the ending of the previous day, which is 23:59:59.999...for any
finite number of 9s. It also does away with the ambiguity of 12 am and 12
pm. 12:00 is noon, and 00:00 is midnight, with no possibility of
confusion.
> similar to sensible defaults. So here we are discussing how to round
> something of value off to nothing simple because of a symbol without
> value.
Conflating a value of 0 with having no value is one of the most elementary
category errors. No programming language agrees with you. No accounting
program agrees with you. In J, for example, at the beginning of a session,
a NB. No value
|value error: a
a=.0 NB. Value of 0
a
0
(In any case, the question was not the value of 0, it was the correct
method of rounding for negative numbers--should -1.5 be rounded to -1 or
-2? Various people have various notions. I try to stick with the numerical
analysts, who recommend rounding to even numbers so that we round about
equally up and down.)
Similarly for the empty set in mathematics. Any attempt to argue against
it would apply equally to an empty cup, bowl, or container of any other
kind.
Similarly for the empty list () in LISP, or empty arrays such as '' (empty
string) or 0#0 (empty numeric list) in APL/J.
I don't personally care how negative you may be toward 0 and negative
numbers. ^_^
> Wall Street had this figured out years ago.
LOL. Your side of this argument lost when the earliest credit card
software closed every account that was paid in full down to $0. The
customers howled at the issuers, and the issuers howled at the
programmers, and that was the end of that.
> Brad
I don't know where it should go, but we need much more of the technique
known as defensive programming, in which one accounts for all possible
sources of error. It can be as simple as using named constants rather than
"magic numbers" to avoid confusion and make updating easy and foolproof,
or as complex as the choice to validate or reject user input.
We have seen a number of security updates in Ubuntu Linux in recent weeks,
when it was discovered that interpreting text strings in graphics files
could result in executing arbitrary code. The parser had failed to account
for the possible effects of control characters in text strings, or
something of the sort.
> I've always asked my students to have some math feelings, but it's always
> been an extra that is very hard to require.
This is not so much a CS skill, but a part of Numerical Analysis. Which
every CS student should nevertheless know something about.
> Nice, yet another "real" soft skill.
NA is about as hard as skills get, when done right.
> paul
>
> Le 10 oct. 2011 � 22:00, Maria Droujkova a �crit :
>
>> So, I think both practices - knowing the cultural default values, and
>> not having to rely on them - have merit. Programmers do need to be
>> conscious and flexible about defaults. They also should be culturally
>> aware enough to be able to specify defaults for (international) clients
>> or project collaborators, based on the context.
>
> --
> You received this message because you are subscribed to the Google Groups
> "MathFuture" group.
> To post to this group, send email to mathf...@googlegroups.com.
> To unsubscribe from this group, send email to
> mathfuture+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mathfuture?hl=en.
>
>
Have you ever studied measure theory or crystallography or modular forms?
Each provides a much wider concept of measuring than the usual unit cube.
How about measure in non-Euclidean spaces, where the area of a triangle is
proportional to the difference of its angle-sum from 180 degrees? For
example, on a sphere you can draw triangles with three right angles, whose
area is one eighth of the entire sphere. Similarly for fitting a finite
set of tetrahedra of a certain size together to tile all of a
3-dimensional elliptic space.
> At least when they're in *my* classes, they get to experience some
> "defaults" they were never aware of before, because they were taken
> for granted as not modifiable.
>
> And what we learn in math applies elsewhere, when it comes to removing
> blinders, and realizing new freedoms.
>
> Kirby
>
> --
> You received this message because you are subscribed to the Google Groups
> "MathFuture" group.
> To post to this group, send email to mathf...@googlegroups.com.
> To unsubscribe from this group, send email to
> mathfuture+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/mathfuture?hl=en.
>
>
> Have you ever studied measure theory or crystallography or modular forms?
> Each provides a much wider concept of measuring than the usual unit cube.
Yes, Dr. Loeb of MIT, crystallographer, was sympathetic to
the idea of introducing the CCP / FCC packing NOT in
terms of a cube, but a cuboctahedron. That's six square
faces, eight triangular, as you know, the corners coincident
with the centers of CCP balls, nuclear ball at the center,
12-around-1.
The question then becomes: how many balls in the next
layer out, surrounding the 12? The sequence is 1, 12, 42, 92...
and if you look it up in OEIS you'll even fine my name in the
links section, as I relate these to the morphology of the virus.
Here's from Linus Pauling special collection, same arrangement:
http://www.flickr.com/photos/17157315@N00/3049399298/in/set-72157609640895901
(92 in this 3rd layer: 10 * F * F + 2, F= 3).
In the RadMath curriculum I tout, said cuboctahedron has
a volume of precisely 20, relative the unit of volume formed
by any four in closest-packing (their 4 center form the tetra-
hedron or simplex, topology's most primitive enclosure in
so-called 3-space ("so-called" because there's other term-
inology we might use some of the time)). The octahedron,
which fills space in complement with the tetrahedron, has
volume 4. I already mentioned our rhombic dodecahedron
(space-filling, volume 6). Even our elementary school
teachers know this much, as it's what they learned in the
1970s.
> How about measure in non-Euclidean spaces, where the area of a triangle is
> proportional to the difference of its angle-sum from 180 degrees? For
> example, on a sphere you can draw triangles with three right angles, whose
> area is one eighth of the entire sphere. Similarly for fitting a finite
> set of tetrahedra of a certain size together to tile all of a
> 3-dimensional elliptic space.
Of some interest is what it takes to be non-Euclidean. The
traditional meaning is we've somehow jiggered with the
5th Axiom, but Karl Menger (Vienna Circle) suggested we
might jigger the definition of "dimension" and likewise
escape the Euclidean vortex.
Change definitions, not just axioms sometimes.
Let every shape, point, line, plane or polyhedron, be
considered a volume. He called it "a geometry of lumps"
and it plays much the same role as discrete vs. analog
signals, but in geometry.
Volume quanta are irreducible to anything of "lower"
dimension.
Makes sense when doing ray tracing, or claymation.
>> At least when they're in *my* classes, they get to experience some
>> "defaults" they were never aware of before, because they were taken
>> for granted as not modifiable.
>>
>> And what we learn in math applies elsewhere, when it comes to removing
>> blinders, and realizing new freedoms.
>>
Alluding to Erich Fromm somewhat:
http://en.wikipedia.org/wiki/The_Fear_of_Freedom
(linked from today's blog post as well)
Kirby