Air mass: Difference between revisions

m
Automated syntax highlighting fixup (second round - minor fixes)
m (Automated syntax highlighting fixup (second round - minor fixes))
Line 20:
{{trans|Python}}
 
<syntaxhighlight lang="11l">V DEG = 0.017453292519943295769236907684886127134
V RE = 6371000
V dd = 0.001
Line 81:
{{trans|C}}
{{works with|Ada 2012}}
<syntaxhighlight lang=Ada"ada">
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Numerics.Generic_Elementary_Functions;
Line 176:
 
=={{header|AWK}}==
<syntaxhighlight lang=AWK"awk">
# syntax: GAWK -f AIR_MASS.AWK
# converted from FreeBASIC
Line 240:
==={{header|BASIC256}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="freebasic">global RE, dd, LIM
RE = 6371000 #Earth radius in meters
dd = 0.001 #integrate in this fraction of the distance already covered
Line 287:
 
==={{header|FreeBASIC}}===
<syntaxhighlight lang="freebasic">
#define DEG 0.017453292519943295769236907684886127134 'degrees to radians
#define RE 6371000 'Earth radius in meters
Line 357:
==={{header|True BASIC}}===
{{trans|FreeBASIC}}
<syntaxhighlight lang="qbasic">FUNCTION max(a, b)
IF a > b then LET max = a else LET max = b
END FUNCTION
Line 404:
=={{header|C}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="c">#include <math.h>
#include <stdio.h>
 
Line 481:
{{trans|FreeBASIC}}
{{works with|Factor|0.99 2021-02-05}}
<syntaxhighlight lang="factor">USING: formatting io kernel math math.functions math.order
math.ranges math.trig sequences ;
 
Line 544:
=={{header|Go}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="go">package main
 
import (
Line 624:
=={{header|Java}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="java">public class AirMass {
public static void main(String[] args) {
System.out.println("Angle 0 m 13700 m");
Line 700:
 
'''Preliminaries'''
<syntaxhighlight lang="jq">def pi: 4 * (1|atan);
 
def radians: . * pi / 180;
Line 726:
| lpad($width);</syntaxhighlight>
'''Physics'''
<syntaxhighlight lang="jq"># constants
def RE: 6371000; # radius of earth in meters
def DD: 0.001; # integrate in this fraction of the distance already covered
Line 784:
=={{header|Julia}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="julia">using Printf
 
const DEG = 0.017453292519943295769236907684886127134 # degrees to radians
Line 843:
=={{header|Nim}}==
{{trans|Wren}}
<syntaxhighlight lang=Nim"nim">import math, strformat
 
const
Line 909:
=={{header|Perl}}==
{{trans|Raku}}
<syntaxhighlight lang="perl">use strict;
use warnings;
use feature <say signatures>;
Line 980:
 
=={{header|Phix}}==
<!--<syntaxhighlight lang=Phix"phix">(phixonline)-->
<span style="color: #008080;">constant</span> <span style="color: #000000;">RE</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">6371000</span><span style="color: #0000FF;">,</span> <span style="color: #000080;font-style:italic;">// radius of earth in meters</span>
<span style="color: #000000;">DD</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0.001</span><span style="color: #0000FF;">,</span> <span style="color: #000080;font-style:italic;">// integrate in this fraction of the distance already covered</span>
Line 1,043:
 
=={{header|Python}}==
<syntaxhighlight lang="python">""" Rosetta Code task: Air_mass """
 
from math import sqrt, cos, exp
Line 1,106:
=={{header|Raku}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang=perl6"raku" line>constant DEG = pi/180; # degrees to radians
constant RE = 6371000; # Earth radius in meters
constant dd = 0.001; # integrate in this fraction of the distance already covered
Line 1,170:
=={{header|REXX}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="rexx">/*REXX pgm calculates the air mass above an observer and an object for various angles.*/
numeric digits (length(pi()) - length(.)) % 4 /*calculate the number of digits to use*/
parse arg aLO aHI aBY oHT . /*obtain optional arguments from the CL*/
Line 1,249:
=={{header|Rust}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="rust">const RE: f64 = 6371000.0; // Earth radius in meters
const DD: f64 = 0.001; // integrate in this fraction of the distance already covered
const FIN: f64 = 10000000.0; // integrate only to a height of 10000km, effectively infinity
Line 1,327:
=={{header|Seed7}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang="seed7">$ include "seed7_05.s7i";
include "float.s7i";
include "math.s7i";
Line 1,416:
{{trans|Go}}
 
<syntaxhighlight lang="swift">import Foundation
 
extension Double {
Line 1,493:
{{libheader|Wren-math}}
{{libheader|Wren-fmt}}
<syntaxhighlight lang="ecmascript">import "/math" for Math
import "/fmt" for Fmt
 
Line 1,562:
=={{header|XPL0}}==
{{trans|FreeBASIC}}
<syntaxhighlight lang=XPL0"xpl0">define DEG = 0.017453292519943295769236907684886127134; \degrees to radians
define RE = 6371000.; \Earth radius in meters
define DD = 0.001; \integrate in this fraction of the distance already covered
10,327

edits