X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=csrc%2Fpfinnrfp.h;h=4a3095ba6bf5f3c888665636b4976bb826dc29b4;hb=ff136ea5caf229ce3135cc6245051f40a9b443f3;hp=ec476f7d5470b9cdf2307df81832888c21ce4fc3;hpb=652797413b32546b9f9d5ada1df0c3aa12b3de7b;p=debian%2Fpforth diff --git a/csrc/pfinnrfp.h b/csrc/pfinnrfp.h index ec476f7..4a3095b 100644 --- a/csrc/pfinnrfp.h +++ b/csrc/pfinnrfp.h @@ -8,14 +8,17 @@ ** Author: Darren Gibbs, Phil Burk ** Copyright 1994 3DO, Phil Burk, Larry Polansky, David Rosenboom ** -** The pForth software code is dedicated to the public domain, -** and any third party may reproduce, distribute and modify -** the pForth software code or any derivative works thereof -** without any compensation or license. The pForth software -** code is provided on an "as is" basis without any warranty -** of any kind, including, without limitation, the implied -** warranties of merchantability and fitness for a particular -** purpose and their equivalents under the laws of any jurisdiction. +** Permission to use, copy, modify, and/or distribute this +** software for any purpose with or without fee is hereby granted. +** +** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL +** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED +** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL +** THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR +** CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING +** FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF +** CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ** **************************************************************** ** @@ -23,7 +26,7 @@ #ifdef PF_SUPPORT_FP -#define FP_DHI1 (((PF_FLOAT)(1L<<(sizeof(cell_t)*8-2)))*4.0) +#define FP_DHI1 (((PF_FLOAT)((cell_t)1<<(sizeof(cell_t)*8-2)))*4.0) case ID_FP_D_TO_F: /* ( dlo dhi -- ) ( F: -- r ) */ PUSH_FP_TOS; @@ -206,9 +209,11 @@ break; case ID_FP_FROUND: - PUSH_TOS; - TOS = (cell_t)fp_round(FP_TOS); - M_FP_DROP; + /* This was broken before and used to push its result to the + * integer data stack! Now it conforms to the ANSI standard. + * https://github.com/philburk/pforth/issues/69 + */ + FP_TOS = (PF_FLOAT)fp_round(FP_TOS); break; case ID_FP_FSWAP: /* ( -- ) ( F: r1 r2 -- r2 r1 ) */