Numeric operators
Arithmetic on integers and doubles.
Every program can use these operators. No import is necessary.
| Operator | Arguments | Gives |
|---|---|---|
- |
left: double, right: double | double |
- |
left: int, right: int | int |
* |
left: double, right: double | double |
* |
left: int, right: int | int |
/ |
left: double, right: double | double |
/ |
left: int, right: int | double |
% |
left: int, right: int | int |
+ |
left: double, right: double | double |
+ |
left: int, right: int | int |
+ |
left: int, right: int | int |
+ |
left: int, right: int | int |
+ |
left: int, right: <optional>int | int |
+ |
left: int, right: <optional>int | int |
+ |
left: int, right: <optional>int | int |
acos |
value: double | double |
asin |
value: double | double |
atan2 |
y: double, x: double | double |
bit_shl |
value: int, count: int | int |
bit_shr |
value: int, count: int | int |
bit_ushr |
value: int, count: int | int |
ceil |
value: double | int |
cos |
value: double | double |
fabs |
v: double | double |
floor |
value: double | int |
idiv |
left: int, right: int | int |
int2double |
value: int | double |
max |
left: int, right: int | int |
random |
min: int, max: int | int |
sin |
value: double | double |
sqrt |
value: double | double |
tan |
v: double | double |
to_double |
input: int | double |
to_int |
value: double | int |
unwrap |
arg: <optional>double | double |
unwrap |
arg: <optional>int | int |
Target support marks
- Own template
- Default template
- No template
The operator works for a target with an own template and for a target with the default template. The default template is the * entry of the definition: it writes the same code for every target that has no template of its own. A target with no template writes no code, and a program that uses the operator does not compile for that target.
-
(- left right) → double
-(left: double, right: double)numeric - operations
Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4478
-
(- left right) → int
-(left: int, right: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Integer arithmetic
class Main { sfn main:void () { def a 10 def b 3 print ("sum " + (a + b)) print ("difference " + (a - b)) print ("product " + (a * b)) print ("quotient " + (a / b)) print ("integer quotient " + (idiv a b)) }}const a = 10;const b = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 10; const b = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();const a : number = 10;const b : number = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 10; const b : number = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();var a int64= int64(10);var b int64= int64(3);fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") )fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") )fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") )fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")
func r_div_f64(a float64, b float64) float64 { return a / b}
type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(10); var b int64= int64(3); fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") ) fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") ) fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") ) fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 10; let b: i64 = 3; println!("sum {}", a + b); println!("difference {}", a - b); println!("product {}", a * b); println!("quotient {}", a as f64 / b as f64); println!("integer quotient {}", a / b);}a = 10b = 3print("sum " + str(a + b))print("difference " + str(a - b))print("product " + str(a * b))print("quotient " + str(r_div_f64(float(a), float(b))))print("integer quotient " + str(((a) // (b))))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
def r_div_f64(a, b): if b == 0.0: if a == 0.0 or a != a: return float('nan') return math.copysign(float('inf'), a) * math.copysign(1.0, b) return a / b
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 10 b = 3 print("sum " + str(a + b)) print("difference " + str(a - b)) print("product " + str(a * b)) print("quotient " + str(r_div_f64(float(a), float(b)))) print("integer quotient " + str(((a) // (b))))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 10;final Integer b = 3;System.out.println(String.valueOf( "sum " + (a + b) ) );System.out.println(String.valueOf( "difference " + (a - b) ) );System.out.println(String.valueOf( "product " + a * b ) );System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) );System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 10; final Integer b = 3; System.out.println(String.valueOf( "sum " + (a + b) ) ); System.out.println(String.valueOf( "difference " + (a - b) ) ); System.out.println(String.valueOf( "product " + a * b ) ); System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) ); System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 10;val b : Int = 3;println( "sum " + (a + b).toString() )println( "difference " + (a - b).toString() )println( "product " + (a * b).toString() )println( "quotient " + (a.toDouble() / b.toDouble()).toString() )println( "integer quotient " + (a / b).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 10; val b : Int = 3; println( "sum " + (a + b).toString() ) println( "difference " + (a - b).toString() ) println( "product " + (a * b).toString() ) println( "quotient " + (a.toDouble() / b.toDouble()).toString() ) println( "integer quotient " + (a / b).toString() )}__g_args = args;int a = 10;int b = 3;print( "sum " + (a + b).toString() );print( "difference " + (a - b).toString() );print( "product " + (a * b).toString() );print( "quotient " + (a / b).toString() );print( "integer quotient " + (((a) ~/ (b))).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 10; int b = 3; print( "sum " + (a + b).toString() ); print( "difference " + (a - b).toString() ); print( "product " + (a * b).toString() ); print( "quotient " + (a / b).toString() ); print( "integer quotient " + (((a) ~/ (b))).toString() );}let a : Int = 10let b : Int = 3print("sum " + String(a + b))print("difference " + String(a - b))print("product " + String(a * b))print("quotient " + String((Double(a) / Double(b))))print("integer quotient " + String(a / b))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 10 let b : Int = 3 print("sum " + String(a + b)) print("difference " + String(a - b)) print("product " + String(a * b)) print("quotient " + String((Double(a) / Double(b)))) print("integer quotient " + String(a / b))}__main__swift()int a = 10;int b = 3;Console.WriteLine("sum " + (a + b));Console.WriteLine("difference " + (a - b));Console.WriteLine("product " + a * b);Console.WriteLine("quotient " + ((double)(a) / (double)(b)));Console.WriteLine("integer quotient " + (a / b));The complete file
using System;class Main { static void Main( string [] args ) { int a = 10; int b = 3; Console.WriteLine("sum " + (a + b)); Console.WriteLine("difference " + (a - b)); Console.WriteLine("product " + a * b); Console.WriteLine("quotient " + ((double)(a) / (double)(b))); Console.WriteLine("integer quotient " + (a / b)); }}int a = 10;int b = 3;std::cout << std::string("sum ") + std::to_string(a + b) << std::endl;std::cout << std::string("difference ") + std::to_string(a - b) << std::endl;std::cout << std::string("product ") + std::to_string(a * b) << std::endl;std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl;std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <cstdlib>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 10; int b = 3; std::cout << std::string("sum ") + std::to_string(a + b) << std::endl; std::cout << std::string("difference ") + std::to_string(a - b) << std::endl; std::cout << std::string("product ") + std::to_string(a * b) << std::endl; std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl; std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl; return 0;}$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");val a : Int = 10val b : Int = 3println( "sum " + (a + b) )println( "difference " + (a - b) )println( "product " + a * b )println( "quotient " + (a.toDouble / b.toDouble) )println( "integer quotient " + (a / b) )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 10 val b : Int = 3 println( "sum " + (a + b) ) println( "difference " + (a - b) ) println( "product " + a * b ) println( "quotient " + (a.toDouble / b.toDouble) ) println( "integer quotient " + (a / b) )}Definition: compiler/Lang.rgr, line 4479
*
(* left right) → double
*(left: double, right: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4796
*
(* left right) → int
*(left: int, right: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Integer arithmetic
class Main { sfn main:void () { def a 10 def b 3 print ("sum " + (a + b)) print ("difference " + (a - b)) print ("product " + (a * b)) print ("quotient " + (a / b)) print ("integer quotient " + (idiv a b)) }}const a = 10;const b = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 10; const b = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();const a : number = 10;const b : number = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 10; const b : number = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();var a int64= int64(10);var b int64= int64(3);fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") )fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") )fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") )fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")
func r_div_f64(a float64, b float64) float64 { return a / b}
type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(10); var b int64= int64(3); fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") ) fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") ) fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") ) fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 10; let b: i64 = 3; println!("sum {}", a + b); println!("difference {}", a - b); println!("product {}", a * b); println!("quotient {}", a as f64 / b as f64); println!("integer quotient {}", a / b);}a = 10b = 3print("sum " + str(a + b))print("difference " + str(a - b))print("product " + str(a * b))print("quotient " + str(r_div_f64(float(a), float(b))))print("integer quotient " + str(((a) // (b))))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
def r_div_f64(a, b): if b == 0.0: if a == 0.0 or a != a: return float('nan') return math.copysign(float('inf'), a) * math.copysign(1.0, b) return a / b
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 10 b = 3 print("sum " + str(a + b)) print("difference " + str(a - b)) print("product " + str(a * b)) print("quotient " + str(r_div_f64(float(a), float(b)))) print("integer quotient " + str(((a) // (b))))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 10;final Integer b = 3;System.out.println(String.valueOf( "sum " + (a + b) ) );System.out.println(String.valueOf( "difference " + (a - b) ) );System.out.println(String.valueOf( "product " + a * b ) );System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) );System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 10; final Integer b = 3; System.out.println(String.valueOf( "sum " + (a + b) ) ); System.out.println(String.valueOf( "difference " + (a - b) ) ); System.out.println(String.valueOf( "product " + a * b ) ); System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) ); System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 10;val b : Int = 3;println( "sum " + (a + b).toString() )println( "difference " + (a - b).toString() )println( "product " + (a * b).toString() )println( "quotient " + (a.toDouble() / b.toDouble()).toString() )println( "integer quotient " + (a / b).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 10; val b : Int = 3; println( "sum " + (a + b).toString() ) println( "difference " + (a - b).toString() ) println( "product " + (a * b).toString() ) println( "quotient " + (a.toDouble() / b.toDouble()).toString() ) println( "integer quotient " + (a / b).toString() )}__g_args = args;int a = 10;int b = 3;print( "sum " + (a + b).toString() );print( "difference " + (a - b).toString() );print( "product " + (a * b).toString() );print( "quotient " + (a / b).toString() );print( "integer quotient " + (((a) ~/ (b))).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 10; int b = 3; print( "sum " + (a + b).toString() ); print( "difference " + (a - b).toString() ); print( "product " + (a * b).toString() ); print( "quotient " + (a / b).toString() ); print( "integer quotient " + (((a) ~/ (b))).toString() );}let a : Int = 10let b : Int = 3print("sum " + String(a + b))print("difference " + String(a - b))print("product " + String(a * b))print("quotient " + String((Double(a) / Double(b))))print("integer quotient " + String(a / b))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 10 let b : Int = 3 print("sum " + String(a + b)) print("difference " + String(a - b)) print("product " + String(a * b)) print("quotient " + String((Double(a) / Double(b)))) print("integer quotient " + String(a / b))}__main__swift()int a = 10;int b = 3;Console.WriteLine("sum " + (a + b));Console.WriteLine("difference " + (a - b));Console.WriteLine("product " + a * b);Console.WriteLine("quotient " + ((double)(a) / (double)(b)));Console.WriteLine("integer quotient " + (a / b));The complete file
using System;class Main { static void Main( string [] args ) { int a = 10; int b = 3; Console.WriteLine("sum " + (a + b)); Console.WriteLine("difference " + (a - b)); Console.WriteLine("product " + a * b); Console.WriteLine("quotient " + ((double)(a) / (double)(b))); Console.WriteLine("integer quotient " + (a / b)); }}int a = 10;int b = 3;std::cout << std::string("sum ") + std::to_string(a + b) << std::endl;std::cout << std::string("difference ") + std::to_string(a - b) << std::endl;std::cout << std::string("product ") + std::to_string(a * b) << std::endl;std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl;std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <cstdlib>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 10; int b = 3; std::cout << std::string("sum ") + std::to_string(a + b) << std::endl; std::cout << std::string("difference ") + std::to_string(a - b) << std::endl; std::cout << std::string("product ") + std::to_string(a * b) << std::endl; std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl; std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl; return 0;}$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");val a : Int = 10val b : Int = 3println( "sum " + (a + b) )println( "difference " + (a - b) )println( "product " + a * b )println( "quotient " + (a.toDouble / b.toDouble) )println( "integer quotient " + (a / b) )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 10 val b : Int = 3 println( "sum " + (a + b) ) println( "difference " + (a - b) ) println( "product " + a * b ) println( "quotient " + (a.toDouble / b.toDouble) ) println( "integer quotient " + (a / b) )}Definition: compiler/Lang.rgr, line 4797
/
(/ left right) → double
/(left: double, right: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: default template
- Python: own template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: own template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4799
/
(/ left right) → double
/(left: int, right: int)Divides the left integer by the right integer and gives a double.
The result is not a whole number. Use to_int when the program needs a whole number, and the result is then cut towards zero.
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Integer arithmetic
class Main { sfn main:void () { def a 10 def b 3 print ("sum " + (a + b)) print ("difference " + (a - b)) print ("product " + (a * b)) print ("quotient " + (a / b)) print ("integer quotient " + (idiv a b)) }}const a = 10;const b = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 10; const b = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();const a : number = 10;const b : number = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 10; const b : number = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();var a int64= int64(10);var b int64= int64(3);fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") )fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") )fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") )fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")
func r_div_f64(a float64, b float64) float64 { return a / b}
type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(10); var b int64= int64(3); fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") ) fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") ) fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") ) fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 10; let b: i64 = 3; println!("sum {}", a + b); println!("difference {}", a - b); println!("product {}", a * b); println!("quotient {}", a as f64 / b as f64); println!("integer quotient {}", a / b);}a = 10b = 3print("sum " + str(a + b))print("difference " + str(a - b))print("product " + str(a * b))print("quotient " + str(r_div_f64(float(a), float(b))))print("integer quotient " + str(((a) // (b))))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
def r_div_f64(a, b): if b == 0.0: if a == 0.0 or a != a: return float('nan') return math.copysign(float('inf'), a) * math.copysign(1.0, b) return a / b
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 10 b = 3 print("sum " + str(a + b)) print("difference " + str(a - b)) print("product " + str(a * b)) print("quotient " + str(r_div_f64(float(a), float(b)))) print("integer quotient " + str(((a) // (b))))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 10;final Integer b = 3;System.out.println(String.valueOf( "sum " + (a + b) ) );System.out.println(String.valueOf( "difference " + (a - b) ) );System.out.println(String.valueOf( "product " + a * b ) );System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) );System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 10; final Integer b = 3; System.out.println(String.valueOf( "sum " + (a + b) ) ); System.out.println(String.valueOf( "difference " + (a - b) ) ); System.out.println(String.valueOf( "product " + a * b ) ); System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) ); System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 10;val b : Int = 3;println( "sum " + (a + b).toString() )println( "difference " + (a - b).toString() )println( "product " + (a * b).toString() )println( "quotient " + (a.toDouble() / b.toDouble()).toString() )println( "integer quotient " + (a / b).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 10; val b : Int = 3; println( "sum " + (a + b).toString() ) println( "difference " + (a - b).toString() ) println( "product " + (a * b).toString() ) println( "quotient " + (a.toDouble() / b.toDouble()).toString() ) println( "integer quotient " + (a / b).toString() )}__g_args = args;int a = 10;int b = 3;print( "sum " + (a + b).toString() );print( "difference " + (a - b).toString() );print( "product " + (a * b).toString() );print( "quotient " + (a / b).toString() );print( "integer quotient " + (((a) ~/ (b))).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 10; int b = 3; print( "sum " + (a + b).toString() ); print( "difference " + (a - b).toString() ); print( "product " + (a * b).toString() ); print( "quotient " + (a / b).toString() ); print( "integer quotient " + (((a) ~/ (b))).toString() );}let a : Int = 10let b : Int = 3print("sum " + String(a + b))print("difference " + String(a - b))print("product " + String(a * b))print("quotient " + String((Double(a) / Double(b))))print("integer quotient " + String(a / b))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 10 let b : Int = 3 print("sum " + String(a + b)) print("difference " + String(a - b)) print("product " + String(a * b)) print("quotient " + String((Double(a) / Double(b)))) print("integer quotient " + String(a / b))}__main__swift()int a = 10;int b = 3;Console.WriteLine("sum " + (a + b));Console.WriteLine("difference " + (a - b));Console.WriteLine("product " + a * b);Console.WriteLine("quotient " + ((double)(a) / (double)(b)));Console.WriteLine("integer quotient " + (a / b));The complete file
using System;class Main { static void Main( string [] args ) { int a = 10; int b = 3; Console.WriteLine("sum " + (a + b)); Console.WriteLine("difference " + (a - b)); Console.WriteLine("product " + a * b); Console.WriteLine("quotient " + ((double)(a) / (double)(b))); Console.WriteLine("integer quotient " + (a / b)); }}int a = 10;int b = 3;std::cout << std::string("sum ") + std::to_string(a + b) << std::endl;std::cout << std::string("difference ") + std::to_string(a - b) << std::endl;std::cout << std::string("product ") + std::to_string(a * b) << std::endl;std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl;std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <cstdlib>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 10; int b = 3; std::cout << std::string("sum ") + std::to_string(a + b) << std::endl; std::cout << std::string("difference ") + std::to_string(a - b) << std::endl; std::cout << std::string("product ") + std::to_string(a * b) << std::endl; std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl; std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl; return 0;}$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");val a : Int = 10val b : Int = 3println( "sum " + (a + b) )println( "difference " + (a - b) )println( "product " + a * b )println( "quotient " + (a.toDouble / b.toDouble) )println( "integer quotient " + (a / b) )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 10 val b : Int = 3 println( "sum " + (a + b) ) println( "difference " + (a - b) ) println( "product " + a * b ) println( "quotient " + (a.toDouble / b.toDouble) ) println( "integer quotient " + (a / b) )}Definition: compiler/Lang.rgr, line 4838
%
(% left right) → int
%(left: int, right: int)Gives the remainder of the division of the two integers.
The sign of the result follows the target language. For a negative left operand, the result is negative in C++, C#, Go, Java, JavaScript, Rust and Swift. In Python the result has the sign of the right operand.
Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Integer remainder
class Main { sfn main:void () { def a 7 def b 3 def rem (% a b) print ("remainder " + rem) }}const a = 7;const b = 3;const rem = a % b;console.log("remainder " + rem);The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 7; const b = 3; const rem = a % b; console.log("remainder " + rem);}__js_main();const a : number = 7;const b : number = 3;const rem : number = a % b;console.log("remainder " + rem);The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 7; const b : number = 3; const rem : number = a % b; console.log("remainder " + rem);}__js_main();var a int64= int64(7);var b int64= int64(3);var rem int64= a % b;fmt.Println( strings.Join([]string{ "remainder ",strconv.FormatInt(rem, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(7); var b int64= int64(3); var rem int64= a % b; fmt.Println( strings.Join([]string{ "remainder ",strconv.FormatInt(rem, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 7; let b: i64 = 3; let rem: i64 = a % b; println!("remainder {}", rem);}a = 7b = 3rem = a % bprint("remainder " + str(rem))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 7 b = 3 rem = a % b print("remainder " + str(rem))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 7;final Integer b = 3;final Integer rem = a % b;System.out.println(String.valueOf( "remainder " + rem ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 7; final Integer b = 3; final Integer rem = a % b; System.out.println(String.valueOf( "remainder " + rem ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 7;val b : Int = 3;val rem : Int = a % b;println( "remainder " + (rem).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 7; val b : Int = 3; val rem : Int = a % b; println( "remainder " + (rem).toString() )}__g_args = args;int a = 7;int b = 3;int rem = a % b;print( "remainder " + (rem).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 7; int b = 3; int rem = a % b; print( "remainder " + (rem).toString() );}let a : Int = 7let b : Int = 3let rem : Int = a % bprint("remainder " + String(rem))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 7 let b : Int = 3 let rem : Int = a % b print("remainder " + String(rem))}__main__swift()int a = 7;int b = 3;int rem = a % b;Console.WriteLine("remainder " + rem);The complete file
using System;class Main { static void Main( string [] args ) { int a = 7; int b = 3; int rem = a % b; Console.WriteLine("remainder " + rem); }}int a = 7;int b = 3;int rem = a % b;std::cout << std::string("remainder ") + std::to_string(rem) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>
// define classes here to avoid compiler errorsclass Main;
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 7; int b = 3; int rem = a % b; std::cout << std::string("remainder ") + std::to_string(rem) << std::endl; return 0;}$a = 7;$b = 3;$rem = $a % $b;echo( "remainder " . $rem . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 7;$b = 3;$rem = $a % $b;echo( "remainder " . $rem . "\n");val a : Int = 7val b : Int = 3val rem : Int = a % bprintln( "remainder " + rem )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 7 val b : Int = 3 val rem : Int = a % b println( "remainder " + rem )}Definition: compiler/Lang.rgr, line 4595
+
(+ left right) → double
+(left: double, right: double)numeric + operations
Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4482
+
(+ left right) → int
+(left: int, right: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4500
+
(+ left right) → int
+(left: int, right: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4501
+
(+ left right) → int
+(left: int, right: int)random tests end
Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4504
+
(+ left right) → int
+(left: int, right: <optional>int)random tests, remove these later:
Target support
- JavaScript: no template
- TypeScript: no template
- Go: no template
- Rust: no template
- Python: no template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: no template
- C#: no template
- C++: no template
- PHP: no template
- Scala: no template
Integer arithmetic
class Main { sfn main:void () { def a 10 def b 3 print ("sum " + (a + b)) print ("difference " + (a - b)) print ("product " + (a * b)) print ("quotient " + (a / b)) print ("integer quotient " + (idiv a b)) }}const a = 10;const b = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 10; const b = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();const a : number = 10;const b : number = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 10; const b : number = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();var a int64= int64(10);var b int64= int64(3);fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") )fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") )fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") )fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")
func r_div_f64(a float64, b float64) float64 { return a / b}
type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(10); var b int64= int64(3); fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") ) fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") ) fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") ) fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 10; let b: i64 = 3; println!("sum {}", a + b); println!("difference {}", a - b); println!("product {}", a * b); println!("quotient {}", a as f64 / b as f64); println!("integer quotient {}", a / b);}a = 10b = 3print("sum " + str(a + b))print("difference " + str(a - b))print("product " + str(a * b))print("quotient " + str(r_div_f64(float(a), float(b))))print("integer quotient " + str(((a) // (b))))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
def r_div_f64(a, b): if b == 0.0: if a == 0.0 or a != a: return float('nan') return math.copysign(float('inf'), a) * math.copysign(1.0, b) return a / b
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 10 b = 3 print("sum " + str(a + b)) print("difference " + str(a - b)) print("product " + str(a * b)) print("quotient " + str(r_div_f64(float(a), float(b)))) print("integer quotient " + str(((a) // (b))))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 10;final Integer b = 3;System.out.println(String.valueOf( "sum " + (a + b) ) );System.out.println(String.valueOf( "difference " + (a - b) ) );System.out.println(String.valueOf( "product " + a * b ) );System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) );System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 10; final Integer b = 3; System.out.println(String.valueOf( "sum " + (a + b) ) ); System.out.println(String.valueOf( "difference " + (a - b) ) ); System.out.println(String.valueOf( "product " + a * b ) ); System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) ); System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 10;val b : Int = 3;println( "sum " + (a + b).toString() )println( "difference " + (a - b).toString() )println( "product " + (a * b).toString() )println( "quotient " + (a.toDouble() / b.toDouble()).toString() )println( "integer quotient " + (a / b).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 10; val b : Int = 3; println( "sum " + (a + b).toString() ) println( "difference " + (a - b).toString() ) println( "product " + (a * b).toString() ) println( "quotient " + (a.toDouble() / b.toDouble()).toString() ) println( "integer quotient " + (a / b).toString() )}__g_args = args;int a = 10;int b = 3;print( "sum " + (a + b).toString() );print( "difference " + (a - b).toString() );print( "product " + (a * b).toString() );print( "quotient " + (a / b).toString() );print( "integer quotient " + (((a) ~/ (b))).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 10; int b = 3; print( "sum " + (a + b).toString() ); print( "difference " + (a - b).toString() ); print( "product " + (a * b).toString() ); print( "quotient " + (a / b).toString() ); print( "integer quotient " + (((a) ~/ (b))).toString() );}let a : Int = 10let b : Int = 3print("sum " + String(a + b))print("difference " + String(a - b))print("product " + String(a * b))print("quotient " + String((Double(a) / Double(b))))print("integer quotient " + String(a / b))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 10 let b : Int = 3 print("sum " + String(a + b)) print("difference " + String(a - b)) print("product " + String(a * b)) print("quotient " + String((Double(a) / Double(b)))) print("integer quotient " + String(a / b))}__main__swift()int a = 10;int b = 3;Console.WriteLine("sum " + (a + b));Console.WriteLine("difference " + (a - b));Console.WriteLine("product " + a * b);Console.WriteLine("quotient " + ((double)(a) / (double)(b)));Console.WriteLine("integer quotient " + (a / b));The complete file
using System;class Main { static void Main( string [] args ) { int a = 10; int b = 3; Console.WriteLine("sum " + (a + b)); Console.WriteLine("difference " + (a - b)); Console.WriteLine("product " + a * b); Console.WriteLine("quotient " + ((double)(a) / (double)(b))); Console.WriteLine("integer quotient " + (a / b)); }}int a = 10;int b = 3;std::cout << std::string("sum ") + std::to_string(a + b) << std::endl;std::cout << std::string("difference ") + std::to_string(a - b) << std::endl;std::cout << std::string("product ") + std::to_string(a * b) << std::endl;std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl;std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <cstdlib>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 10; int b = 3; std::cout << std::string("sum ") + std::to_string(a + b) << std::endl; std::cout << std::string("difference ") + std::to_string(a - b) << std::endl; std::cout << std::string("product ") + std::to_string(a * b) << std::endl; std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl; std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl; return 0;}$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");val a : Int = 10val b : Int = 3println( "sum " + (a + b) )println( "difference " + (a - b) )println( "product " + a * b )println( "quotient " + (a.toDouble / b.toDouble) )println( "integer quotient " + (a / b) )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 10 val b : Int = 3 println( "sum " + (a + b) ) println( "difference " + (a - b) ) println( "product " + a * b ) println( "quotient " + (a.toDouble / b.toDouble) ) println( "integer quotient " + (a / b) )}Definition: compiler/Lang.rgr, line 4485
+
(+ left right) → int
+(left: int, right: <optional>int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4493
+
(+ left right) → int
+(left: int, right: <optional>int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4497
acos
(acos value) → double
acos(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5021
asin
(asin value) → double
asin(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5000
atan2
(atan2 y x) → double
atan2(y: double, x: double)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 1386
bit_shl
(bit_shl value count) → int
bit_shl(value: int, count: int)Bit shift left
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4694
bit_shr
(bit_shr value count) → int
bit_shr(value: int, count: int)Bit shift right (arithmetic/signed)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 4710
bit_ushr
(bit_ushr value count) → int
bit_ushr(value: int, count: int)Bit shift right unsigned (logical)
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: default template
Definition: compiler/Lang.rgr, line 4726
ceil
(ceil value) → int
ceil(value: double)TODO: add the rest ....(case ("sin" "cos" "tan" "atan" "log" "abs" "acos" "asin" "floor" "round" "sqrt") "<cmath>"
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Double precision mathematics
class Main { sfn main:void () { def value 7.35 print ("square root " + (sqrt value)) print ("floor " + (floor value)) print ("ceiling " + (ceil value)) }}const value = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();const value : number = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value : number = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();var value float64= 7.35;fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") )fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )The complete file
package mainimport ( "math" "strings" "strconv" "fmt")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var value float64= 7.35; fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") ) fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let value: f64 = 7.35_f64; println!("square root {}", value.sqrt()); println!("floor {}", value.floor() as i64); println!("ceiling {}", value.ceil() as i64);}value = 7.35print("square root " + str(math.sqrt(value)))print("floor " + str(math.floor(value)))print("ceiling " + str(math.ceil(value)))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): value = 7.35 print("square root " + str(math.sqrt(value))) print("floor " + str(math.floor(value))) print("ceiling " + str(math.ceil(value)))if __name__ == "__main__": main()RgArgs.args = args;final Double value = 7.35;System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) );System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) );System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) );The complete file
import java.lang.Math;import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Double value = 7.35; System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) ); System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) ); System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval value : Double = 7.35;println( "square root " + (Math.sqrt(value)).toString() )println( "floor " + ((Math.floor(value)).toInt()).toString() )println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )The complete file
import java.lang.Math
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val value : Double = 7.35; println( "square root " + (Math.sqrt(value)).toString() ) println( "floor " + ((Math.floor(value)).toInt()).toString() ) println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )}__g_args = args;double value = 7.35;print( "square root " + (sqrt(value)).toString() );print( "floor " + ((value).floor()).toString() );print( "ceiling " + ((value).ceil()).toString() );The complete file
import 'dart:math';
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; double value = 7.35; print( "square root " + (sqrt(value)).toString() ); print( "floor " + ((value).floor()).toString() ); print( "ceiling " + ((value).ceil()).toString() );}let value : Double = 7.35print("square root " + String(sqrt(value)))print("floor " + String(Int(floor(value))))print("ceiling " + String(Int(ceil(value))))The complete file
import Foundationfunc ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let value : Double = 7.35 print("square root " + String(sqrt(value))) print("floor " + String(Int(floor(value)))) print("ceiling " + String(Int(ceil(value))))}__main__swift()double value = 7.35;Console.WriteLine("square root " + Math.Sqrt(value));Console.WriteLine("floor " + ((int)Math.Floor(value)));Console.WriteLine("ceiling " + ((int)Math.Ceil(value)));The complete file
using System;class Main { static void Main( string [] args ) { double value = 7.35; Console.WriteLine("square root " + Math.Sqrt(value)); Console.WriteLine("floor " + ((int)Math.Floor(value))); Console.WriteLine("ceiling " + ((int)Math.Ceil(value))); }}double value = 7.35;std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl;std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl;std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl;return 0;The complete file
#include <memory>#include <cmath>#include <sstream>#include <iomanip>#include <string>#include <cstdlib>#include <iostream>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; double value = 7.35; std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl; std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl; std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl; return 0;}$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");val value : Double = 7.35println( "square root " + math.sqrt(value) )println( "floor " + math.floor(value).toInt )println( "ceiling " + math.ceil(value).toInt )The complete file
import scala.mathcase class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val value : Double = 7.35 println( "square root " + math.sqrt(value) ) println( "floor " + math.floor(value).toInt ) println( "ceiling " + math.ceil(value).toInt )}Definition: compiler/Lang.rgr, line 4961
cos
(cos value) → double
cos(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5040
fabs
(fabs v) → double
fabs(v: double)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 1350
floor
(floor value) → int
floor(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Double precision mathematics
class Main { sfn main:void () { def value 7.35 print ("square root " + (sqrt value)) print ("floor " + (floor value)) print ("ceiling " + (ceil value)) }}const value = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();const value : number = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value : number = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();var value float64= 7.35;fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") )fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )The complete file
package mainimport ( "math" "strings" "strconv" "fmt")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var value float64= 7.35; fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") ) fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let value: f64 = 7.35_f64; println!("square root {}", value.sqrt()); println!("floor {}", value.floor() as i64); println!("ceiling {}", value.ceil() as i64);}value = 7.35print("square root " + str(math.sqrt(value)))print("floor " + str(math.floor(value)))print("ceiling " + str(math.ceil(value)))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): value = 7.35 print("square root " + str(math.sqrt(value))) print("floor " + str(math.floor(value))) print("ceiling " + str(math.ceil(value)))if __name__ == "__main__": main()RgArgs.args = args;final Double value = 7.35;System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) );System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) );System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) );The complete file
import java.lang.Math;import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Double value = 7.35; System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) ); System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) ); System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval value : Double = 7.35;println( "square root " + (Math.sqrt(value)).toString() )println( "floor " + ((Math.floor(value)).toInt()).toString() )println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )The complete file
import java.lang.Math
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val value : Double = 7.35; println( "square root " + (Math.sqrt(value)).toString() ) println( "floor " + ((Math.floor(value)).toInt()).toString() ) println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )}__g_args = args;double value = 7.35;print( "square root " + (sqrt(value)).toString() );print( "floor " + ((value).floor()).toString() );print( "ceiling " + ((value).ceil()).toString() );The complete file
import 'dart:math';
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; double value = 7.35; print( "square root " + (sqrt(value)).toString() ); print( "floor " + ((value).floor()).toString() ); print( "ceiling " + ((value).ceil()).toString() );}let value : Double = 7.35print("square root " + String(sqrt(value)))print("floor " + String(Int(floor(value))))print("ceiling " + String(Int(ceil(value))))The complete file
import Foundationfunc ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let value : Double = 7.35 print("square root " + String(sqrt(value))) print("floor " + String(Int(floor(value)))) print("ceiling " + String(Int(ceil(value))))}__main__swift()double value = 7.35;Console.WriteLine("square root " + Math.Sqrt(value));Console.WriteLine("floor " + ((int)Math.Floor(value)));Console.WriteLine("ceiling " + ((int)Math.Ceil(value)));The complete file
using System;class Main { static void Main( string [] args ) { double value = 7.35; Console.WriteLine("square root " + Math.Sqrt(value)); Console.WriteLine("floor " + ((int)Math.Floor(value))); Console.WriteLine("ceiling " + ((int)Math.Ceil(value))); }}double value = 7.35;std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl;std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl;std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl;return 0;The complete file
#include <memory>#include <cmath>#include <sstream>#include <iomanip>#include <string>#include <cstdlib>#include <iostream>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; double value = 7.35; std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl; std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl; std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl; return 0;}$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");val value : Double = 7.35println( "square root " + math.sqrt(value) )println( "floor " + math.floor(value).toInt )println( "ceiling " + math.ceil(value).toInt )The complete file
import scala.mathcase class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val value : Double = 7.35 println( "square root " + math.sqrt(value) ) println( "floor " + math.floor(value).toInt ) println( "ceiling " + math.ceil(value).toInt )}Definition: compiler/Lang.rgr, line 4980
idiv
(idiv left right) → int
idiv(left: int, right: int)Gives the integer quotient of two integers. The result truncates toward zero.
The operator / on two integers gives a double. Use idiv when the program needs a whole number.
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: default template
- C#: default template
- C++: own template
- PHP: own template
- Scala: default template
Integer arithmetic
class Main { sfn main:void () { def a 10 def b 3 print ("sum " + (a + b)) print ("difference " + (a - b)) print ("product " + (a * b)) print ("quotient " + (a / b)) print ("integer quotient " + (idiv a b)) }}const a = 10;const b = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a = 10; const b = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();const a : number = 10;const b : number = 3;console.log("sum " + (a + b));console.log("difference " + (a - b));console.log("product " + a * b);console.log("quotient " + a / b);console.log("integer quotient " + ((a / b) | 0));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const a : number = 10; const b : number = 3; console.log("sum " + (a + b)); console.log("difference " + (a - b)); console.log("product " + a * b); console.log("quotient " + a / b); console.log("integer quotient " + ((a / b) | 0));}__js_main();var a int64= int64(10);var b int64= int64(3);fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") )fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") )fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") )fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )The complete file
package mainimport ( "strings" "strconv" "fmt")
func r_div_f64(a float64, b float64) float64 { return a / b}
type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var a int64= int64(10); var b int64= int64(3); fmt.Println( strings.Join([]string{ "sum ",strconv.FormatInt(a + b, 10) }, "") ) fmt.Println( strings.Join([]string{ "difference ",strconv.FormatInt(a - b, 10) }, "") ) fmt.Println( strings.Join([]string{ "product ",strconv.FormatInt(a * b, 10) }, "") ) fmt.Println( strings.Join([]string{ "quotient ",strconv.FormatFloat(r_div_f64(float64(a), float64(b)),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "integer quotient ",strconv.FormatInt(a / b, 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let a: i64 = 10; let b: i64 = 3; println!("sum {}", a + b); println!("difference {}", a - b); println!("product {}", a * b); println!("quotient {}", a as f64 / b as f64); println!("integer quotient {}", a / b);}a = 10b = 3print("sum " + str(a + b))print("difference " + str(a - b))print("product " + str(a * b))print("quotient " + str(r_div_f64(float(a), float(b))))print("integer quotient " + str(((a) // (b))))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
def r_div_f64(a, b): if b == 0.0: if a == 0.0 or a != a: return float('nan') return math.copysign(float('inf'), a) * math.copysign(1.0, b) return a / b
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): a = 10 b = 3 print("sum " + str(a + b)) print("difference " + str(a - b)) print("product " + str(a * b)) print("quotient " + str(r_div_f64(float(a), float(b)))) print("integer quotient " + str(((a) // (b))))if __name__ == "__main__": main()RgArgs.args = args;final Integer a = 10;final Integer b = 3;System.out.println(String.valueOf( "sum " + (a + b) ) );System.out.println(String.valueOf( "difference " + (a - b) ) );System.out.println(String.valueOf( "product " + a * b ) );System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) );System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) );The complete file
import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Integer a = 10; final Integer b = 3; System.out.println(String.valueOf( "sum " + (a + b) ) ); System.out.println(String.valueOf( "difference " + (a - b) ) ); System.out.println(String.valueOf( "product " + a * b ) ); System.out.println(String.valueOf( "quotient " + ((double)(a) / (double)(b)) ) ); System.out.println(String.valueOf( "integer quotient " + ((a) / (b)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval a : Int = 10;val b : Int = 3;println( "sum " + (a + b).toString() )println( "difference " + (a - b).toString() )println( "product " + (a * b).toString() )println( "quotient " + (a.toDouble() / b.toDouble()).toString() )println( "integer quotient " + (a / b).toString() )The complete file
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val a : Int = 10; val b : Int = 3; println( "sum " + (a + b).toString() ) println( "difference " + (a - b).toString() ) println( "product " + (a * b).toString() ) println( "quotient " + (a.toDouble() / b.toDouble()).toString() ) println( "integer quotient " + (a / b).toString() )}__g_args = args;int a = 10;int b = 3;print( "sum " + (a + b).toString() );print( "difference " + (a - b).toString() );print( "product " + (a * b).toString() );print( "quotient " + (a / b).toString() );print( "integer quotient " + (((a) ~/ (b))).toString() );The complete file
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; int a = 10; int b = 3; print( "sum " + (a + b).toString() ); print( "difference " + (a - b).toString() ); print( "product " + (a * b).toString() ); print( "quotient " + (a / b).toString() ); print( "integer quotient " + (((a) ~/ (b))).toString() );}let a : Int = 10let b : Int = 3print("sum " + String(a + b))print("difference " + String(a - b))print("product " + String(a * b))print("quotient " + String((Double(a) / Double(b))))print("integer quotient " + String(a / b))The complete file
func ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let a : Int = 10 let b : Int = 3 print("sum " + String(a + b)) print("difference " + String(a - b)) print("product " + String(a * b)) print("quotient " + String((Double(a) / Double(b)))) print("integer quotient " + String(a / b))}__main__swift()int a = 10;int b = 3;Console.WriteLine("sum " + (a + b));Console.WriteLine("difference " + (a - b));Console.WriteLine("product " + a * b);Console.WriteLine("quotient " + ((double)(a) / (double)(b)));Console.WriteLine("integer quotient " + (a / b));The complete file
using System;class Main { static void Main( string [] args ) { int a = 10; int b = 3; Console.WriteLine("sum " + (a + b)); Console.WriteLine("difference " + (a - b)); Console.WriteLine("product " + a * b); Console.WriteLine("quotient " + ((double)(a) / (double)(b))); Console.WriteLine("integer quotient " + (a / b)); }}int a = 10;int b = 3;std::cout << std::string("sum ") + std::to_string(a + b) << std::endl;std::cout << std::string("difference ") + std::to_string(a - b) << std::endl;std::cout << std::string("product ") + std::to_string(a * b) << std::endl;std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl;std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl;return 0;The complete file
#include <memory>#include <iostream>#include <string>#include <sstream>#include <iomanip>#include <cstdlib>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; int a = 10; int b = 3; std::cout << std::string("sum ") + std::to_string(a + b) << std::endl; std::cout << std::string("difference ") + std::to_string(a - b) << std::endl; std::cout << std::string("product ") + std::to_string(a * b) << std::endl; std::cout << std::string("quotient ") + r_double_to_string(((double)(a) / (double)(b))) << std::endl; std::cout << std::string("integer quotient ") + std::to_string(((a) / (b))) << std::endl; return 0;}$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$a = 10;$b = 3;echo( "sum " . ($a + $b) . "\n");echo( "difference " . ($a - $b) . "\n");echo( "product " . $a * $b . "\n");echo( "quotient " . ($a / $b) . "\n");echo( "integer quotient " . intdiv($a, $b) . "\n");val a : Int = 10val b : Int = 3println( "sum " + (a + b) )println( "difference " + (a - b) )println( "product " + a * b )println( "quotient " + (a.toDouble / b.toDouble) )println( "integer quotient " + (a / b) )The complete file
case class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val a : Int = 10 val b : Int = 3 println( "sum " + (a + b) ) println( "difference " + (a - b) ) println( "product " + a * b ) println( "quotient " + (a.toDouble / b.toDouble) ) println( "integer quotient " + (a / b) )}Definition: compiler/Lang.rgr, line 4603
int2double
(int2double value) → double
int2double(value: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: default template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 4931
max
(max left right) → int
max(left: int, right: int)Target support
- JavaScript: default template
- TypeScript: default template
- Go: default template
- Rust: default template
- Python: default template
- Java: default template
- Kotlin: default template
- Dart: default template
- Swift: default template
- C#: default template
- C++: default template
- PHP: default template
- Scala: default template
Definition: compiler/Lang.rgr, line 7429
random
(random min max) → int
random(min: int, max: int)Target support
- JavaScript: own template
- TypeScript: own template
- Go: no template
- Rust: no template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: no template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 819
sin
(sin value) → double
sin(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 5059
sqrt
(sqrt value) → double
sqrt(value: double)Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Double precision mathematics
class Main { sfn main:void () { def value 7.35 print ("square root " + (sqrt value)) print ("floor " + (floor value)) print ("ceiling " + (ceil value)) }}const value = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();const value : number = 7.35;console.log("square root " + Math.sqrt(value));console.log("floor " + Math.floor(value));console.log("ceiling " + Math.ceil(value));The complete file
export class Main { constructor() { }}/* static JavaSript main routine at the end of the JS file */function __js_main() { const value : number = 7.35; console.log("square root " + Math.sqrt(value)); console.log("floor " + Math.floor(value)); console.log("ceiling " + Math.ceil(value));}__js_main();var value float64= 7.35;fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") )fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") )fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )The complete file
package mainimport ( "math" "strings" "strconv" "fmt")type Main struct {}
func CreateNew_Main() *Main { me := new(Main) return me;}func main() { var value float64= 7.35; fmt.Println( strings.Join([]string{ "square root ",strconv.FormatFloat(math.Sqrt(value),'f', -1, 64) }, "") ) fmt.Println( strings.Join([]string{ "floor ",strconv.FormatInt(int64(math.Floor(value)), 10) }, "") ) fmt.Println( strings.Join([]string{ "ceiling ",strconv.FormatInt(int64(math.Ceil(value)), 10) }, "") )}let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread");__rg_main_thread.join().expect("main thread panicked");The complete file
#![allow(dead_code)]
#[derive(Clone)]struct Main {}impl Main { pub fn new() -> Self { Self { } }}fn main() { let __rg_main_thread = std::thread::Builder::new().stack_size(512 * 1024 * 1024) .spawn(__rg_main_body).expect("could not start the main thread"); __rg_main_thread.join().expect("main thread panicked");}fn __rg_main_body() { let value: f64 = 7.35_f64; println!("square root {}", value.sqrt()); println!("floor {}", value.floor() as i64); println!("ceiling {}", value.ceil() as i64);}value = 7.35print("square root " + str(math.sqrt(value)))print("floor " + str(math.floor(value)))print("ceiling " + str(math.ceil(value)))The complete file
# -*- coding: utf-8 -*-from __future__ import annotationsfrom typing import Optional
import math
class Main: def __init__(self) -> None: pass# Main entry pointdef main(): value = 7.35 print("square root " + str(math.sqrt(value))) print("floor " + str(math.floor(value))) print("ceiling " + str(math.ceil(value)))if __name__ == "__main__": main()RgArgs.args = args;final Double value = 7.35;System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) );System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) );System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) );The complete file
import java.lang.Math;import java.io.*;
public class Main {
public static void main(String [] args ) { RgArgs.args = args; final Double value = 7.35; System.out.println(String.valueOf( "square root " + Math.sqrt(value) ) ); System.out.println(String.valueOf( "floor " + ((int)Math.floor(value)) ) ); System.out.println(String.valueOf( "ceiling " + ((int)Math.ceil(value)) ) ); }}
public class RgArgs { public static String[] args = new String[0];}__g_args = argsval value : Double = 7.35;println( "square root " + (Math.sqrt(value)).toString() )println( "floor " + ((Math.floor(value)).toInt()).toString() )println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )The complete file
import java.lang.Math
class Main {
}
var __g_args : Array<String> = arrayOf()
fun main(args : Array<String>) { __g_args = args val value : Double = 7.35; println( "square root " + (Math.sqrt(value)).toString() ) println( "floor " + ((Math.floor(value)).toInt()).toString() ) println( "ceiling " + ((Math.ceil(value)).toInt()).toString() )}__g_args = args;double value = 7.35;print( "square root " + (sqrt(value)).toString() );print( "floor " + ((value).floor()).toString() );print( "ceiling " + ((value).ceil()).toString() );The complete file
import 'dart:math';
class Main {}
List<String> __g_args = <String>[];
void main(List<String> args) { __g_args = args; double value = 7.35; print( "square root " + (sqrt(value)).toString() ); print( "floor " + ((value).floor()).toString() ); print( "ceiling " + ((value).ceil()).toString() );}let value : Double = 7.35print("square root " + String(sqrt(value)))print("floor " + String(Int(floor(value))))print("ceiling " + String(Int(ceil(value))))The complete file
import Foundationfunc ==(l: Main, r: Main) -> Bool { return l === r}final class Main : Hashable { func hash(into hasher: inout Hasher) { hasher.combine(ObjectIdentifier(self)) }}// Main entry pointfunc __main__swift() { let value : Double = 7.35 print("square root " + String(sqrt(value))) print("floor " + String(Int(floor(value)))) print("ceiling " + String(Int(ceil(value))))}__main__swift()double value = 7.35;Console.WriteLine("square root " + Math.Sqrt(value));Console.WriteLine("floor " + ((int)Math.Floor(value)));Console.WriteLine("ceiling " + ((int)Math.Ceil(value)));The complete file
using System;class Main { static void Main( string [] args ) { double value = 7.35; Console.WriteLine("square root " + Math.Sqrt(value)); Console.WriteLine("floor " + ((int)Math.Floor(value))); Console.WriteLine("ceiling " + ((int)Math.Ceil(value))); }}double value = 7.35;std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl;std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl;std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl;return 0;The complete file
#include <memory>#include <cmath>#include <sstream>#include <iomanip>#include <string>#include <cstdlib>#include <iostream>
// define classes here to avoid compiler errorsclass Main;
inline std::string r_double_to_string(double v) { for (int p = 1; p < 18; p++) { std::ostringstream s; s << std::setprecision(p) << v; /* strtod, not stod: stod THROWS out_of_range when a low-precision candidate like "2e+308" overflows; strtod answers HUGE_VAL, which simply fails the round-trip test. */ const std::string cand = s.str(); if (std::strtod(cand.c_str(), nullptr) == v) { return cand; } } std::ostringstream s; s << std::setprecision(17) << v; return s.str();}
// header definitionsclass Main { public : /* class constructor */ Main( ); /* static methods */ static void main();};
int __g_argc;char **__g_argv;Main::Main( ) {}int main(int argc, char* argv[]) { __g_argc = argc; __g_argv = argv; double value = 7.35; std::cout << std::string("square root ") + r_double_to_string(sqrt(value)) << std::endl; std::cout << std::string("floor ") + std::to_string((int)floor(value)) << std::endl; std::cout << std::string("ceiling ") + std::to_string((int)ceil(value)) << std::endl; return 0;}$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");The complete file
<?php
class Main { function __construct( ) { }}/* static PHP main routine */$value = 7.35;echo( "square root " . sqrt($value) . "\n");echo( "floor " . floor($value) . "\n");echo( "ceiling " . ceil($value) . "\n");val value : Double = 7.35println( "square root " + math.sqrt(value) )println( "floor " + math.floor(value).toInt )println( "ceiling " + math.ceil(value).toInt )The complete file
import scala.mathcase class ScalaReturnValue(value:Any) extends Exception
// application main function for Mainobject AppMain extends App { val value : Double = 7.35 println( "square root " + math.sqrt(value) ) println( "floor " + math.floor(value).toInt ) println( "ceiling " + math.ceil(value).toInt )}Definition: compiler/Lang.rgr, line 5078
tan
(tan v) → double
tan(v: double)Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 1367
to_double
(to_double input) → double
to_double(input: int)conversions
Target support
- JavaScript: own template
- TypeScript: own template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 11341
to_int
(to_int value) → int
to_int(value: double)TODO: double_buffer_from requires variadic argument support in Ranger operators Create double_buffer from literal values - for cleaner initialization of lookup tables Usage: def table:double_buffer (double_buffer_from 1.0 2.0 3.0 4.0) double_buffer_from cmdDoubleBufferFrom:double_buffer ( listOf:expression ) { templates { ranger ( "(double_buffer_from " (list 1) ")" ) es6 ( "new Float64Array([" (comma 1) "])" ) go ( "[]float64{" (comma 1) "}" ) rust ( "vec![" (comma 1) "]" ) cpp ( "std::vector<double>{" (comma 1) "}" (imp "<vector>") ) java7 ( "new double[]{" (comma 1) "}" ) python ( "[" (comma 1) "]" ) swift6 ( "[" (comma 1) "] as [Double]" ) csharp ( "new double[]{" (comma 1) "}" ) } }
Target support
- JavaScript: default template
- TypeScript: default template
- Go: own template
- Rust: own template
- Python: own template
- Java: own template
- Kotlin: own template
- Dart: own template
- Swift: own template
- C#: own template
- C++: own template
- PHP: own template
- Scala: own template
Definition: compiler/Lang.rgr, line 7357
unwrap
(unwrap arg) → double
unwrap(arg: <optional>double)Target support
- JavaScript: no template
- TypeScript: no template
- Go: no template
- Rust: no template
- Python: no template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: no template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 4315
unwrap
(unwrap arg) → int
unwrap(arg: <optional>int)Target support
- JavaScript: no template
- TypeScript: no template
- Go: no template
- Rust: no template
- Python: no template
- Java: no template
- Kotlin: no template
- Dart: no template
- Swift: no template
- C#: own template
- C++: own template
- PHP: no template
- Scala: no template
Definition: compiler/Lang.rgr, line 4307
Ranger 3.5.1 · commit f323fd4 · development build