Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by filler03 · Nov 24, 2012 at 06:06 PM · integerinfinity

Is there a way to use integers greater than unity's infinity?

I noticed that when an integer gets big enough unity just recognizes it as infinity, somewhere around 1 x 10^35,but i need to make calculations with values bigger than that. How would i go about doing that?

Thank you for your help!

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Loius · Nov 25, 2012 at 04:29 PM

When you need a bigger number (and this is true even in low level stuff like building hardware), you extend your existing framework (in this case, the integer).

I'm very bad at actual math, so I can't give any specifics, but you basically need a second int to represent the 'number of infinities'. So something like (realInteger = int1 * 100000 + int2). Of course you can't use that formula 'cause it'd hit infinity, but you override your math calculations based on the assumption that you're now using two integers to represent the results.

A long time ago I did a little sniffing around into this sort of programming; I can't remember the exact name but that's the basic idea. It's named something simple like 'big' or 'huge' numbers.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by leonalchemist · Nov 24, 2012 at 07:39 PM

not 100% sure but i think float is could be bigger than int; thats still a pretty darn big number so not sure why u'd want to go bigger than that; i cant quite remember but maybe 'double' exists in unity; not sure

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image filler03 · Nov 24, 2012 at 08:39 PM 0
Share

I am trying to develop an environment that extends infinitely in all directions using terrains that spawn as you go and then calculate their distance from the origin, even tho in world space i have them stay within a certain range to avoid the floating point precision problem. I just needed a way to keep these distance values going forever.

avatar image GerryM · Nov 24, 2012 at 11:37 PM 0
Share

Unity does support "double" and "decimal" in C#. If you really need and infinite world, you'll eventually run into an overflow, if you do measure the distance from the origin.

avatar image filler03 · Nov 25, 2012 at 03:42 PM 0
Share

I have it set up where once you are a certain distance from the origin you jump back to the origin in world space but not in "actual game" space

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

13 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Dealing with Texture2D.width as it is a float number 3 Answers

Float to int casting in C# script with modulo giving division by zero error 1 Answer

How to break up a number into seperate digits? 2 Answers

Really weird behaviour with boolean variables from custom class 2 Answers

Idle Game Currency Optimizing 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges