/    Sign up×
Community /Pin to ProfileBookmark

differentiate float and integer

I have wrote a factorial to check where is the argument point that firefox convert an integer to floating pointer. It is 21!->22!.
Value of n is:21 51090942171709440000
Value of n is:22 1.1240007277776077e+21

Does javascript support any method that differentiates them?

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@BeanisApr 12.2007 — You could convert the result to a string and then test for the existence of a decimal point.
Copy linkTweet thisAlerts:
@letdoitauthorApr 12.2007 — Thanks a lot.

I have another question too. From my code

171! inf (first infinitive)

999! inf (last infinitive and 1xxx! in IE)

When i try to pass 1000!, firefox does not print out any number. How can I terminate last infinitive number dynamically in my code (in firefox 999! and 1xxx! in IE = one code checking for both)

for loop 1->1100

IE will stop at 1xxx!

Firefox will stop at 999!
×

Success!

Help @letdoit spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.21,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...