DoenaSoft.StarTrekCalculator 1.0.22

dotnet add package DoenaSoft.StarTrekCalculator --version 1.0.22
                    
NuGet\Install-Package DoenaSoft.StarTrekCalculator -Version 1.0.22
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoenaSoft.StarTrekCalculator" Version="1.0.22" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="DoenaSoft.StarTrekCalculator" Version="1.0.22" />
                    
Directory.Packages.props
<PackageReference Include="DoenaSoft.StarTrekCalculator" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add DoenaSoft.StarTrekCalculator --version 1.0.22
                    
#r "nuget: DoenaSoft.StarTrekCalculator, 1.0.22"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package DoenaSoft.StarTrekCalculator@1.0.22
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=DoenaSoft.StarTrekCalculator&version=1.0.22
                    
Install as a Cake Addin
#tool nuget:?package=DoenaSoft.StarTrekCalculator&version=1.0.22
                    
Install as a Cake Tool

DoenaSoft.StarTrekCalculator

This package calculates the Warp factors of Star Trek: The Next Generation / Deep Space Nine / Voyager into multiples of the speed of light (c).

It can also convert it the other way around.

Given a Warp factor and a distance in light years it can also calculate the time it takes to accomplish the journey.

The chart for the Warp factors can be found in The Official Star Trek Files.

It can also convert the Stardate system used in these shows to convert them into actual dates and vice versa.

Warp Calculation

Warp.WarpToLightSpeed(warpFactor) converts a Warp factor (between 1 and 9.999999) into a multiple of c using the formula devised to reproduce the official TNG warp chart. The factor 10 - warpFactor (the distance to the theoretical Warp 10 asymptote) is fed into three correction terms:

  • dampingFactor dampens the correction for low warp factors, having little effect near Warp 10.
  • rippleFactor reproduces the wave-like ripple visible in the official chart around Warp 9.99 and above.
  • asymptoteFactor steepens the curve as the warp factor approaches Warp 10, where speed becomes theoretically infinite.

These terms are combined into an exponent that is applied to the warp factor itself, yielding the multiple of light speed, rounded to 6 decimal places.

Warp.LightSpeedToWarp(lightSpeed) performs the reverse conversion (between 1c and 500000c). Since the formula above cannot be inverted algebraically, this method uses a binary search (bisection / Newton-style narrowing): starting from a min/max warp range determined by the input light speed, it repeatedly calculates the midpoint's equivalent light speed via WarpToLightSpeed and narrows the range until the calculated value matches the requested light speed (rounded to 6 decimal places), or 100 iterations have passed.

Stardate Calculation

The Stardate system implemented here assumes each in-universe year corresponds to 1000 stardates, and that the stardate system's epoch (stardate 0) begins on January 1st, 2323 - chosen so that the first season of TNG (which starts around stardate 41000) lines up with the show's real-world premiere year of 2364.

Stardate.StardateToNormalDate(stardate) converts a stardate (between MinStardate and MaxStardate) into an actual Date:

  1. The stardate is divided by 1000 to determine the calendar year (the integer part, offset by 2323) and the fractional position within that year (the remainder).
  2. The fractional part is multiplied by the number of days in that year (accounting for leap years) to get a fractional day count.
  3. That fractional day count is converted into exact ticks and added to January 1st of the resulting year to produce the final date and time.

Stardate.NormalDateToStardate(normalDate) performs the reverse conversion:

  1. The time of day is converted into a fraction of a day (seconds + minutes * 60 + hours * 3600, divided by the number of seconds in a day).
  2. That fraction is added to the (zero-based) day of the year and divided by the total number of days in that year, then multiplied by 1000 to get the stardate's fractional/lower part.
  3. The year offset from 2323 multiplied by 1000 gives the stardate's whole/upper part.
  4. Both parts are summed and rounded to 6 decimal places to produce the final stardate.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
.NET Framework net472 is compatible.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.7.2

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.22 47 9/2/2026
1.0.21 47 9/2/2026
1.0.20 592 11/28/2022
1.0.19 631 9/25/2022
1.0.18 600 9/25/2022
1.0.17 577 9/25/2022
1.0.16 634 3/11/2022
1.0.15 598 3/6/2022
1.0.14 575 3/6/2022
1.0.13 598 3/6/2022
1.0.12 581 3/6/2022
1.0.11 591 3/6/2022
1.0.10 614 3/6/2022
1.0.9 589 3/6/2022
1.0.8 599 3/6/2022
1.0.6 594 3/6/2022
1.0.5 596 3/2/2022
1.0.4 463 1/15/2022
1.0.3 605 1/15/2022
1.0.2 450 1/15/2022
Loading failed