ConvertTo-Celsius

SYNOPSIS

Converts a temperature from Fahrenheit to Celsius.

SYNTAX

ConvertTo-Celsius [-Fahrenheit] <Double> [[-Precision] <Int32>] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

The ConvertTo-Celsius function converts a temperature value from Fahrenheit to Celsius. It accepts input via parameter or pipeline, validates that the temperature is not below absolute zero (-459.67°F), and returns the result rounded to the specified precision (default: 2 decimal places).

EXAMPLES

EXAMPLE 1

ConvertTo-Celsius -Fahrenheit 32
0

Converts 32°F to Celsius (0°C).

EXAMPLE 2

ConvertTo-Celsius -Fahrenheit 98.6
37

Converts normal body temperature (98.6°F) to Celsius (37°C).

EXAMPLE 3

212 | ConvertTo-Celsius
100

Demonstrates pipeline input, converting 212°F to Celsius (100°C).

EXAMPLE 4

ConvertTo-Celsius -Fahrenheit -40
-40

Converts -40°F to Celsius (-40°C), demonstrating the point where both scales intersect.

EXAMPLE 5

ConvertTo-Celsius -Fahrenheit 0 -Precision 10
-17.7777777778

Converts 0°F to Celsius with 10 decimal places of precision.

PARAMETERS

-Fahrenheit

The temperature in Fahrenheit to convert. Must be greater than or equal to -459.67°F (absolute zero). This parameter accepts pipeline input.

Type: Double
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: 0
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Precision

The number of decimal places to round the result to. Default is 2. Use higher values for more precise results, or 15 for maximum floating-point precision.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: 2
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

{{ Fill ProgressAction Description }}

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Double

You can pipe a double value representing the temperature in Fahrenheit to this function.

OUTPUTS

System.Double

Returns the temperature in Celsius as a double value, rounded to the specified precision.

NOTES

The formula used is: °C = (°F - 32) × 5/9

ConvertTo-Fahrenheit

https://en.wikipedia.org/wiki/Celsius