[genius] Fri Aug 15 17:38:41 2014 Jiri (George) Lebl <jirka 5z com>



commit 3b1b0342423c3e953c261e357b48a79e57624640
Author: Jiri (George) Lebl <jiri lebl gmail com>
Date:   Fri Aug 15 17:38:46 2014 -0500

    Fri Aug 15 17:38:41 2014  Jiri (George) Lebl <jirka 5z com>
    
        * help/C/genius.xml: update the feedback info to be more within
          reality.  Don't use ghelp: urls as those won't work in the HTML
          version.
    
        * src/eval.c: do the same thing for vector building notation as
          in all for/sum/prod loops, where if going over floats, allow
          errors withing the final number to within 2^-20 of the step size.
    
        * src/geniustests.txt: add tests for above
    
        * src/genius-readline-helper.c: avoid a race in display of errors,
          by flushing and waiting 5 miliseconds after readline and before
          sending the line onwards to the GUI

 ChangeLog                    |   16 ++++++++++++++++
 NEWS                         |   12 ++++++++----
 help/C/genius.xml            |   13 ++++++++-----
 src/eval.c                   |   38 +++++++++++++++++++++++++++++++++++---
 src/genius-readline-helper.c |    9 ++++++++-
 src/geniustests.txt          |    4 ++++
 6 files changed, 79 insertions(+), 13 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 88384a2..4532654 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+Fri Aug 15 17:38:41 2014  Jiri (George) Lebl <jirka 5z com>
+
+       * help/C/genius.xml: update the feedback info to be more within 
+         reality.  Don't use ghelp: urls as those won't work in the HTML
+         version.
+
+       * src/eval.c: do the same thing for vector building notation as
+         in all for/sum/prod loops, where if going over floats, allow
+         errors withing the final number to within 2^-20 of the step size.
+
+       * src/geniustests.txt: add tests for above
+
+       * src/genius-readline-helper.c: avoid a race in display of errors,
+         by flushing and waiting 5 miliseconds after readline and before
+         sending the line onwards to the GUI
+
 Thu Aug 14 00:54:57 2014  Jiri (George) Lebl <jirka 5z com>
 
        * lib/equation_solving/diffyqs.gel: slight optimization for
diff --git a/NEWS b/NEWS
index e595656..6222e7a 100644
--- a/NEWS
+++ b/NEWS
@@ -1,12 +1,16 @@
 Changes to 1.0.18
 
-* New functions: KroneckerProduct (alias TensorProduct), NewtonsMethod,
+* New general functions: KroneckerProduct (alias TensorProduct), NewtonsMethod,
   HalleysMethod, LambertW, LambertWm1, NonzeroColumns, NonzeroElements,
   DisplayVariables, PrintTable
-* New PlotCanvasFreeze/PlotCanvasThaw functions to improve flicker
-  if doing animations with genius.
-* Add LinePlotDrawPoints function to draw just points without the line
+* New plotting functions: PlotCanvasFreeze/PlotCanvasThaw to improve flicker
+  if doing animations with genius, LinePlotDrawPoints function to draw just
+  points without the line
 * Allow setting color in LinePlotDrawLine with RGB vector.
+* When the vector building notation is done with floats and the final
+  number is within 2^-20 times the step size of the goal,
+  assume there were roundoff errors and still add it, just like for loops,
+  so something like 1.0:0.1:3.0 now works
 * Implement subsecond precision in wait function.
 * Fix memory corruption error triggered in nested floating point
   for loops with a floating point step
diff --git a/help/C/genius.xml b/help/C/genius.xml
index afaf318..fd2206f 100644
--- a/help/C/genius.xml
+++ b/help/C/genius.xml
@@ -37,7 +37,7 @@
     <title>&appname; Manual</title>       
 
     <copyright>
-      <year>1997-2013</year>
+      <year>1997-2014</year>
       <holder>Ji&#345;&#237; (George) Lebl</holder>
     </copyright>
     <copyright>
@@ -155,9 +155,12 @@
     </releaseinfo> 
     <legalnotice> 
       <title>Feedback</title> 
-      <para>To report a bug or make a suggestion regarding the &app; application or
-      this manual, follow the directions in the <ulink url="ghelp:gnome-feedback"
-         type="help">GNOME Feedback Page</ulink>. 
+      <para>
+             To report a bug or make a suggestion regarding the &app;
+             application or this manual, please visit the
+             <ulink url="http://www.jirka.org/genius.html"; type="http">Genius
+                     Web page</ulink>
+             or email me at <email>jirka 5z com</email>.
       </para>
 <!-- Translators may also add here feedback address for translations -->
     </legalnotice> 
@@ -9352,7 +9355,7 @@ type="http">Genius Web page</ulink>.
       General Public license as published by the Free Software
       Foundation; either version 3 of the License, or (at your option)
       any later version. A copy of this license can be found at this
-      <ulink url="ghelp:gpl" type="help">link</ulink>, or in the file
+      <ulink url="http://www.gnu.org/copyleft/gpl.html"; type="http">link</ulink>, or in the file
       COPYING included with the source code of this program. </para>
 
     <para>Ji&#345;&#237; Lebl was during various parts of the development
diff --git a/src/eval.c b/src/eval.c
index 41c7a0c..f2e5aa9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 1997-2013 Jiri (George) Lebl
+ * Copyright (C) 1997-2014 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -6794,6 +6794,7 @@ iter_region_sep_op (GelCtx *ctx, GelETree *n)
        GelMatrix *mat;
        int bysgn = 1, cmp, initcmp, count, i;
        mpw_t tmp;
+
        if (n->op.oper == GEL_E_REGION_SEP_BY) {
                GEL_GET_LRR (n, from, by, to);
                if G_UNLIKELY (from->type != GEL_VALUE_NODE ||
@@ -6845,8 +6846,39 @@ iter_region_sep_op (GelCtx *ctx, GelETree *n)
 
                cmp = mpw_cmp (tmp, to->val.value);
 
-               if (cmp != 0 && cmp != initcmp)
-                       break;
+               if (cmp != 0 && cmp != initcmp) {
+                       if (mpw_is_real_part_float (tmp)) {
+                               mpw_t tmp2;
+                               int newcmp;
+
+                               /* maybe we just missed it, let's look back within 2^-20 of the by and see */
+                               if (by != NULL) {
+                                       mpfr_ptr f;
+                                       /* by is definitely mpfr */
+                                       mpw_init_set (tmp2, by->val.value);
+                                       mpw_make_copy_real (tmp2);
+                                       f = mpw_peek_real_mpf (tmp2);
+                                       mpfr_mul_2si (f, f, -20, GMP_RNDN);
+                               } else {
+                                       mpw_init (tmp2);
+                                       mpw_set_d (tmp2, 1.0/1048576.0 /* 2^-20 */);
+                               }
+
+                               mpw_sub (tmp2, tmp, tmp2);
+
+                               newcmp = mpw_cmp (tmp2, to->val.value);
+                               mpw_clear (tmp2);
+
+                               if (newcmp != initcmp) {
+                                       break;
+                               } else {
+                                       /* don't use x, but use the to, x might be too far */
+                                       mpw_set (tmp, to->val.value);
+                               }
+                       } else {
+                               break;
+                       }
+               }
        }
        mpw_clear (tmp);
 
diff --git a/src/genius-readline-helper.c b/src/genius-readline-helper.c
index dbf8fd2..17360d8 100644
--- a/src/genius-readline-helper.c
+++ b/src/genius-readline-helper.c
@@ -1,5 +1,5 @@
 /* GENIUS Calculator
- * Copyright (C) 1997-2011 Jiri (George) Lebl
+ * Copyright (C) 1997-2014 Jiri (George) Lebl
  *
  * Author: Jiri (George) Lebl
  *
@@ -239,6 +239,13 @@ main(int argc, char *argv[])
                        prompt = &buf[strlen("READLINE ")];
                        p = readline(prompt);
 
+                       /* Make sure the return gets displayed first, 5ms should not be
+                        * noticable, but should be sufficient I hope.  Kind of a hack
+                        * here.  With a flush I assume the wait might not be necessary,
+                        * but what have we to lose ... */
+                       fflush(stdout);
+                       usleep(5000);
+
                        if(p && *p)
                                add_history(p);
 
diff --git a/src/geniustests.txt b/src/geniustests.txt
index 63beece..4a28dec 100644
--- a/src/geniustests.txt
+++ b/src/geniustests.txt
@@ -1155,6 +1155,10 @@ NonzeroElements([1,0,2,0,0,4]')                                  [1,3,6]
 NonzeroElements([1,0,2,0,0])                                   [1,3]
 NonzeroElements(["fpp",0,"foo",0,0])                           [1,3]
 m=randint(2,5,5);NonzeroColumns(MakeVector(m.').')==NonzeroElements(m) true
+(1.0:0.2:3.0)@(11)                                             3.0
+1.0:0.5:2.0                                                    `[1.0,1.5,2.0]
+1.0:0.5:1.9999                                                 `[1.0,1.5]
+1.0:0.5:1.9999999                                              `[1.0,1.5,1.9999999]
 load "nullspacetest.gel"                                       true
 load "longtest.gel"                                            true
 load "testprec.gel"                                            true


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]