Dlaczego występuje błąd "Double value cannot be converted to Int"?

0

czy ktoś może rozwiązać ten błąd w tym kodzie,

fatal error: Double value cannot be converted to Int because it is either infinite or NaN
//: Playground - noun: a place where people can play

import UIKit

let D = Double(2340)
let G = Double(5688)
let A = Double(90)
let V = Double(0)
let T = Int(24)
let U = Double(30)

let r = D / 2
let R = G / 2
let O = 1 / sin((Double(A) * .pi) / 180)
let E = 1 / tan((Double(A) * .pi) / 180)
let L = R * O + r * E
let W = asin(V / R)
let P = Double .pi / 180


if Int(A) == 90 {
    
    for X in 0...T/4 {
        let F = ((Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) + V
        let B = acos(C / R)
        let K = 180 - (acos((r - V) / R) * 180) / .pi
        let I = R * cos(B) - V
        let Y = acos(I / r)
        let M = O * r * sin(Y)
        let Q = Int(round(R * E * (sin(B) - sin((K * .pi) / 180)) - M))
        print("\([X])👉")
        print("\(Q) ")}
    
    for X in 0...T/4 {
        let F = ((Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) + V
        let B = acos(C / R)
        let K = 180 - (acos((r - V) / R) * 180) / .pi
        let I = R * cos(B) - V
        let Y = acos(I / r)
        let M = O * r * sin(Y)
        let Q = Double(round(R * E * (sin(B) - sin((K * .pi) / 180)) + M))
        print("\([X])👉")
        print("\(Q) ")}
    
    for X in 0...T/4 {
        let F = ((Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) - V
        let B = asin(C / R)
        let Q = Int(round(R * (((W * 180) / .pi) + (B * 180) / .pi) * P))
        print("\([X])👉")
        print("\(Q) ")}
}else
    
{if Int(A) < 90 {
    
    for X in 0...T/4 {
        let F = ((180 + Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) + V
        let B = acos(C / R)
        let K = 180 - (acos((r - V) / R) * 180) / .pi
        let I = round(R * cos(B) - V)
        let Y = acos(I / r)
        let M = O * r * sin(Y)
        let Q = Int(round(R * E * (sin(B) - sin((K * .pi) / 180)) - M))
        print("\([X])👉t6")
        print("\(Q) ")}
    
    for X in 0...T/4 {
        let F = ((180 + Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) + V
        let B = acos(C / R)
        let K = 180 - (acos((r - V) / R) * 180) / .pi
        let I = round(R * cos(B) - V)
        let Y = acos(I / r)
        let M = O * r * sin(Y)
        let Q = Int(round(R * E * (sin(B) - sin((K * .pi) / 180)) + M))
        print("\([X])👉")
        print("\(Q) ")}
    
    for X in 0...T/4 {
        let F = ((Double(X) * Double((360 / T))) * .pi) / 180
        let C = r * cos(F) - V
        let B = (asin(C / R) * 180) / .pi
        let Q = Int(round(R * (W + B) * P))
        print("\([X])👉")
        print("\(Q) ")}
    }}
0

Ok przepraszam za moją poprawność gramatyczną , miałem inny problem ale chyba nie znajdę pomocy w tym kodzie

0

Powiedz chociaż w której linijce jest ten błąd.

0
if Int(A) == 90 {
let Q = Int(round(R * E * (sin(B) - sin((K * .pi) / 180)) + M))
let Q = Int(round(R * E * (sin(B) - sin((K * .pi) / 180)) - M))

1 użytkowników online, w tym zalogowanych: 0, gości: 1