[genius] Mon Dec 17 15:15:44 2012 Jiri (George) Lebl <jirka 5z com>
- From: George Lebl <jirka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [genius] Mon Dec 17 15:15:44 2012 Jiri (George) Lebl <jirka 5z com>
- Date: Mon, 17 Dec 2012 21:16:59 +0000 (UTC)
commit 77f31a14d4b326c74fc856281c63deaf21f9863a
Author: Jiri (George) Lebl <jirka 5z com>
Date: Mon Dec 17 15:16:40 2012 -0600
Mon Dec 17 15:15:44 2012 Jiri (George) Lebl <jirka 5z com>
* src/graphing.c: bit of post release cleanup
* help/C/genius.xml: do some fixes, add help about comments and
the new way that for loops with floats work.
ChangeLog | 7 +++++++
help/C/genius.xml | 32 ++++++++++++++++++++++++++++++++
help/genius.txt | 35 ++++++++++++++++++++++++++++++++++-
src/graphing.c | 20 +-------------------
4 files changed, 74 insertions(+), 20 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9fded3c..8378a3c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Mon Dec 17 15:15:44 2012 Jiri (George) Lebl <jirka 5z com>
+
+ * src/graphing.c: bit of post release cleanup
+
+ * help/C/genius.xml: do some fixes, add help about comments and
+ the new way that for loops with floats work.
+
Mon Dec 17 13:52:35 2012 Jiri (George) Lebl <jirka 5z com>
* Release 1.0.16
diff --git a/help/C/genius.xml b/help/C/genius.xml
index e94c603..38bec0c 100644
--- a/help/C/genius.xml
+++ b/help/C/genius.xml
@@ -1088,6 +1088,20 @@ the code if it is executed too often as there is one more operator involved.
</para>
</sect1>
+ <sect1 id="genius-gel-comments">
+ <title>Comments</title>
+ <para>
+ GEL is similar to other scripting languages in that <literal>#</literal> denotes
+ a comments, that is text that is not meant to be evaluated. Everything beyond the
+ pound sign till the end of line will just be ignored. So
+<programlisting># This is just a comment
+# every line in a comment must have its own pond sign
+# in the next line we set x to the value 123
+x=123;
+</programlisting>
+ </para>
+ </sect1>
+
<sect1 id="genius-gel-modular-evaluation">
<title>Modular Evaluation</title>
<para>
@@ -1825,6 +1839,20 @@ Loop with identifier being set to all values from <literal><from></literal
<programlisting>for i = 1 to 20 by 2 do print(i)
</programlisting>
</para>
+ <para>
+ When one of the values is a floating point number, then the
+ final check is done to within 2^-20 of the step size. That is,
+ even if we overshoot by 2^-20 times the "by" above, we still execute the last
+ iteration. This way
+<programlisting>for x = 0 to 1 by 0.1 do print(x)
+</programlisting>
+does the expected even though adding 0.1 ten times becomes just slightly more 1.0 due to the way that floating point numbers
+are stored in base 2 (there is no 0.1, the actual number stored is just ever so slightly bigger). This is not perfect but it handles
+the majority of the cases. If you want to avoid dealing with this issue, use actual rational numbers for example:
+<programlisting>for x = 0 to 1 by 1/10 do print(x)
+</programlisting>
+ This check is done only from version 1.0.16 onwards, so execution of your code may differ on older versions.
+ </para>
</sect2>
<sect2 id="genius-gel-loops-foreach">
@@ -1877,6 +1905,10 @@ If you substitute <literal>for</literal> with <literal>sum</literal> or <literal
<para>
If no body is executed (for example <userinput>sum i=1 to 0 do ...</userinput>) then <literal>sum</literal> returns 0 and <literal>prod</literal> returns 1 as is the standard convention.
</para>
+ <para>
+ For floating point numbers the same roundoff error protection is done as in the for loop.
+ See <xref linkend='genius-gel-loops-for' />.
+ </para>
</sect1>
<sect1 id="genius-gel-comparison-operators">
diff --git a/help/genius.txt b/help/genius.txt
index c262a2d..c3231f1 100644
--- a/help/genius.txt
+++ b/help/genius.txt
@@ -123,6 +123,7 @@ Kai Willadsen
Absolute Value / Modulus
Separator
+ Comments
Modular Evaluation
List of GEL Operators
@@ -931,6 +932,18 @@ Separator
there is one more operator involved.
__________________________________________________________
+Comments
+
+ GEL is similar to other scripting languages in that # denotes a
+ comments, that is text that is not meant to be evaluated.
+ Everything beyond the pound sign till the end of line will just
+ be ignored. So
+# This is just a comment
+# every line in a comment must have its own pond sign
+# in the next line we set x to the value 123
+x=123;
+ __________________________________________________________
+
Modular Evaluation
Genius implements modular arithmetic. To use it you just add
@@ -1344,6 +1357,23 @@ for <identifier> = <from> to <to> by <increment> do <body>
but will never be overshot, for example the following prints
out odd numbers from 1 to 19:
for i = 1 to 20 by 2 do print(i)
+
+ When one of the values is a floating point number, then the
+ final check is done to within 2^-20 of the step size. That is,
+ even if we overshoot by 2^-20 times the "by" above, we still
+ execute the last iteration. This way
+for x = 0 to 1 by 0.1 do print(x)
+
+ does the expected even though adding 0.1 ten times becomes just
+ slightly more 1.0 due to the way that floating point numbers
+ are stored in base 2 (there is no 0.1, the actual number stored
+ is just ever so slightly bigger). This is not perfect but it
+ handles the majority of the cases. If you want to avoid dealing
+ with this issue, use actual rational numbers for example:
+for x = 0 to 1 by 1/10 do print(x)
+
+ This check is done only from version 1.0.16 onwards, so
+ execution of your code may differ on older versions.
__________________________________________________________
Foreach Loops
@@ -1394,6 +1424,9 @@ prod <identifier> in <matrix> do <body>
If no body is executed (for example sum i=1 to 0 do ...) then
sum returns 0 and prod returns 1 as is the standard convention.
+
+ For floating point numbers the same roundoff error protection
+ is done as in the for loop. See the Section called For Loops.
__________________________________________________________
Comparison Operators
@@ -6146,7 +6179,7 @@ ExportPlot (file,type)
ExportPlot (file)
Export the contents of the plotting window to a file.
- the type is a string that specifies the file type to
+ The type is a string that specifies the file type to
use, "png", "eps", or "ps". If the type is not
specified, then it is taken to be the extension, in
which case the extension must be ".png", ".eps", or
diff --git a/src/graphing.c b/src/graphing.c
index 1e63daf..234f5cf 100644
--- a/src/graphing.c
+++ b/src/graphing.c
@@ -387,24 +387,6 @@ is_identifier (const char *e)
return TRUE;
}
-static char *
-FIXME_removeuscore (char *s)
-{
- char *p;
- s = g_strdup (s);
-
- p = strchr (s, '_');
- if (p != NULL) {
- do {
- *p = *(p+1);
- p++;
- } while (*p != '\0');
- }
-
- return s;
-}
-
-
static void
init_var_names (void)
{
@@ -5365,7 +5347,7 @@ create_surface_box (void)
surfaceplot_dep_axis_buttons = b;
/* fit dependent axis? */
- w = gtk_check_button_new_with_label (FIXME_removeuscore(_("_Fit dependent axis")));
+ w = gtk_check_button_new_with_label (_("Fit dependent axis"));
gtk_box_pack_start (GTK_BOX (box), w, FALSE, FALSE, 0);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w),
surfaceplot_fit_dependent_axis_cb);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]