Bug fixed (magic4 - a module on Info.gsb, included on setup file -now works fine).
And a task made by me:
Module Machine_Epsilon {
' (1.0 + machine epsilon) != 1.0
' find the minimu value to change a value to next value with different decimal value.
module MachineEpsilon (A){
if A=0 then A++
I=A*2
E=A-A
J=A+1
DO
I=I/2
OLDE=E
E=I
J=A+E
UNTIL J=A OR OLDE=E
? TYPE$(a);" type Machine Epsilon = ";OLDE
}
MachineEpsilon 1@ ' Decimal
MachineEpsilon 1 ' Double
MachineEpsilon 1~ ' Single
MachineEpsilon 1# ' Currency
MachineEpsilon 1% ' Integer (16bit) return 1 - has no fraction part
MachineEpsilon 1& ' Long (32bit) return 1 - has no fraction part
MachineEpsilon 1&& ' Long Long (64bit) return 1 - has no fraction part
Function EPS(A){
if A==0 then A++
var I=A*2, E=A-A,J=A+1
DO
I=I/2:OLDE=E:E=I:J=A+E
UNTIL J=A OR OLDE=E
=OLDE
}
Print EPS(1332423423)==1.47928716276446E-07
Print EPS(13324)==1.47926115801056E-12
' Currency type has always same EPS
Print EPS(1332423423#)=0.0001#
Print EPS(13324#)=0.0001#
}
Machine_Epsilon
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου
You can feel free to write any suggestion, or idea on the subject.