BrightScript Debugger> ------ Running ------
123456789012 roFloat
2345678901234 roFloat
12345 roFloat
1234.567 roFloat
123.999 roFloat
1.23456789 roFloat
123456789012 roFloat
2345678901234 roFloat
12345 roFloat
1234.567 roFloat
123.999 roFloat
1.23456789 roFloat
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.
Current Function:
001: sub main ()
002: aa = CreateObject ("roAssociativeArray")
003: dbl1 = 123456789012
004: dbl2 = 2345678901234D40
005: dbl3 = 12345#
006: dbl4# = 1234.567D-50
007: dbl5 = CreateObject ("roDouble")
008: dbl5 = 123.999#
009: dbl6 = 1.23456789D-12
010: aa.dbl1 = dbl1
011: aa.dbl2 = dbl2
012: aa.dbl3 = dbl3
013: aa.dbl4 = dbl4#
014: aa.dbl5 = dbl5
015: aa.dbl6 = dbl6
016: ?
017: ?aa.dbl1, type (aa.dbl1)
018: ?aa.dbl2, type (aa.dbl2)
019: ?aa.dbl3, type (aa.dbl3)
020: ?aa.dbl4, type (aa.dbl4)
021: ?aa.dbl5, type (aa.dbl5)
022: ?aa.dbl6, type (aa.dbl6)
023: ?
024: bb = CreateObject ("roArray", 5, true)
025: bb.Push (dbl1)
026: bb.Push (dbl2)
027: bb.Push (dbl3)
028: bb.Push (dbl4#)
029: bb.Push (dbl5)
030: bb.Push (dbl6)
031: ?bb[0], type (bb[0])
032: ?bb[1], type (bb[1])
033: ?bb[2], type (bb[2])
034: ?bb[3], type (bb[3])
035: ?bb[4], type (bb[4])
036: ?bb[5], type (bb[5])
037: stop
038: end sub
STOP (runtime error &hf7) in ...SAXSI2/pkg:/source/fptest.brs(37)
037: stop
Backtrace:
Function main() As Void
file/line: /tmp/plugin/GACAAASAXSI2/pkg:/source/fptest.brs(38)
Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=2
aa &h0010 bsc:roAssociativeArray, refcnt=1
dbl1 &h0010 Double val:1.23457e+11, refcnt=3
dbl2 &h0010 Double val:2.34568e+12, refcnt=3
dbl3 &h0010 Double val:12345, refcnt=3
dbl4# &h0010 Double val:1234.57, refcnt=3
dbl5 &h0010 Double val:123.999, refcnt=3
dbl6 &h0010 Double val:1.23457, refcnt=3
bb &h0010 bsc:roArray, refcnt=1
BrightScript Debugger>
"dcrandall" wrote:
Does the 'box' function help you, at all?
BrightScript Debugger> ------ Running ------
123456789012 roFloat
2345678901234 roFloat
12345 roFloat
1234.567 roFloat
123.999 roFloat
1.23456789 roFloat
123456789012 roFloat
2345678901234 roFloat
12345 roFloat
1234.567 roFloat
123.999 roFloat
1.23456789 roFloat
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.
Current Function:
001: sub main ()
002: aa = CreateObject ("roAssociativeArray")
003: dbl1 = 123456789012
004: dbl2 = 2345678901234D40
005: dbl3 = 12345#
006: dbl4# = 1234.567D-50
007: dbl5 = CreateObject ("roDouble")
008: dbl5 = 123.999#
009: dbl6 = 1.23456789D-12
010: aa.dbl1 = Box (dbl1)
011: aa.dbl2 = Box (dbl2)
012: aa.dbl3 = Box (dbl3)
013: aa.dbl4 = Box (dbl4#)
014: aa.dbl5 = Box (dbl5)
015: aa.dbl6 = Box (dbl6)
016: ?
017: ?aa.dbl1, type (aa.dbl1)
018: ?aa.dbl2, type (aa.dbl2)
019: ?aa.dbl3, type (aa.dbl3)
020: ?aa.dbl4, type (aa.dbl4)
021: ?aa.dbl5, type (aa.dbl5)
022: ?aa.dbl6, type (aa.dbl6)
023: ?
024: bb = CreateObject ("roArray", 5, true)
025: bb.Push (Box (dbl1))
026: bb.Push (Box (dbl2))
027: bb.Push (Box (dbl3))
028: bb.Push (Box (dbl4#))
029: bb.Push (Box (dbl5))
030: bb.Push (Box (dbl6))
031: ?bb[0], type (bb[0])
032: ?bb[1], type (bb[1])
033: ?bb[2], type (bb[2])
034: ?bb[3], type (bb[3])
035: ?bb[4], type (bb[4])
036: ?bb[5], type (bb[5])
037: stop
038: end sub
STOP (runtime error &hf7) in ...MzasL4/pkg:/source/fptest.brs(37)
037: stop
Backtrace:
Function main() As Void
file/line: /tmp/plugin/PBCAAAMzasL4/pkg:/source/fptest.brs(38)
Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=2
aa &h0010 bsc:roAssociativeArray, refcnt=1
dbl1 &h0010 Double val:1.23457e+11, refcnt=3
dbl2 &h0010 Double val:2.34568e+12, refcnt=3
dbl3 &h0010 Double val:12345, refcnt=3
dbl4# &h0010 Double val:1234.57, refcnt=3
dbl5 &h0010 Double val:123.999, refcnt=3
dbl6 &h0010 Double val:1.23457, refcnt=3
bb &h0010 bsc:roArray, refcnt=1
BrightScript Debugger>
"destruk" wrote:
Can you store a double as a string and manually convert it?
BrightScript Debugger> ------ Running ------
123456789012 roDouble
2345678901234 roDouble
12345 roDouble
1234.567 roDouble
123.999 roDouble
1.23456789 roDouble
123456789012 roDouble
2345678901234 roDouble
2345678901234 roDouble
1234.567 roDouble
123.999 roDouble
1.23456789 roDouble
BrightScript Micro Debugger.
Enter any BrightScript statement, debug commands, or HELP.
Current Function:
001: sub main ()
002: aa = CreateObject ("roAssociativeArray")
003: dbl1 = 123456789012
004: dbl2 = 2345678901234D40
005: dbl3 = 12345#
006: dbl4# = 1234.567D-50
007: dbl5 = CreateObject ("roDouble")
008: dbl5 = 123.999#
009: dbl6 = 1.23456789D-12
010: aa.dbl1 = CreateObject ("roDouble"): aa.dbl1.SetDouble (dbl1)
011: aa.dbl2 = CreateObject ("roDouble"): aa.dbl2.SetDouble (dbl2)
012: aa.dbl3 = CreateObject ("roDouble"): aa.dbl3.SetDouble (dbl3)
013: aa.dbl4 = CreateObject ("roDouble"): aa.dbl4.SetDouble (dbl4#)
014: aa.dbl5 = CreateObject ("roDouble"): aa.dbl5.SetDouble (dbl5)
015: aa.dbl6 = CreateObject ("roDouble"): aa.dbl6.SetDouble (dbl6)
016: ?
017: ?aa.dbl1, type (aa.dbl1)
018: ?aa.dbl2, type (aa.dbl2)
019: ?aa.dbl3, type (aa.dbl3)
020: ?aa.dbl4, type (aa.dbl4)
021: ?aa.dbl5, type (aa.dbl5)
022: ?aa.dbl6, type (aa.dbl6)
023: ?
024: bb = CreateObject ("roArray", 5, true)
025: bb[0] = CreateObject ("roDouble"): bb[0].SetDouble (dbl1)
026: bb[1] = CreateObject ("roDouble"): bb[1].SetDouble (dbl2)
027: bb[2] = CreateObject ("roDouble"): bb[2].SetDouble (dbl2)
028: bb[3] = CreateObject ("roDouble"): bb[3].SetDouble (dbl4#)
029: bb[4] = CreateObject ("roDouble"): bb[4].SetDouble (dbl5)
030: bb[5] = CreateObject ("roDouble"): bb[5].SetDouble (dbl6)
031: ?bb[0], type (bb[0])
032: ?bb[1], type (bb[1])
033: ?bb[2], type (bb[2])
034: ?bb[3], type (bb[3])
035: ?bb[4], type (bb[4])
036: ?bb[5], type (bb[5])
037: stop
038: end sub
STOP (runtime error &hf7) in ...IbqHmM/pkg:/source/fptest.brs(37)
037: stop
Backtrace:
Function main() As Void
file/line: /tmp/plugin/BDCAAAIbqHmM/pkg:/source/fptest.brs(38)
Local Variables:
global &h0020 rotINTERFACE:ifGlobal
m &h0010 bsc:roAssociativeArray, refcnt=2
aa &h0010 bsc:roAssociativeArray, refcnt=1
dbl1 &h0010 Double val:1.23457e+11, refcnt=1
dbl2 &h0010 Double val:2.34568e+12, refcnt=1
dbl3 &h0010 Double val:12345, refcnt=1
dbl4# &h0010 Double val:1234.57, refcnt=1
dbl5 &h0010 Double val:123.999, refcnt=1
dbl6 &h0010 Double val:1.23457, refcnt=1
bb &h0010 bsc:roArray, refcnt=1
BrightScript Debugger>
"belltown" wrote:
1. How do I store a Double (or roDouble) in an roAssociativeArray or roArray? All my attempts to store a Double in an roAssociativeArray or roArray result in an roFloat being stored instead.
2. How do I define a Double literal with an exponent?
BSD> ? 1e40
inf 'this is a Float, it maxes at 1e38
BSD> ? 1e40#
1e+40 'this is a Double, no trouble
BSD> a = [ 1e40# ]
BSD> ? type(a[0])
roFloat 'wat!
BSD> ? a
1e+40 'well this is odd - it held the value fine. Are you sure it is a float or were you lying to me?
BSD> ? type(a[0], 3)
Double '*crickets*
"Kozma Prutkov" wrote:
"If you see a "buffalo" sign on an elephant's cage, do not trust your eyes."