GithubHelp home page GithubHelp logo

Comments (9)

mikanystrom avatar mikanystrom commented on August 10, 2024

from cm3.

ajcz avatar ajcz commented on August 10, 2024

Gee, I didn’t even realize FLOOR returns INTEGER. (I’ll change the issue title.)

Actually I was trying to calculate the fractional part of Time.T values, which turned out to be too large. The comment in Math.i3 suggests the reader to use the built-in rounding functions instead; I guess that could be a bit misleading.

Getting checked runtime errors does seem a lot better than getting incorrect results. (Or could something go wrong?)

from cm3.

mikanystrom avatar mikanystrom commented on August 10, 2024

from cm3.

ajcz avatar ajcz commented on August 10, 2024

There’s no problem with the Date interface. I just need a Date.T with a finer resolution, hence the need for the fractional part of Time.T.

from cm3.

mikanystrom avatar mikanystrom commented on August 10, 2024

from cm3.

ajcz avatar ajcz commented on August 10, 2024

How far into the past or future do you need to go?

Not too far from the present thankfully. I think the Posix implementation already uses 64-bit times internally where possible. On Windows Time uses WinBase.FILETIME, which has a resolution of 0.1 ms and is good for about 30,000 years around January 1, 1601.

If you need to convert later dates or with a different epoch you can do a stepwise thing. Divide the time by a nice round number, say 2048, do the floor, subtract it off, multiply by 2048...

Do you mean that if a Time.T is too large for Date.FromTime I can calculate suitable a remainder first, convert it to a Date.T, and then adjust that Date.T accordingly? But then how do I know when a Time.T is too large? Date.FromTime doesn’t raise any exceptions.

from cm3.

mikanystrom avatar mikanystrom commented on August 10, 2024

from cm3.

ajcz avatar ajcz commented on August 10, 2024

Umm... I didn’t have any problem with Date.FromTime.

Since all the epochs that I know about start from an integral second […]

That’s my assumption as well as well as what is said in the Time interface’s comment. I didn’t get the correct fractional part of VAR now := Time.Now() because now is too large for INTEGER and I was calculating now - FLOAT(FLOOR(now), Time.T) instead of now - Math.floor(now) or maybe just Math.fmod(now, 1.0D0).

from cm3.

mikanystrom avatar mikanystrom commented on August 10, 2024

from cm3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.