Positive Infinity

From SwiftAPI

(Redirected from JavaScript Infinity)
Jump to: navigation, search

Contents

C++

#include <limits>
using namespace std;
 
double x = numeric_limits<double>::infinity();
// or 
float x = numeric_limits<float>::infinity();

C#

double x = double.PositiveInfinity;
// or 
float x = float.PositiveInfinity;

Java

double x = Double.POSITIVE_INFINITY;
// or 
float x = Float.POSITIVE_INFINITY;

JavaScript

var x = Infinity;
// or
var x = Number.POSITIVE_INFINITY;

Perl

$x = 0 + 'infinity';

PHP

$x = INF;

Python

x = float('infinity')

Ruby

Don't know of any better way than to just do

x = 1.0 / 0.0
Personal tools