Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DATE$ function
#53
(10-27-2023, 11:04 PM)eoredson Wrote: Maximum int64 seconds in years:

Code: (Select All)
Dim y As _Integer64
Dim s As _Integer64
Dim d As _Integer64

s = 86400 ' seconds
d = 365 ' days

Dim t As _Integer64
y = 292277026596 ' years
t = y * s * d
Print "Maxint="; t
Print "Overflow Maxint= "; t * 2

Your number is wrong.
292,277,026,596  <-- Your number of years.
292,471,208,677  <-- Max number of years, stored as seconds, without overflowing.

Code: (Select All)
Screen _NewImage(800, 600, 32)

Dim maxInt64 As _Integer64
maxInt64 = 9223372036854775807

Dim y As _Integer64
Dim s As _Integer64
Dim d As _Integer64

s = 86400 ' seconds
d = 365 ' days

Dim t As _Integer64
y = 292277026596 ' years
t = y * s * d
Print "Maxint="; t
Print "Overflow Maxint= "; t * 2

Print
Print "Correct Values"
Print Int(maxInt64 / (86400&& * 365&&)) '60 seconds in 60 minutes in 24 hours in 365 days
Print maxInt64; " <== Max INT64"
Print 292471208677&& * 86400&& * 365&&; " <== Max number of years in seconds, you can store in an INT64"

This is a simple case of division.  Why's it so hard to get the correct answer here?  Am I missing something?
Reply


Messages In This Thread
DATE$ function - by eoredson - 10-04-2023, 05:31 AM
RE: DATE$ function - by mnrvovrfc - 10-04-2023, 07:11 AM
RE: DATE$ function - by SpriggsySpriggs - 10-04-2023, 11:19 AM
RE: DATE$ function - by SMcNeill - 10-04-2023, 11:27 AM
RE: DATE$ function - by TempodiBasic - 10-04-2023, 05:04 PM
RE: DATE$ function - by bplus - 10-04-2023, 05:34 PM
RE: DATE$ function - by RhoSigma - 10-04-2023, 06:23 PM
RE: DATE$ function - by Kernelpanic - 10-04-2023, 07:23 PM
RE: DATE$ function - by eoredson - 10-04-2023, 10:24 PM
RE: DATE$ function - by SMcNeill - 10-04-2023, 10:36 PM
RE: DATE$ function - by TerryRitchie - 10-04-2023, 10:51 PM
RE: DATE$ function - by eoredson - 10-04-2023, 10:52 PM
RE: DATE$ function - by eoredson - 10-04-2023, 11:10 PM
RE: DATE$ function - by eoredson - 10-05-2023, 01:49 AM
RE: DATE$ function - by SpriggsySpriggs - 10-05-2023, 11:11 AM
RE: DATE$ function - by eoredson - 10-06-2023, 12:57 AM
RE: DATE$ function - by SpriggsySpriggs - 10-06-2023, 02:10 AM
RE: DATE$ function - by eoredson - 10-06-2023, 02:22 AM
RE: DATE$ function - by SpriggsySpriggs - 10-06-2023, 02:58 AM
RE: DATE$ function - by eoredson - 10-06-2023, 04:33 AM
RE: DATE$ function - by eoredson - 10-06-2023, 03:43 AM
RE: DATE$ function - by SpriggsySpriggs - 10-06-2023, 12:26 PM
RE: DATE$ function - by eoredson - 10-07-2023, 05:01 AM
RE: DATE$ function - by SpriggsySpriggs - 10-07-2023, 01:49 PM
RE: DATE$ function - by mnrvovrfc - 10-07-2023, 05:03 AM
RE: DATE$ function - by eoredson - 10-08-2023, 10:21 PM
RE: DATE$ function - by eoredson - 10-11-2023, 04:25 AM
RE: DATE$ function - by SpriggsySpriggs - 10-12-2023, 03:14 AM
RE: DATE$ function - by eoredson - 10-12-2023, 11:25 PM
RE: DATE$ function - by SMcNeill - 10-12-2023, 11:37 PM
RE: DATE$ function - by eoredson - 10-13-2023, 12:46 AM
RE: DATE$ function - by eoredson - 10-19-2023, 01:35 AM
RE: DATE$ function - by eoredson - 10-21-2023, 03:15 AM
RE: DATE$ function - by SMcNeill - 10-21-2023, 04:17 AM
RE: DATE$ function - by eoredson - 10-21-2023, 05:52 AM
RE: DATE$ function - by SpriggsySpriggs - 10-21-2023, 04:07 AM
RE: DATE$ function - by SpriggsySpriggs - 10-21-2023, 06:50 AM
RE: DATE$ function - by eoredson - 10-23-2023, 01:29 AM
RE: DATE$ function - by SMcNeill - 10-23-2023, 01:40 AM
RE: DATE$ function - by SpriggsySpriggs - 10-23-2023, 11:55 AM
RE: DATE$ function - by eoredson - 10-24-2023, 01:49 AM
RE: DATE$ function - by SMcNeill - 10-24-2023, 02:32 AM
RE: DATE$ function - by SMcNeill - 10-24-2023, 02:36 AM
RE: DATE$ function - by eoredson - 10-25-2023, 02:40 AM
RE: DATE$ function - by mnrvovrfc - 10-25-2023, 03:43 AM
RE: DATE$ function - by eoredson - 10-25-2023, 04:00 AM
RE: DATE$ function - by SpriggsySpriggs - 10-25-2023, 12:13 PM
RE: DATE$ function - by eoredson - 10-25-2023, 11:53 PM
RE: DATE$ function - by Kernelpanic - 10-26-2023, 12:27 AM
RE: DATE$ function - by PhilOfPerth - 10-26-2023, 02:49 AM
RE: DATE$ function - by eoredson - 10-26-2023, 02:30 AM
RE: DATE$ function - by eoredson - 10-27-2023, 11:04 PM
RE: DATE$ function - by SMcNeill - 10-27-2023, 11:23 PM
RE: DATE$ function - by eoredson - 10-27-2023, 11:29 PM
RE: DATE$ function - by SMcNeill - 10-28-2023, 12:09 AM
RE: DATE$ function - by eoredson - 10-28-2023, 12:24 AM



Users browsing this thread: 14 Guest(s)