Page 1 of 1

[error code = 302], The value '-1' is not in range [-1 .. 1] of the domain 'math::inCircle'

Posted: 4 Jan 2015 14:53
by Jason_6
Thank you for considering my query!
:-)

I make a program to help robot get his localization by himself.
In my program, with robot's localization by 2D-coordinates, I try to reason which polygon area my known node belongs to , by summing all included angles to find whether the sum value is equal to 2*pi(3.1415926) , of course it's not a single value but a domain like (6.2, 6.286) ,the detail is as follows.

********************************************************************
included_angle(Coor0,Coor1,Coor2,Angle):-
Coor0=coor(X0,Y0,_),
Coor1=coor(X1,Y1,_),
Coor2=coor(X2,Y2,_),
Angle=arccos((sqr(X2-X0)+sqr(Y2-Y0)+sqr(X1-X0)+sqr(Y1-Y0)-sqr(X2-X1)-sqr(Y2-Y1))/(2*sqrt(sqr(X2-X0)+sqr(Y2-Y0))*sqrt(sqr(X1-X0)+sqr(Y1-Y0)))).

********************************************************************

:roll:
【error occured!!!】
However, some unexpected error has occured.
if EE=((sqr(X2-X0)+sqr(Y2-Y0)+sqr(X1-X0)+sqr(Y1-Y0)-sqr(X2-X1)-sqr(Y2-Y1))/(2*sqrt(sqr(X2-X0)+sqr(Y2-Y0))*sqrt(sqr(X1-X0)+sqr(Y1-Y0)))),
Angle=arccos(EE).
EE sometimes is equal to 1 or -1 ,or any value in the domain [-1..1] ,which both should be ok.By analyzing, I find that
Sometimes When EE=1 or -1, it's Ok, while sometimes the following error occured,which confused me.

Could you tell me why? Millions of thanks!!:wink:


The Bug is as follows:

An internal error has occured.
========================================
Dump: 2015-01-04 21:50:23
----------------------------------------
Exception: noRangeNumber (runtime_exception)

The value is not in the admissible range for the domain

error code = 302
ExtraInfo = The value '-1' is not in range [-1 .. 1] of the domain 'math::inCircle'

raised() 2015-01-04 21:50:22
ThreadId: 9640
Class name: runtime_exception
Predicate name: runtimeExceptionRaiser


g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7run.dll (0x145080AE)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7kernel.dll (0x1400355A)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7run.dll (0x145080AF)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7run.dll (0x1450B465)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7run.dll (0x1450B497)
path_plan\path_plan.pro(410)
path_plan\path_plan.pro(394)
path_plan\path_plan.pro(386)
path_plan\path_plan.pro(340)
path_plan\path_plan.pro(345)
path_plan\path_plan.pro(318)
path_plan\path_plan.pro(303)
path_plan\path_plan.pro(296)
taskwindow\taskwindow.pro(35)
e:\program files (x86)\visual prolog 7.4 pe\pfc\gui\window.pro(810)
e:\program files (x86)\visual prolog 7.4 pe\pfc\gui\window.pro(1383)
e:\program files (x86)\visual prolog 7.4 pe\pfc\gui\drawwindow.pro(460)
e:\program files (x86)\visual prolog 7.4 pe\pfc\gui\documentwindow.pro(283)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7kernel.dll (0x14008D85)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7vpi.dll (0x15320023)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7vpi.dll (0x15316862)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7vpi.dll (0x1531538D)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7vpi.dll (0x1531D3A3)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C4791C)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C4925D)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C47CCD)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C55443)
C:\WINDOWS\SYSTEM32\ntdll.dll (0x7751C692)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C55599)
C:\WINDOWS\SYSTEM32\USER32.dll (0x76C5586D)
C:\Program Files (x86)\NVIDIA Corporation\CoProcManager\nvd3d9wrap.dll (0x73E9523E)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7vpi.dll (0x1531B125)
e:\program files (x86)\visual prolog 7.4 pe\pfc\vpi\vpi.pro(23)
e:\program files (x86)\visual prolog 7.4 pe\pfc\application\exe\mainexe.pro(22)
main.pro(17)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7kernel.dll (0x14008DDC)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\vip7kernel.dll (0x1400904C)
g:\Visual Prolog Projects\7.4\Map_RJ\Map3.4_test_try\Exe\map2.4.exe (0x004E4DF1)
C:\WINDOWS\SYSTEM32\ntdll.dll (0x77530BBB)
C:\WINDOWS\SYSTEM32\ntdll.dll (0x77530B91)

----------------------------------------
OS information:

Windows 8 64-bit (Build 9200)
Number Of Processors: 4 PageSize: 4096 Processor: 8664 level: 6 revision: 14857
ProcessorNameString: Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz
VendorIdentifier: GenuineIntel
Identifier: Intel64 Family 6 Model 58 Stepping 9
~MHz: 2494
:D :D :D :D 8-)

Posted: 4 Jan 2015 16:21
by Thomas Linder Puls
I believe it must be because then mentioned "1" and "-1" are actually slightly out of range (i.e like 1.000000...00000003).

You can deal with such inaccuracy like this:

Code: Select all

        if EE > 1 then             Angle = 0         elseif EE < -1 then             Angle = math::pi         else             Angle = math::arccos(convert(math::inCircle, EE))         end if
The code is of course "wrong" for number that are more than "slightly" outside the range.

Posted: 5 Jan 2015 5:24
by Jason_6
Thomas Linder Puls wrote:I believe it must be because then mentioned "1" and "-1" are actually slightly out of range (i.e like 1.000000...00000003).

You can deal with such inaccuracy like this:

Code: Select all

        if EE > 1 then             Angle = 0         elseif EE < -1 then             Angle = math::pi         else             Angle = math::arccos(convert(math::inCircle, EE))         end if
The code is of course "wrong" for number that are more than "slightly" outside the range.
Thanks for your professional reply. You're so talented! 8-)